MrGray-ITKGray-Mesh

From VISTA LAB WIKI

Jump to: navigation, search

[edit] Using mrGray to build a Mesh from an ITKGray Segmentation

Building a mesh from an ITK-Gray segmentation is comprised of two steps--preparing the files for mrVISTA, and then building the surfaces in mrVISTA.

Currently, the processing stream is a little convoluted, as the files must be converted to the mrGray formats to make them usable inside mrVISTA. There are two reasons to use this older path: (1) It works reliably. Although mrVISTA will support building a mesh from the classification NIFTI produced by ITK-Gray, this currently produces a serious error on most machines. (2) Using the NIFTI classification files for the segmentations and meshes prevents you from using flat maps with a segmentation; it is a necessary step if you like looking at flat maps.

1. Separate classification between left and right hemispheres, and save as NIFTI

When you work on the segmentation in ITKGray, save the classification as a NIFTI file (e.g. subject_class.nii.gz). (Ctrl+S, or File -> Save Data -> Save Segmentation Image). It is a good habit to save frequently, as ITKGray has NO auto-save feature.

When you finish the segmentation to your liking, save again. Then, run the Topology Check in Topology Tool. You shall have 2 volumes now (if > 2, you shall delete satellite volumes). Move cross-hair to the right hemisphere white matter, and click "Del" button in Topology Tool. Now the classification comprises only left hemisphere. You must save it with the suffix "_left" (e.g. subject-class_left.nii.gz).

Now, load the original 2-hemisphere class (subject_class.nii.gz) using Load Data -> Load Segmentation. Delete the left hemisphere, and save the right hemisphere with the suffix "_right" (e.g. subject-class_right.nii.gz). Finally, create two directories and name them 'Left' and 'Right'. Move each class files into its corresponding directory (e.g. 'subject-class_left.nii.gz' in Left).

2. Convert NIFTI class files to mrGray class files

This step comprises MATLAB commands, and they work successfully on sechel. Use the following commands:

 class = readClassFile('subject-class_right.nii.gz',0,0);
 class.header.minor = 1;
 writeClassFile(class, 'subject-right.Class');

Name the resulting Class file something distinctive so that you can find it. mrVISTA has some trouble reading this class file, so you'll have to use mrGray to create another one--you just have to keep them apart. Also, mrVISTA has had some trouble reading files with underscores in them--use dashes or nothing. Also, if you have trouble with these functions, they may be Linux-specific.

3. Use mrGray to create and save a .Gray file

For each hemisphere, create a new mrGray project. Use the hi-res vAnat from the subject (specified when you create the project). After you've created the project, click File>>Classification>>Load, and load the mrGray class file that you saved in Matlab. Click on Classification>>Grow Gray Matter, and then on close when the dialog box is finished. This should create a region of Gray matter (probably colored green) around the white matter you've segmented. To save the Gray matter, hold down Control and click on the Gray matter to select it. It should change color. Now click on File>>Save Selected Gray, and save it (e.g. subjectRight.Gray). For details, see the mrGray section in this topic.

4.Install Segmentation and Build the Mesh in mrVISTA

Once the .Class and .Gray files are saved in their proper folder, the segmentation and meshes can be used within mrVISTA. In mrVISTA, open the Volume or Gray Window, and Install the Segmentation. After doing this, you can open the 3D window, and build the meshes.

Personal tools