brainstorm-tools / brainstorm3

Brainstorm software: MEG, EEG, fNIRS, ECoG, sEEG and electrophysiology
http://neuroimage.usc.edu/brainstorm
GNU General Public License v3.0
375 stars 161 forks source link

CAT segmentation process for the bst icbm anatomy folder #234

Closed tmedani closed 4 years ago

tmedani commented 4 years ago

Hi @ftadel

Always for the purpose of the head model generation, as discussed I would like to check the CAT process.

I'd like to reconstruct the pial and white matter surfaces for the BST ICBM template (or other MRI). I used the cat process for segmentation and to have these surfaces.

The process works until this error

> 
> ------------------------------------------------------------------------
> CAT preprocessing takes 40 minute(s) and 19 second(s).
> Image Quality Rating (IQR):  86.10% (B)
> Segmentations are saved in C:\Users\33649\.brainstorm\tmp\cat12\mri
> Reports are saved in C:\Users\33649\.brainstorm\tmp\cat12\report
> ------------------------------------------------------------------------
> 
> 09-Oct-2019 10:24:04 - Done    'CAT12: Segmentation'
> 09-Oct-2019 10:24:04 - Done
> 
> Error using in_tess (line 156)
> You must compute the MNI transformation for the MRI first.
> 
> Error in import_surfaces (line 137)
>     Tess = in_tess(TessFile, FileFormat, sMri, OffsetMri);
> 
> Error in import_anatomy_cat (line 308)
>     [iLh, BstTessLhFile, nVertOrigL] = import_surfaces(iSubject, TessLhFile, 'GII-WORLD', 0);
> 
> Error in process_segment_cat12>Compute (line 222)
>     errorMsg = import_anatomy_cat(iSubject, catDir, nVertices, isInteractive, [], isExtraMaps, isKeepMri);
> 
> Error in process_segment_cat12>ComputeInteractive (line 250)
>     [isOk, errMsg] = Compute(iSubject, iAnatomy, nVertices, 1);
> 
> Error in process_segment_cat12 (line 27)
> eval(macro_method);
> 
> Error in tree_callbacks>@(h,ev)process_segment_cat12('ComputeInteractive',iSubject,iAnatomy) (line 1015)
>                     gui_component('MenuItem', jPopup, [], 'CAT12 MRI segmentation', IconLoader.ICON_SURFACE_CORTEX, [],
>                     @(h,ev)process_segment_cat12('ComputeInteractive', iSubject, iAnatomy));
>  

The error was clear, I need to 'compute the MNI transformation for the MRI first'.

Is it possible to add a warning before the CAT process?

In the second attempt, I computed the MNI transformation with the bst menu "Compute MNI transformation" Then I call the CAT process, but the error is still the same.


------------------------------------------------------------------------
CAT preprocessing takes 42 minute(s) and 45 second(s).
Image Quality Rating (IQR):  86.12% (B)
Segmentations are saved in C:\Users\33649\.brainstorm\tmp\cat12\mri
Reports are saved in C:\Users\33649\.brainstorm\tmp\cat12\report
------------------------------------------------------------------------

09-Oct-2019 11:25:10 - Done    'CAT12: Segmentation'
09-Oct-2019 11:25:10 - Done

Error using in_tess (line 156)
You must compute the MNI transformation for the MRI first.

For this subject, I used the option: Import the anatomy folder and then I used the ICBM anatomy: brainstorm3\defaults\anatomy\ICBM152

Is there anything wrong with my process? any recommendation to solve this problem ?

Thanks BR Takfarinas

ftadel commented 4 years ago

Indeed, there was a problem here. Or two problems. The first is that the error message you were getting was wrong. What was missing was not the MNI transformation (it is a MNI template, so this MNI transformation is the identity anyway), but the WORLD transformation (vox2ras or qform depending on the input file format). There is indeed no reference of this type in the Brainstorm anatomy templates.

So I fixed the error message in in_tess, which now would be "There is no world transformation available for this MRI". And most importantly, I added a default vox2ras transformation matrix to the volume, so that the CAT12 process can run without other modifications. https://github.com/brainstorm-tools/brainstorm3/commit/17737f2bb9627e686b4a1319a5b172ed5707f0fa#diff-93023d7eac28561136ced1fbf06814d8

This is all theoretical, I haven't actually tried it. Please test it and re-open the issue if there is any problem.