Skip to content

FIX: Disable coil visibility when opening Invesalius #871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

unichronic
Copy link
Contributor

This PR addresses the issue #867

  • Updated to disable the show coil button by default on initialization
  • The button state updates now only happens when all coils are toggled, avoiding unnecessary updates when toggling a single coil.

Disabled the show coil button by default on startup and the button state update now only happens when all coils are toggled, avoiding unnecessary updates when toggling a single coil.
@unichronic
Copy link
Contributor Author

unichronic commented Jan 4, 2025

@rmatsuda @tfmoraes @henrikkauppi Kindly review the PR

@unichronic unichronic force-pushed the coil_visualiser branch 2 times, most recently from c209bdb to c775213 Compare January 6, 2025 19:56
@unichronic
Copy link
Contributor Author

Hey @tfmoraes can you check whether I did the right thing here?

@rmatsuda
Copy link
Collaborator

Hi @unichronic! Thanks for the PR and sorry for taking so long to reply.
I got the following error:


  File "C:\Users\user\repository\invesalius3\invesalius\data\visualization\coil_visualizer.py", line 133, in ShowCoil
    Publisher.sendMessage("Press show-coil button", pressed=True)
  File "C:\Users\user\repository\invesalius3\invesalius\pubsub\pub.py", line 74, in sendMessage
    Publisher.sendMessage(topicName, **msgdata)
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\pubsub\core\publisher.py", line 216, in sendMessage
    topicObj.publish(**msgData)
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\pubsub\core\topicobj.py", line 452, in publish
    self.__sendMessage(msgData, topicObj, msgDataSubset)
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\pubsub\core\topicobj.py", line 482, in __sendMessage
    listener(data, self, allData)
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\pubsub\core\listener.py", line 237, in __call__
    cb(**kwargs)
  File "C:\Users\user\repository\invesalius3\invesalius\gui\task_navigator.py", line 1799, in PressShowCoilButton
    self.OnShowCoil()
  File "C:\Users\user\repository\invesalius3\invesalius\gui\task_navigator.py", line 1822, in OnShowCoil
    Publisher.sendMessage("Show coil in viewer volume", state=pressed, coil_name=coil_name)
  File "C:\Users\user\repository\invesalius3\invesalius\pubsub\pub.py", line 74, in sendMessage
    Publisher.sendMessage(topicName, **msgdata)
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\pubsub\core\publisher.py", line 215, in sendMessage
    topicObj = topicMgr.getOrCreateTopic(topicName)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\pubsub\core\topicmgr.py", line 207, in getOrCreateTopic
    obj = self.getTopic(name, okIfNone=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\wx\core.py", line 2346, in Notify
    self.notify()
  File "C:\Users\user\AppData\Local\miniconda3\envs\invesalius\Lib\site-packages\wx\core.py", line 3552, in Notify
    self.result = self.callable(*self.args, **self.kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\repository\invesalius3\app.py", line 118, in Startup2
    self.control = self.splash.control
                   ^^^^^^^^^^^^^^^^^^^
AttributeError: 'Inv3SplashScreen' object has no attribute 'control'
Traceback (most recent call last):
  File "C:\Users\user\repository\invesalius3\app.py", line 256, in OnClose
    if self.fc.IsRunning():
       ^^^^^^^
AttributeError: 'Inv3SplashScreen' object has no attribute 'fc'

@unichronic unichronic closed this Mar 25, 2025
@unichronic unichronic reopened this Mar 25, 2025
@unichronic
Copy link
Contributor Author

Sorry I closed the PR by mistake.
Hey @rmatsuda !
Have fixed the recursion that was occuring due the OnShowCoil and Show-coil button is disabled by default.

.gitignore Outdated
@@ -160,6 +160,7 @@ ENV/
env.bak/
venv.bak/
myenv/
samples/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change needs to be reverted.

Copy link
Contributor Author

@unichronic unichronic Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright done. But is the change working as intended?

@rmatsuda
Copy link
Collaborator

Thanks for the fixes! I found one bug and I have one suggestion.

Bug: For some reason, when the preference dialog is open, the coil visualization button is set to ON, but it does not change the actual visualization of the coil.

Suggestion: When navigation starts, if the coil is available, its visualization should automatically turn ON.

@unichronic
Copy link
Contributor Author

unichronic commented Mar 26, 2025

Can you specify the steps you took, so that I can recreate this bug because in my case even when I open Preferences its still in disabled state. Or are you talking about a different button?

image

@rmatsuda
Copy link
Collaborator

Do you have one coil created?
image

@unichronic
Copy link
Contributor Author

unichronic commented Mar 26, 2025

Hey @rmatsuda I was doing a few things wrong as I am new to using coils, but anyway now I have implemented the changes.
Is it working as intended now?

@unichronic unichronic requested a review from rmatsuda April 2, 2025 21:54
@unichronic
Copy link
Contributor Author

Hi @rmatsuda! it would be great if you could review the changes.
Also if any others have time, please take a look.
CC: @tfmoraes @paulojamorim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants