simnibs / simnibs

Simulation of Non-Invasive Brain Stimulation
http://www.simnibs.org
GNU General Public License v3.0
116 stars 37 forks source link

Head recostruction with headreco #8

Closed tmedani closed 4 years ago

tmedani commented 5 years ago

Dear SimNibs developers,

First of all, thank you for this wonderful package. This is not really an issue but a question about the parameters of headreco and the output mesh.

I'm a new user of your tool and I'm playing with it with different MRI in order to understand how it works and see the outputs.

I have here two examples : The ICBM152 from an open-source MRI I got these results image

An anonymous T1 MRI : image

My questions are :
Q1: Why in the first example I got only the top part of the head and in the second one, I got the whole head. (in both case the MRI is complete, the whole head).

Q2: The obtained volume mesh (the msh file), is it free from edge/elements intersection?

Q3: Is there any other output files to check about the mesh statistic? (tissue thickness ? )

Q4: I understand that with the option -v we can control the mesh resolution, before the segmentation, how about after the segmentation? Is there any way to re-mesh the final model without restarting the segmentation?

Q5: Could you please tell me how to add the option -v to this example (1mm2) : headreco all ernie org/ernie_T1.nii.gz ==> headreco all -v 1 ernie org/ernie_T1.nii.gz ?

Q6: How to use the arg volumemesh and surfacemesh ? and which functions/softs are called to mesh in the background).

Q7: The last question, is there a way to specify which tissu to include on the segmentation? for example, I want only the GM, Skull and Scalp. is there any arguments to tune somewhere?

I will really appreciate your help and also any recommendation for other documentation related to this toolbox.

Thanks in advance for your responses.

Best regards Takfarinas

guilhermebs commented 5 years ago

Dear Takfarinas

Thanks for the interest in SimNIBS.

Q1: How was the first model generated? "mri2mesh" models are cut-off, and "headreco" models include the neck.

Q2: Yes, it is a valid triangulation (contrained Delunay)

Q3: You can visually check the mesh with headreco check (runs bettern in a computer with freeview installed). Tissue thickness is not calculated.

Q4: You can run the different steps of the "headreco" separatelly after the segmentation to re-do the mesh

headreco preparecat
headreco surfacemesh
headreco volumemesh

Please use the -h switch to get help

Q5: That us right

Q6: Please use the -h help switch (example headreco preparecat -h) . We use a marching cubes algorithm to create the surfaces, meshfix to clean the surfaces and decouple them, and gmsh to build the volumetric mesh

Q7: No, but it is easy to load the mesh in matlab or python and relabel or remove tissues afterwards.

You can read more about head meshing here: https://simnibs.github.io/simnibs/build/html/tutorial/head_meshing.html

Best, Guilherme

tmedani commented 5 years ago

Dear Guilherme,

Thank you for all this precious information.

For Q1: I have used the headreco, I have a windows machine. This is really strange, I will check the MRI Thanks again for the other questions.

Another question at this level, I'm trying to display the mesh and the MRI in the same figure, however, the scalings are not the same. Is there a way to get the factor and the translation/rotation between the MRI data and the final mesh? Any recommendations?

Thanks again and have a nice day. Kind regards Takfarinas

guilhermebs commented 5 years ago

The MRI has two types of coordinates: the voxel coordinates and world coordinates. The headreco mesh uses, by default, the same coordinate system as the mri image world coordinates. The image in it's "raw" form is in the voxel coordinate system, and can be transformation to the world coordinate system using the affine transformation matrix which is defined in the header of the nifti file.

All the nifti viewers I know of show the mesh in the world coordinate system (or in both systems), but my guess is that there could be some odd viewers that does not do that. Which tool are you using for plotting?

About the head that is cut off, I guess we need to take a look at the data. if the field of view is not large enough, the mesh might not include the neck.

tmedani commented 5 years ago

The MRI has two types of coordinates: the voxel coordinates and world coordinates. The headreco mesh uses, by default, the same coordinate system as the mri image world coordinates. The image in it's "raw" form is in the voxel coordinate system and can be transformation to the world coordinate system using the affine transformation matrix which is defined in the header of the nifti file.

Thank you for this information.

All the nifti viewers I know of show the mesh in the world coordinate system (or in both systems), but my guess is that there could be some odd viewers that does not do that. Which tool are you using for plotting?

Basic Matlab scripting and opensource toolbox as iso2mesh, here an example : image

I would like to do a similar display with the headreco output.

About the head that is cut off, I guess we need to take a look at the data. if the field of view is not large enough, the mesh might not include the neck.

I checked the MRI, indeed, the ICBM MRI that I used with headreco includes only the top part of the head. image Sorry about that and thank you.

Another question, maybe not directly related to this issue, is there any way to separate the cerebellum from the cortex without manual intervention?

Thanks again for this wonderful tool.

Kind regards Takfarinas

vfonov commented 5 years ago

You should use CAT12 directly, if you need cortical thickness.

guilhermebs commented 5 years ago
 Basic Matlab scripting and opensource toolbox as iso2mesh,

iso2mesh uses the voxel coordinate system that is why the meshes are rotated differently.

@oulap can maybe give you some more info about the cerebellum and if it is possible to segment it out from the mesh

oulap commented 5 years ago

CAT12 outputs a binary cerebellum mask, which you can find in:

m2m_/templates/cattemplate_cerebellum_hammers.nii.gz

That could be used to relabel the mesh to include the cerebellum.

@guilhermebs is the relabeling script in the git? Don't know how pretty the result will be, but it should be easy to try at least.

guilhermebs commented 4 years ago

Yes, the relabeling command line thing is already here. But it is still undocumented in the website.

Using this script you can use the mask to re-labels parts of the mesh and obtain a coarse segmentation of the cerebellum. You can just update SimNIBS and SimNIBS and type maskmesh -h for help.