Skip to content
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

Neuronavigation: Track multiple coils simultaneously and show stylus/probe #827

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

Conversation

lukatolo
Copy link

Refactors to core code:
obj_ref_mode is replaced by obj_id, which is simply the index of the object/coil in coord_raw

Removed CorregistrateCoordinateNoObject thread and made CorregistrateCoordinate able to track both coil and probe, depending on if 'Track coil' button is pressed.

Stylus visualization:
Please see my updated comment in: #808

Multicoil:
The coils used in navigation are generally stored in dictionaries and are accessed by name (coils are named by user on creation)

Coil registrations are created in preferences and automatically stored in config.json. Coils are selected for navigation here by clicking buttons with the coil name.

Backwards compatibility:
For tracking a single coil (ie. when n_coils = 1), everything should work as before.

The only exception is Polaris. Code related to Polaris was changed here for multicoil support. Therefore, Polaris will only work with an updated pypolaris wrapper that gives a list of coordinates for the coil.

@lukatolo lukatolo changed the title Track multiple coils simultaneously and show stylus/probe Neuronavigation: Track multiple coils simultaneously and show stylus/probe Aug 22, 2024
@lukatolo lukatolo force-pushed the multicoil branch 2 times, most recently from 2740584 to dee2cdb Compare August 31, 2024 10:39
@lukatolo lukatolo force-pushed the multicoil branch 3 times, most recently from 11c4e29 to 95ff0f7 Compare September 2, 2024 07:10
@rmatsuda
Copy link
Collaborator

rmatsuda commented Sep 5, 2024

Hi!

I tried to open with an old state and config and its returning the following error. It would be good to have back compatibility

invesalius3\invesalius\data\visualization\coil_visualizer.py", line 149, in AddTargetCoil
decoded_path = next(iter(self.coils.values()))["path"]
StopIteration
Traceback (most recent call last):

@rmatsuda
Copy link
Collaborator

rmatsuda commented Sep 5, 2024

When I tried to open preference, its returning

\invesalius3\invesalius\gui\preferences.py", line 1239, in LoadConfig
self.robot_ip = state.get("robot_ip", None)
AttributeError: 'NoneType' object has no attribute 'get'

@rmatsuda
Copy link
Collaborator

rmatsuda commented Sep 5, 2024

When I tried to open preference, its returning

\invesalius3\invesalius\gui\preferences.py", line 1239, in LoadConfig self.robot_ip = state.get("robot_ip", None) AttributeError: 'NoneType' object has no attribute 'get'

I tested with master and its fine

@lukatolo lukatolo force-pushed the multicoil branch 5 times, most recently from 95374e8 to 9fb0631 Compare September 10, 2024 10:30
Tolonen Luka added 26 commits September 18, 2024 16:51
…s as opposed to y-axis. Also, removed unnecessary disabling of 'Track coil' button before navigation.
…nit dialogs. Polaris init dialog now asks for n_coils Coil ROM files.
Rename/repurpose obj_ref_mode to obj_id (this is the index of an object in coord_raw).

Use dicts throughout code so that coils can be controlled by name. Simplify CoilVisualizer and coregistration.

Add coil selection buttons to Preferences ObjectTab.
Improve ObjectTab init by using LoadConfig. Remove self.track_obj state var from GUI, it is a property of Navigation class.

Addition: load/save coil from/to OBR file.
…ad) since the ICP data is constant once created. The ICP data is passed to coregistration when the navigation is started, so it is up to date with the ICP data defined in Refine tab.
…aris ROM init dialog. Update handling of marker_visibilities to support multiple coils.
…coil_name is specified and in navigation.coil_registrations before robot can be used
…. Add CoilSelectionDone function to simplify preferences code
…d the following:

  Messy multicoil instructions (there will be separate documentation for that)
  Unnecessary feature of changing the index (obj_id) of a registration
… Now it is correctly oriented with NIFTI heads. TODO: unify the orientation of MRI and NIFTI heads in vtk?
… Remove obj_id=0 choice in multicoil mode. Automatically select a coil for navigation when it's created. Other fixes related to edge cases in coil creation/selection in multicoil mode
…hen loading state file. Update environment.yml. Minor refactors ie. naming changes.
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