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

ROI definition issue on Macbook - seemingly easy fix #328

Open
fails1to1compile09 opened this issue Jan 16, 2020 · 5 comments
Open

ROI definition issue on Macbook - seemingly easy fix #328

fails1to1compile09 opened this issue Jan 16, 2020 · 5 comments

Comments

@fails1to1compile09
Copy link

fails1to1compile09 commented Jan 16, 2020

Dear all,

Another question: on my Macbook Mojave, mrMesh does work, but there is an issue with transferring the ROI from the brain's surface in the Mesh window to the Gray volume window.

I figured out a seemingly easy fix, but if someone can confirm that it is a valid fix (and won't cause any problems), that would be great.

It appears that while Volume{x} updates the Mesh number (e.g., Volume{1}.meshNum3d=2), it does not get updated in the vw variable. mrMesh tries to find the selected mesh in view, and crashes.

If I make the following change in the function meshROI2Volume, it appears to update the variable vw to Volume{1} in my case, but presumably the current volume, and the issue dissappears.
vw now also contains the substructure meshNum3d.
The change: replace "if notDefined('vw'), vw = getSelectedVolume; end" by "vw = getSelectedVolume;". (line 27).

Does anyone see any issue with this temporary fix?

Thank you

@JWinawer
Copy link
Member

JWinawer commented Jan 17, 2020 via email

@fails1to1compile09
Copy link
Author

fails1to1compile09 commented Jan 17, 2020

Dear Prof. Winawer, and other colleagues,

(EDITED on Sunday 19 January 4:25 am, PST; 7:25 am EST)

Thank you very much.

Problem in the 3D window - more information - and possible solution
I tested the codes some more, and I noticed that my problem only occurs when I:

  1. open the VOLUME window (e.g. mrVista '3')
  2. click on the menu Window and subsequently 'Open 3D Window'.
  3. draw the ROI using keys like 'd' (draw), 'c' (complete), 'f' (fill), 'u' (undo)
  4. in the 3D window, click on the menu Mesh, then Xform ROI, then click on 'Mesh ROI to VOLUME (fill layers)'

When I use debugging mode (the red circles on the left of the code), and I check what kind of vw variable the function gets as input, I see something that looks very differently from VOLUME{1}.
The vw input to meshROI2Volume looks like a structure of Menu, Figure and UI definitions, even after the function runs mrGlobals. E.g., vw.figure1, vw.menuImages, vw.menuPlot, vw.menuMesh, vw.menuEdit, vw.btnUpdate, vw.txtROIsize, vw.editROIsize, (...), vw.menuFile.

If I try to debug step by step, I add the following after "if notDefined('vw'), vw = getSelectedVolume; end" (line 27). in meshROI2Volume:
tmp = getSelectedVolume;
vw.meshNum3d=tmp.meshNum3d;
vw.mesh=tmp.mesh;
vw.edges=tmp.edges;
vw.nodes=tmp.nodes;
vw.coords=tmp.coords;
vw.ROIs=tmp.ROIs;
vw.viewType=tmp.viewType;
vw.ui=tmp.ui;
vw.name=tmp.name;
vw.selectedROI=tmp.selectedROI;
vw.anat=tmp.anat;
vw.refreshFn=tmp.refreshFn;
vw.curDataType=tmp.curDataType;
clear tmp

Now the code finishes running AND -unlike in earlier edits- it stores the ROIs. The required tmp fields appear to originate from a structure that is very similar to VOLUME{1}, which is what made me think that "meshROI2Volume" gets the wrong vw structure input for some reason.
If this is the case, this really seems to be a big problem here. Does anyone have suggestions for a cleaner/more sophisticated way to solve the issue in the 3D window?

For now, I go for the safer solution: don't use the 3D window for ROIs at all
Very recently, I started thinking outside the box, and tried to see if there is a way to define the ROIs from the VOLUME (Gray) Window. And this manner exists (Thank you so much, programmers!).

The way to do this is:

  1. open the VOLUME window (e.g. mrVista '3')
  2. click on the menu Gray, Surface Mesh, Build New Mesh and subsequently click 'Left Hemisphere' (or 'Right Hemisphere'). (select the appropriate segmentation file)
  3. draw the ROI in the Mesh surface that appears using keys like 'd' (draw), 'c' (complete), 'f' (fill), 'u' (undo)
  4. click on the menu Gray, Mesh ROIs and subsequently click 'Get ROI From Mesh (drawn with "d" key , All Layers)'.

In this approach, the issue does not occur. It also uses meshROI2Volume, but it gets an empty vw input (as I found out when using 'debugging mode' to evaluate what was happening). As a result, when the code runs line 27 "if notDefined('vw'), vw = getSelectedVolume; end", it will actually run vw = getSelectedVolume, which appears to work in this context.

@JWinawer
Copy link
Member

JWinawer commented Jan 20, 2020 via email

@fails1to1compile09
Copy link
Author

fails1to1compile09 commented Jan 20, 2020

I tried to expand a little on what I did below (perhaps the extra details will clarify it):

The only time I use the code, is to 1) initialise the session (mrInit), and to 2) open the GUI session (e.g., "mrVista", "mrVista '3'"). After that, I only use the GUI. I do some extra things for the connective field model, but by that stage, I don't use the mrMesh anymore (ROIs have been delineated using the above general 2-step GUI approach).

I do this:
1. open the VOLUME window (e.g. mrVista '3')
2. click on the menu Window and subsequently 'Open 3D Window'.
3. in the 3d window, click on the menu File, then Build From Volume, then click Left Hemisphere.
4. in the dialog window that pops up, I change nothing and press ok
5. when they ask whether the selected segmentation is the right segmentation, I press Yes (I previously set the labels according to instructions for the toolbox online, using ITKgray/ ITKsnap)
6. in the window that asks me to save, I click Cancel
7. then to smooth, I click on the menu Mesh, then Smooth Mesh / Smooth Mesh (user selected), and follow the required steps.
8. I draw the ROI using keys like 'd' (draw), 'c' (complete), 'f' (fill), 'u' (undo)
9. in the 3D window, click on the menu Mesh, then Xform ROI, then click on 'Mesh ROI to VOLUME (fill layers)'

Via this approach, I get the error. (I give more details about my own debugging attempts above )
Do you need extra details of the process before step 1, or will this suffice? Generally, I followed the online instructions for the analysis for it.

If I instead do things from the VOLUME window (all GUI; I only give the main steps), I don't get the error. If requested, I can also give the steps for that, but it appears to be less relevant.

@fails1to1compile09
Copy link
Author

fails1to1compile09 commented Jan 25, 2020

Is this sufficient detail, or is a more thorough description required?

Edit: to clarify, I found the above mentioned 'alternative' working approach from the VOLUME window more or less through trial and error. I wasn't sure if it is the correct approach.
Now, I did a search to see if I could confirm this approach, and it's basically the same as following Prof. Winawer's (your) instructions here: https://devwikis.nyu.edu/display/winawerlab/3D+mesh+visualization#id-3Dmeshvisualization-BuildingmeshesinGUI .
So this must be the correct approach, and (for now, at least) I will avoid the 3D window approach described above.

I guess it might be helpful to fix the 3D window approach, in case others are (failing at) using it, but -given that there is a working approach- it is either unnecessary or should not have priority (?)

Thank you for your time

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

No branches or pull requests

2 participants