= T1-MRI Segmentation with BrainVISA = It is not the purpose of Brainstorm tutorials to teach you how to use BrainVISA. But most Brainstorm users are lost when it reaches to the segmentation of the MRI. So here is a short introduction of the BrainVISA T1 Pipeline. To extract head and cortex meshes from a T1 MRI, you can also try to use: [[Tutorials/SegBrainSuite|BrainSuite]] or [[Tutorials/SegFreeSurfer|FreeSurfer]]. == Installation == * Download the latest version of BrainVISA from [[http://brainvisa.info|http://brain.info]]. * Install it on your computer by following the instructions on the [[http://brainvisa.info/download.html#installation|download page]]. * Start BrainVISA * You'll have to create a database for saving your files: this will be either asked at startup, or you'll have to !BrainVISA menu > Preferences: {{attachment:database.gif}} * Click on Add, and create a directory with is __not__ in any Brainstorm directory. For example: * __Windows__: My Documents\brainvisa_db\ * __Linux__: /home/username/brainvisa_db/ * MacOS: Documents/brainvisa_db/ * Click on Ok. * Your are ready to import and process your MRI. == Import MRI == To process a MRI volume with BrainVISA, you have first to import it in the database. Select the process: T1-MR1 > Import > Import T1 MRI, and click on Open button. {{attachment:importMri.gif}} The following figure will appear: {{attachment:importMriForm.gif}} As an example, you can take the MRI from the 4D-Neuroimaging tutorial (bst_sample_4d.zip accessible from Download section). Select the input file. To select the output file: Click on the red button, fill the following fields: * Protocol: segmentation * Subject: 4D * A default filename should appear, and you just have to click on Ok. Click on Run, wait for the process to end. Done. You can close this window. == Configure T1 pipeline == Back to BrainVISA window, now select process T1 MRI > Segmentation Pipeline > T1 Pipeline. {{attachment:selectT1Pipeline.gif}} Click on open. {{attachment:T1PipelinePrepare.gif}} How to fill all those fields: * Mri: click on the green button, and select from the database the MRI you've just imported * Anterior commissure: * Click on the "Anatomist" button. This will start anatomist. * In Anatomist window, look for a view that gives you an axial view * Then place the cross on the anterior commissure ([[CoordinateSystems|see this page if you are in trouble]]) * The go back to the "T1 Pipeline" window again, and click again on "Anatomist" button. This should write the current position of the cursor in the "Anterior commissure" field. * Repeat for all the other points: Posterior commissure, Interhemispheric point, Left hemisphere point * Uncheck the "Cortical Fold Graph" step, we don't need that. The go to the "AC/PC Or Normalization" step, and select __true__ for the option allow_flip_initial_MRI. {{attachment:T1PipelineAllowFlip.gif}} Click on Run and pray hard. == What if it crashes ? == Your first try might be a failure. Don't give up, it might be easy to fix. If the process that crashed has two option (like all the steps from "T1 Bias correction" to "Split brain mask"): * Select the other option (Example: "VIP bias correction" instead of "1 - T1 Bias correction") * Uncheck all the processes that were successful (indicated with a green arrow), so that the Pipeline do not have to start from scratch again. * Click on Run again. If it still crashes: * Try to change other options (like the selections in the previous steps) * Post your anger about this absolute waste of time on BrainVISA forum * Try another software. == If it worked ? == If you see at some point green arrows in front of all the processes: you are done. You now need to import the files BrainVISA produced in !BrainStorm. Here are the paths on my installation of BrainVISA (can be slightly different on your computer...): * __MRI__: !BrainVisa_db\Segmentation\4D\t1mri\default_acquisition\default_analysis\'''nobias_4D.nii.gz'''<
> * I recommend to use the nobias volume, as you are sure that it will be correctly oriented in Brainstorm. * If Brainstorm still doesn't have a .nii.gz format in Import MRI window, you'll have to gunzip this file first. * __Scalp__: !BrainVisa_db\Segmentation\4D\t1mri\default_acquisition\default_analysis\segmentation\mesh\'''4D_head.mesh''' * __Left hemisphere__: !BrainVisa_db\Segmentation\4D\t1mri\default_acquisition\default_analysis\segmentation\mesh\'''4D_Lhemi.mesh''' * __Right hemisphere__: !BrainVisa_db\Segmentation\4D\t1mri\default_acquisition\default_analysis\segmentation\mesh\'''4D_Rhemi.mesh''' * Remind to always import ALL the surface at the SAME time in Brainstorm, if not they won't be correctly registered with the MRI. Never forget to check the final surfaces in Brainstorm, they still might be completely wrong. Example of a first try with BrainVISA, after import + merge. {{attachment:BstResult.gif}} If this happen to you too, you'll have to start again the whole segmentation process, either selecting other options in BrainVISA, or using another software solution. Have fun...