-
Notifications
You must be signed in to change notification settings - Fork 6
Create 3D surfaces using Mango
Mango (http://ric.uthscsa.edu/mango/) is a useful tool for creating 3D surfaces from label files. This can be helpful in displaying the spatial organization of a label/region of interest, especially in comparison to a slice view. To do this, you will need to convert your label to a nifti file, create a separate file for each label value, then create a surface for each of these files using mango. Instructions and examples are below.
In the instructions below, left-hc.mnc is the original label file. It has 4 values (1, 2, 3, 4).
- Convert .mnc to .nii Fix the range of the .mnc file, this ensures label values don’t get distorted in the conversion. Without this, you could have label 1 end up with a value of 1.005 for example. The following mincreshape command does this:
module load minc-toolkit
mincreshape -normalize -unsigned -byte -image_range 0 255 -valid_range 0 255 left-hc.mnc left-hc_fix.mnc
Convert to .nii, zip the file
mnc2nii left-hc_fix.mnc left-hc_fix.nii
gzip left-hc_fix.nii
- Separate the file such that you have one file for each label value (4 total files in this example). You can use the fslmaths command to do this as follows:
module unload minc-toolkit
module load FSL
fslmaths left-hc_fix.nii.gz -thr 1 -uthr 1 left-hc_fix_1.nii.gz
fslmaths left-hc_fix.nii.gz -thr 2 -uthr 2 left-hc_fix_2.nii.gz
fslmaths left-hc_fix.nii.gz -thr 3 -uthr 3 left-hc_fix_3.nii.gz
fslmaths left-hc_fix.nii.gz -thr 4 -uthr 4 left-hc_fix_4.nii.gz
Use fsleyes to view each of the created files above to ensure they are as expected:
fsleyes left-hc_fix_1.nii.gz
- Use mango to create a surface for each of the separate label files. You can open mango from the command line by running the command
mango
module load mango
mango
- Open the first of your label files using the Open tab:
- Under the Image tab, select build surface:
Click ok, and mango will build a surface. This may take up to a minute. After the surface is complete, a new window will pop up displaying the newly created surface.
- In the surface window, use the File tab to export the surface as a .vtk file:
- After exporting, close the image window. Then repeat steps 4-6 for each label value. After creating a surface for your final label, build the surface and export to a .vtk file. Instead of closing the surface and image windows, load in the other surfaces you created using the Shapes -> load from file tab:
You should then be able to view all of your newly created surfaces together.
- For visualization purposes, you can change the colour of each surface by using the 'Material' option: