-
Notifications
You must be signed in to change notification settings - Fork 0
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
Thresholding of isosurface without creating a new one #31
Thresholding of isosurface without creating a new one #31
Conversation
…pup menu on 3D figure
@rcassani I have added something like this: keyboard shortcut (Shift+uparrow/downarrow) for coarse isovalue change; menu option on popup for fine isovalue change: ![]() It is ready for review. Might need some more code and GUI cleanups. But if you can test the basic functionalities and let me know I can go forward with cleaning up. |
toolbox/gui/figure_3d.m
Outdated
jPanel.add(jButtonSet, BorderLayout.EAST); | ||
java_setcb(spinmodel, 'StateChangedCallback', @(h,ev)tess_isosurface(CtFile, jSpinner.getValue())); | ||
jPanel.add(jSpinner, BorderLayout.EAST); | ||
% jButtonSet = gui_component('button', [], '', 'Set', [], [], @(h,ev)tess_isosurface(CtFile, jSpinner.getValue())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for commit 1b99a59 also removed the need to another button click
This crashes if there is already a @chinmaychinara91, @tmedani, Did you use the proposed changes to search for the ideal threshold value from a CT where the ideal threshold is not known? I did, and I found quite cumbersome to search for the desired threshold value. While the changes in this PR remove the slider from the Surface, the proposed input in the context menu does not accept an arbitrary number just pre-defined +-50 steps with the up/down arrows; similar to the key shortcuts, but for some reason there the steps are +-100. Let's keep the slider in the Surface tab for now. |
Fixed. check dc3ccce
So from the feedback from Johnson on how the isoValue threshold is used when doing manual labelling is there is no one isoValue that we can say is the best. There could be some ideal cases but in reality the isovalue threshold might need adjustment while localizing every contact. He has been using 3D slicer to do the same thing and it does something similar but they have a slider feature for threshold and the mesh generation is faster/almost real time there probably because of C++. Maybe we can adjust the numbers from 50/100 to something better.
Yes this is not an editable text field rather it reads the current isoValue from the comment and updates it as the initial value. Discussed this with @tmedani, the up down arrows in the context menu can then be used is for fine tuning by +-50. The shortcut keys (shift+up/down) is for a coarser tuning +-100. Just chose these values arbitrarily but we can come up with a better number. Do you think we should have it as an editable field so that people can enter values into it directly?
I feel we should test and debug this approach and remove the slider option from Surface tab. Let me know what you think. |
Hey guys @chinmaychinara91 @rcassani From user perspective (and from what we have previously discussed), it is better to have this shortcut active. The CTs do not have fixed threshold, each electrode or even each contact may need a different threshold to be visible. Using the shift+up/down is faster for visual inspection and then contact editing, also this is inline with what 3D slicer uses, As @chinmaychinara91 proposed, we can increase the steps [+/-100] and keep the menu for fine tuning if required. I will double check with Chinmay later today about the values. |
@chinmaychinara91, @tmedani |
also popup menu isoValue display size updated
@rcassani this is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works as it should. There is a bug with the wrong selection of CT file, this is one of the items reported in the PR (brainstorm-tools#732) and needs to be solved.
While the code does not delete and create a new isosurface file. If does rewrite the content at every change. Is there a value on doing this?
Personally, I found more useful the slider implementation, it allows to do big jumps in the threshold to do binary search of thresholds for identify contacts.
@chinmaychinara91, Did you take a look to the GUI of the "Edit MRI registration" as I asked you before doing these changes?
https://neuroimage.usc.edu/brainstorm/Tutorials/Yokogawa#Refine_the_MRI_registration
We can do this kind of GUI, to provide tools to manipulate the isosurface to locate electrodes, just to mention some:
- threshold slider
- presets to thresholds, so once user identifies them
- turn on/off the centroid option
- the get coordinates cross (since the iEEG can be open without 3D figures)
- and others
Also, all the manipulations would not need to save any change in disk, as the relevant information is the electrode positions, not the changes in the isosurface.
@tmedani, any thoughts?
% update isoValue threshold (Shift + Up/Down) | ||
elseif ismember('shift', keyEvent.Modifier) && ~isempty(iIsoSurf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify to elseif ismember('shift', keyEvent.Modifier)
, inside that condition, then check if there is CT isosurface, otherwise do nothing.
This leave the option of other shift actions in the future.
Handles = bst_figures('GetFigureHandles', hFig); | ||
% Check if there is SEEG isosurface displayed on the figure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be check in the shift
condtion.
See: comment for line 1081
% Get Surface | ||
TessInfo = getappdata(hFig, 'Surface'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be check in the shift
condtion.
See: comment for line 1081
% get the CT file and structure | ||
SubjectFile = getappdata(hFig, 'SubjectFile'); | ||
sSubject = bst_get('Subject', SubjectFile); | ||
iCt = find(cellfun(@(x) ~isempty(regexp(x, '_volct', 'match')), {sSubject.Anatomy.FileName})); | ||
CtFile = sSubject.Anatomy(iCt(1)).FileName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug reported in the PR2
Wrong CT volume can be selected thresholding CT with slider
This can happen if there are more than one CT in the Subject. For example is isosurface is create from popmenu on the 2nd CT (in the image below) using the arrows or the popmenu to change the threshold will do it for the 1st CT.
A better way to fix this would be to add the filename of the CT that gave origin to the isosurface in the isosurface structure. Maybe in the history
% get the CT file and its structure | ||
SubjectFile = getappdata(hFig, 'SubjectFile'); | ||
sSubject = bst_get('Subject', SubjectFile); | ||
iCt = find(cellfun(@(x)(~isempty(regexp(x, '_volct', 'match'))), {sSubject.Anatomy.FileName})); | ||
CtFile = sSubject.Anatomy(iCt(1)).FileName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same potential problem on getting the wrong CT
We agree with your proposal. Let me work on it. This sounds more user friendly as well. |
closing this PR. Will start a separate PR based on the above recommendation |
Surface
tabOther related issues:
@tmedani