vistalab / vistasoft

VISTASOFT is the main software repository of the VISTA lab at Stanford University.
http://vistalab.stanford.edu
148 stars 142 forks source link

Relating (?) problems with installing segmentations, viewing in Gray 3-view and rxAlign #340

Open finnlennartsson opened 4 years ago

finnlennartsson commented 4 years ago

Dear experts,

Have acquired 7T retinotopic/pRF data.

Anatomical segmentation has been done with FreeSurfer, and the ribbon.mgz transformed into a "t1_class.nii.gz" file (following the winawer wiki).

We have run our functionals through FSL (FEAT) to unwarp and register them with the FreeSurfer output "T1.mgz/nii.gz". We have used the FSL FEAT's output example_func.nii.gz to serve as an Inplane image.

Have done simple CorAnal and it works and the results are visualized on Inplane.

However, run into problems trying to install the FreeSurfer surfaces (following winawer wiki)

Closing gray windows
Closing flat windows
[installSegmentation]: Rebuilding Gray coordinates with nodes only where the inplanes have data. 
Initializing HIDDEN Volume view
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
[mrLoad]: mr.voxelSize has length<4: concatenating a "1" to it
[mrLoad]: mr.dims has length<4: concatenating a "1" to it
Index in position 1 exceeds array bounds.

Error in getVolCoords (line 67)
  vol2InplaneXform = vol2InplaneXform(1:3,:);

Error in switch2Vol (line 24)
vw = getVolCoords(vw);

Error in initHiddenVolume (line 50)
vw=switch2Vol(vw);

Error in buildGrayCoords (line 40)
    vw = initHiddenVolume;

Error in installSegmentation (line 91)
buildGrayCoords([], [], keepAllNodes, filePaths, numGrayLayers);

Error while evaluating Menu Callback.

Similarly(?), cannot open the analysis in the volume viewer (mrVista 3)

>> mrVista 3
Warning: Matlab version 9.7.0.1216025 (R2019b) Update 1 is not yet supported in vistasoft. 
> In mrVista (line 62) 
Initializing Volume view
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
[mrLoad]: mr.voxelSize has length<4: concatenating a "1" to it
[mrLoad]: mr.dims has length<4: concatenating a "1" to it
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
Attaching menus
Attaching buttons
Attaching popup menus
Attaching sliders
Done initializing Volume view
Trying to make /home/finn/Research/Projects/7T_049_Visual_Brain/pilot/MD/mrvista/Gray...
Path to gray coordinates: /home/finn/Research/Projects/7T_049_Visual_Brain/pilot/MD/mrvista/Gray/coords.mat
Building gray graph from: /home/finn/Research/Projects/7T_049_Visual_Brain/pilot/MD/mrvista/3DAnatomy/t1_class.nii.gz
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
Growing 5 gray layers...
White matter excluded in the gray graph...
Found >1 GM mesh- keeping the first since it has 204376 nodes, which is > half of all nodes (208716 nodes).
Building gray graph from: /home/finn/Research/Projects/7T_049_Visual_Brain/pilot/MD/mrvista/3DAnatomy/t1_class.nii.gz
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
Growing 5 gray layers...
White matter excluded in the gray graph...
Found >1 GM mesh- keeping the first since it has 211262 nodes, which is > half of all nodes (212273 nodes).
Index in position 1 exceeds array bounds.

Error in getVolCoords (line 67)
  vol2InplaneXform = vol2InplaneXform(1:3,:);

Error in buildGrayCoords (line 77)
vw = getVolCoords(vw);

Error in getGrayCoords (line 79)
    vw = buildGrayCoords(vw,pathStr,keepAll,[],numGrayLayers);

Error in switch2Gray (line 28)
vw = getGrayCoords(vw);

Error in open3ViewWindow (line 27)
    VOLUME{s} = switch2Gray(VOLUME{s});

Error in mrVista (line 95)
       [vw, s] = open3ViewWindow('gray');

Have not run rxAlign yet. I am happy with the unwarping and co-registration of the functionals and example_func/inplane in FSL. However, rxAlign is not happy with the inplanes, or?

>> rxAlign
Initializing HIDDEN Inplane view
No freqdim field set in the nifti. Assuming freqdim = 1. Nifti stored at: /home/finn/Research/Projects/7T_049_Visual_Brain/pilot/MD/mrvista/3DAnatomy/example_func.nii.gz
No phasedim field set in the nifti. Assuming phasedim = 2. Nifti stored at: /home/finn/Research/Projects/7T_049_Visual_Brain/pilot/MD/mrvista/3DAnatomy/example_func.nii.gz
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
[mrLoad]: mr.voxelSize has length<4: concatenating a "1" to it
[mrLoad]: mr.dims has length<4: concatenating a "1" to it
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
Index in position 2 exceeds array bounds.

Error in rxLoadMrVistaAlignment (line 30)
newXform(:,[1 2]) = newXform(:,[2 1]);

Error in rxAlign (line 77)
    rx = rxLoadMrVistaAlignment(rx,'mrSESSION.mat');

Sorry, but I guess I cannot quite understand what the fundamental problem is, I guess everything is related...

Thanks! Finn

fails1to1compile09 commented 4 years ago

Dear Finn,

I'm not an expert in the intricacies of the code and I'm not great at reading and understanding errors either, and thus the suggestions/questions below may or may not help you. I just vaguely remember some issues I had with installing the gray/white matter segmentation the first time. Not sure it will help, but it might just be your solution.

1) when you open the t1.nii.gz & than overlay it with the segmentation t1_class.nii.gz in itksnap, can you check the label editor? In the label editor, do you see the labels 41 & 42? If those labels exist, do you get a warning when you try to delete them, indicating that the label contains something (I don't remember what exactly it says)?

If that's the case, fs_ribbon2itk normally edits the labels from [3 2 41 42] to [5 3 4 6] (see https://wikis.nyu.edu/display/winawerlab/Freesurfer+autosegmentation#Freesurferautosegmentation-(4)Convertribbonfrom.mgztonifticlassfile). However, when I first tried to run fs_ribbon2itk, it would not actually change the labels. This is because fs_ribbon2itk requires administrator rights to actually change & save those labels. My solution then, was to simply open either itk_snap or itk_gray and then edit the labels manually to reflect [3 2 41 42] to [5 3 4 6] or as the stanford group describes it more clearly than me: LW: 2 => 3 LG: 3 => 5 RW: 41 => 4 RG: 42 => 6 (https://web.stanford.edu/group/vista/cgi-bin/wiki/index.php/FreeSurfer). If this is what seems to be the problem in your case, let me know, and I'll try to write more precise instructions if you struggle with it. Alternatively, you can make sure to run Matlab as an administrator. That may work as well.

2) you need a .label or .lbl file which contains info on what the labels mean. If you don't have it, I can try to help with that as well, but let me know whether that's the problem.

Quite likely you are more of an expert than me and already checked these optional problems and/or neither 1/2 are the problem, but I just wanted to see if this (I) could help ;-).