MRI Segmentation MIDAS, 2007, 2010 Lawrence O. Hall, Dmitry Goldgof, Yuhua Gu, Prodip Hore Dept. of Computer Science & Engineering University of South Florida CONTENTS: 1. Introduction... 1 2. Installing the program... 2 3. Starting the Program... 3 3.1. Widget Interface... 3 3.2. Segmentation with an Other Tissue Mask... 3 3.3. Batch Operation... 4 4. Data Formats... 5 5. Importing non-midas Segmentations... 5 6. Acknowledgments... 7 1. Introduction This program provides automatic segmentation of cerebrospinal fluid (CSF), white matter, and gray matter from MR imaging of the human brain. Up to three MRI data types can be used: T1- weighted, Proton-Density weighted and T2-weighted images. Since T1 and T2/PD commonly have different spatial resolutions, data alignment is performed by registration software if two or three image types are used by segmentation methods. Four methods are implemented: 1. Single pass algorithm (volume based). The single pass algorithm partitions the entire image volume by scanning the data from the disk only once. We provide a final computationally inexpensive segmentation refinement step after the Fuzzy clustering algorithm to model the clusters as Gaussians and compute the covariance matrix associated with features. Then the final segmentation is produced computing posterior probabilities assuming uniform priors for the 3 classes. 2. Bipartite-Merger. The Brfcm algorithm over-classifies each slice of a volume in to 9 clusters (excluding air). Out of these, some are purely extra cranial (skull etc.) and the rest contain intracranial tissues. The Bipartite merger then optimally matches the clusters between any two adjacent slices of a volume using a minimally weighted bipartite matching algorithm. Thus, in our case we obtain 9 chains (a chain is a series of similar matched clusters in the Z direction) of clusters. Heuristics are then used to label which chain is what i.e. which chain is skull (BET mask used for it), which one is CSF, gray matter or white matter. After labeling, split gray matter 1
or white matter chains are then merged to form complete gray matter or white matter segmentation. 3. FSL/FAST (old version). See the FSL website [http://www.fmrib.ox.ac.uk/fsl/] for a full description. 4. FSL/FAST 4.1. 2. Installing the program The program is automatically installed as part of the MIDAS system. If a separate installation is required the following procedure can be used: 1. Unzip "MriSeg" package, then move all files and folders to the desired location: (e.g.) c:\midas\bin\ 2. Go to c:\midas\bin\ Use edit software to open: runmrisegui.bat (UI mode) Or runmrisegbm.bat (batch mode) Change: Set Midasbindir= c:\midas\bin\ Then save it. 3. Copy c:\midas\bin\native-properties\windows\nativecodes.properties to $home\$usr\midas\modules\nativecodes.properties. NOTE: For the Linux version installing, the MriSeg programs and registration programs permission needs to be modified to allow execute permission before running. Ex: Go to INSTALL_PATH/Midas/Bin/mriseg/bin/Linux Type: chmod 755 * Go to INSTALL_PATH/Midas/Bin/native-codes/Linux Type: chmod 755 * Similar changes will be made runmrisegui.linux or runmrisegbm.linux export RegLib= INSTALL_PATH/Midas/Bin/javadir Before copying INSTALL_PATH/Midas/Bin/native-properties/Linux/nativecodes.properties to $home/$usr/midas/modules/nativecodes.properties. Use edit software to open this file too. Change three locations: Mriseg.folder= INSTALL_PATH/Midas/Bin/mriseg Mriseg.bin.folder= INSTALL_PATH/ Midas/mriseg/bin/Linux Binaries.folder= INSTALL_PATH/ Midas/native-codes/Linux 2
3. Starting the Program 3.1. Widget Interface The program can be run from the MIDASTools button bar icon:. The program can also be run from the command line. Go to INSTALL_PATH\Midas\Bin\ and run: runmrisegui.bat (windows) or runmrisegui.linux (linux). The program starts with the widget interface shown in Fig 1: Fig. 1 Fig. 2 The first operation must be to click the Browse button, which opens up the MIDAS browser (Fig. 2). Selection must be done on the study level, then click Done. Next, select the segmentation method and options. Currently (Nov 2010), the FSL with bias field correction and partial volume output is the method used for 3T data acquired for the MIDAS project. The default value for fractional intensity threshold for FSL4.1 is 0.5, whereas a value of 0.3 was used for previous version of FSL. Then click Process to start processing. 3.2. Segmentation with an Other Tissue Mask This option can be used when there are lesions in the brain, for the purpose of: a) having a separate tissue map covering the lesion volume, and b) stopping the voxels in the lesion from affecting the quality of the segmentation of the normal tissue regions. This option is only available with FSL/FAST 4.1 segmentation method. 3
The procedure requires the following steps: 1. The user must manually create a mask describing the lesion volume(s) (VOIs) at the T1 image resolution. This can be done using an external segmentation package (e.g. Slicer or MIPAV) 2. Save the VOI mask as either Analyze or NIFTI hdr/img pair files with the file names other.hdr and other.img and located under the same directory as the T1 image. Data format should be byte or integer. 3. In the segmentation program, select the FSL/FAST 4.1 method, and click the Change fractional intensity threshold and additional flag for FSL box under the main widget. Then under the pop-up window, put --class=4 option in the additional flag text box, then click OK button. The rest of the segmentation processing will be exactly the same way as the regular segmentation. The result of the segmentation will contain 4 tissue types: CSF, Grey-Matter, White- Matter, and Other, the pair of image files for Other tissue is simply a copy of original other.hdr and other.img files. Therefore, if the Save partial volume option was selected for the segmentation results, the result for Other will remain the 0/1 value of the original mask. 3.3. Batch Operation Run: setpath.bat type: Java edu.miami.midas.mriseg.runmriseg and you will get usage information of this program: -f <program name: fsl or clp or bip or spass> choose different segmentation tool -s <1, 2a, 2b, 3 > number of features to be used, default is 1, 2a (T1 and T2) 2b(T1 and PD), 3 (all features) -p <path for subject.xml> ex: c:\data\mn012\subject.xml -d <Study ID> -fit: <The fractional intensity threshold value for brain extraction tool: 0-1, default is 0.2> -b : do bias field correction, but do not save -ob: do bias field correction and save corrected data -ov: save partial volume option (not all packages have this option) -a: use apriori probability maps (FSL package only)" -3d: <followed by two numbers, which are the parameters for 3d bias correction (s ingle pass package only), e.g. -b -3d 2 3 > ex (1): java edu.miami.midas.mriseg.runmriseg -f fsl s 1 -p D:\data\VOL016\subject.xml -d 1.3.12.2.1107.5.2.13.20560.30000005072118294371800000001 -ob (use FSL package, T1 feature is used, do bias field correction and save corrected data) ex (2): java edu.miami.midas.mriseg.runmriseg -f spass s 1 -p D:\data\VOL016\subject.xml -d 1.3.12.2.1107.5.2.13.20560.30000005072118294371800000001 -b -3d 2 3 -ov (use single pass package, T1 feature is used, do bias field correction but don t save corrected data, output partial volume result) Segmentation with FSL4.1 in batch mode. 4
If this segmentation procedure is called from the IDL BATCH program, it runs the batch file named SEG_FSL4_T1.BAT, which is located under MIDAS bin directory. IDL batch passes the subjectxml path, studyid, and additional options such as ob. These are then passed to the Java program. The actually call to the JAVA class looks like this: JAVA %fullpath%runmriseg f fsl4 p C:\project_dir\subject_dir\subject.xml d studyid Additional options include: -s # number of image channel, default is 1 -fit 0.## user defined fractional intensity threshold, between 0~1, default is 0.2 -B -b save bias corrected image, default -nopve do not do partial volume classification -ov save partial volume classification, default -a use prior probability maps for initialization, must give path of probability map, currently not supported. --class=4 using 4 tissue types, this option works with additional mask image other.hdr/other.img under mri directory. 4. Data Formats The format used for the tissue segmentation results is based on the Analyze format: - Orientation is same as MRI - Data type is byte, with value 0 or 255 equivalent where 255 indicates it is a particular tissue type and 0 means it is not In the MIDAS XML description, the segmentation data is stored as a FRAME, and the descriptor of the corresponding tissue type is given using the FRAME_TYPE definition tag multiple images representing each tissue type are concatenated into a single file, a corresponding header file is created too. 5. Importing non-midas Segmentations Results from other segmentation programs, such as SPM, can be imported in ANALYZE format (*.hdr/*.img pair). Start the MIDAS Importer, then click on the Data Management button and click on the Import Segmentation button (Figure 3). 5
Figure 3 Click on the GM button (Figure 4) for importing segmented gray matter images file, browse to a directory that has segmented images, select the *.img file, and repeat this procedure for importing *.img files of white matter and CSF images. Figure 4 6
Click on the Input 1 button (Figure 5) under the heading MR files used to create Segmentation to identify the type of MRI data used (T1-weighted and T2-weighted and/or PD-weighted) for segmentation. For example, the segmented image files in the PracticeSVSData directory were created using a T1-weighted MRI data only, so select the MRI_T1 Volume node, click the Save button and wait until the Analyze Format to import?!.. widget vanishes. Figure 5 6. Acknowledgments This program was developed by Yuhua Gu, and Prodip Hore, and used the method proposed by Dr. Lawrence O. Hall and Dr. Dmitry Goldgof. Implementation of FSL 4.1 was done by Jiping Zhan in 2010. This work was supported by NIH grant EB000822 under the MIDAS project. 7