3D Spinal Cord Mesh from Segmented and Labelled Images

63 views
Skip to first unread message

Mohammed Hamza

unread,
Mar 24, 2020, 10:05:33 AM3/24/20
to iso2mesh-users
Hello,

I am trying to use iso2mesh to develop a 3d mesh of a segmented and labelled MRI of the spinal cord that I have. The MRI data is in the format of .nii.gz. I'm pretty new at using iso2mesh and haven't found anything related to spinal cord segmentation in this group and hoping to get some guidance on how to go on about achieving my goal. Below is the display of the MRI with spinal cord segmented and labelled.

Any help is appreciated. Thank you!

screenshot.png

spine_labelled_colored.png



Qianqian Fang

unread,
Mar 25, 2020, 12:31:17 AM3/25/20
to iso2mes...@googlegroups.com, Mohammed Hamza
On 3/24/20 2:22 AM, Mohammed Hamza wrote:
Hello,

I am trying to use iso2mesh to develop a 3d mesh of a segmented and labelled MRI of the spinal cord that I have. The MRI data is in the format of .nii.gz. I'm pretty new at using iso2mesh and haven't found anything related to spinal cord segmentation in this group and hoping to get some guidance on how to go on about achieving my goal. Below is the display of the MRI with spinal cord segmented and labelled.


hi Mohammed,

have you tried calling v2m for your data? if you dwnload the latest version of iso2mesh from github, you can load your data using loadnifti.m, and then get a mesh using v2m, something like

data=loadnifti('myfile.nii.gz');
[node,elem]=v2m(uint8(data),[],20,300,'cgalmesh');
plotmesh(node,elem);


Qianqian



Any help is appreciated. Thank you!





--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iso2mesh-users/d5c16cbb-4286-4802-8e64-ee6323d71fe1%40googlegroups.com.

Mohammed Hamza

unread,
Mar 26, 2020, 12:35:40 AM3/26/20
to Qianqian Fang, iso2mes...@googlegroups.com
Hello Qianqian,

Thank you for your response. I have read in the data using matlab's readnifti() function. I'm still getting an error when running the v2m() function. 

In the vol2surf(), I'm getting an out of bounds array message. Below is the code snippet I'm running and the variables I'm working with. For this snippet, I actually ended up using the loadnifti() to read in my image but because this returns a struct, I had to retrieve the matrix from it. 

Also I had to use 'cgalsurf' method because my image is a gray-scale image.
image.png


Qianqian Fang

unread,
Mar 26, 2020, 9:25:27 AM3/26/20
to iso2mes...@googlegroups.com, Mohammed Hamza

hi Mohammed

to use the cgalsurf option, you must give a non-empty level input (i.e. the 2nd input) in v2m, and preferably a single value. it won't work if the level is [].

just a side note - iso2mesh is not a segmentation tool, you are supposed to segment your data first before calling v2m to create meshes.

Qianqian

Mohammed Hamza

unread,
Apr 9, 2020, 7:55:02 AM4/9/20
to Qianqian Fang, iso2mes...@googlegroups.com
Hello Qianqian,

I did my segmentation with a library called SCT (spinal cord toolbox). But the segmentation isn't done on the original MRI, instead the segmentation and its labels are stored separately and overlayed on each when displaying.

How would I go on about extracting the segmented parts of my mesh with this setup? Or would I need the segmentation done on the original MRI.

Thanks,
Mohammed

Qianqian Fang

unread,
Apr 18, 2020, 11:13:04 AM4/18/20
to Mohammed Hamza, iso2mes...@googlegroups.com
On 4/9/20 7:54 AM, Mohammed Hamza wrote:
Hello Qianqian,

I did my segmentation with a library called SCT (spinal cord toolbox). But the segmentation isn't done on the original MRI, instead the segmentation and its labels are stored separately and overlayed on each when displaying.

How would I go on about extracting the segmented parts of my mesh with this setup? Or would I need the segmentation done on the original MRI.


if you call v2m using the 'cgalmesh' option, the output element labels are supposed to match the voxel labels in the input.

checkout this sample code

https://github.com/fangq/iso2mesh/blob/master/sample/demo_label_sizing.m#L28

in this case, the input domain has 4 labels, to extract the elements of the first label, you simply use the last column of the el matrix to select. for example

plotmesh(no(:,1:3),el(el(:,end)==1,:));

gives you the region of the first label, and so on.

Qianqian

Reply all
Reply to author
Forward
0 new messages