Reading the .obj (+.mtl) brain atlas and exporting as .nii


I decided to use a Slicer in order to make a brain atlas conversion.
I exported a brain atlas which includes different brain areas with Neurolucida as .obj + .mtl file.
I need to convert that atlas into nifti (.nii) format in order to read it with an MRI imaging called NORA.
Could you please help me how to do it?
What I tried is:

  1. importing .obj as a model
  2. importing .mtl as a volume
    Problem: I do not see different brain areas, the whole brain is gray
    Problem: I do not see a .nii format when I click the export button.

Hope somebody could navigate me through the exporting process.
Wish you all the best,

Is each brain area stored with a different material? Can you share a sample data set?

Currently, a single obj file is always loaded as a single segment, so you would need to split it into separate mesh files before you export it or write a short Python script in Slicer that splits the mesh based on material ID.

Dear Andras,

Thank you for the answer! I saved the whole model as a single .obj accompanied with a single material. I will follow your advice on saving each segment separately! Thanks for the explanation.


Hello Andras,

Thank you for the previous answer. I have followed your recommendation and have uploaded two brain regions as separated .obj files.

I visualized them as a solid and as a mesh

I need to convert both objects into the volume.
I cannot save it as a nifti (.nii) if I do not convert it to a volume.

Could you please advice me on how to make a conversion from a current model to a volume?

Thanks again for your help Andras!
You are the best.

The most robust way to convert a mesh to an image is to import it into segmentation and export it to a labelmap image. You can find these conversion options in data module if you right-click the data node.

Dear Andras,
I got it!

I exported each segment as separated nifti, however I lost parameters of orientation and size in the nifti header.
I believe I lost the parameters while importing the .obj into Slicer. Obj file is accompanied with .mtl, but I could not import the .mtl into as a scalar overlay.

Could you please help me to re-define the size and orientation?

Best regards,

Physical size and orientation of the labelmaps are correct. Probably you only checked the voxel coordinates. If you want the labelmap in a specific physical geometry (origin, spacing, axis directions, extents) then export using Segmentations module and specify a reference volume.

I found where the problem was - the exported property of Image Spacing was defined in wrong units thus it was read as 2.4 instead of 0.024 in a slicer (Model was exported with Neurolucida in case other user finds the same obstacle).

Finally my histology image (image I worked with in Slicer) was the same size as the MRI image.
Now I ran into another trouble - my histology image has more z slices than the MRI so I cannot superimpose them. Is there a way to down-sample the z direction of the nii image in Slicer?

Thank you much for your help Andras!

Superimposing histology and MRI in Slicer should be no problem, regardless of the size or resolution of the images, as both images are displayed in the physical coordinate system. Do you mean that you would like to superimpose the images in some third-party software that ignores physical coordinate system information?

Dear Andras,

Thank you for your help again!
Yes, I used a third party software for alignment after exporting the model from Slicer. The problem is in the third-party software I used. I tried the same in slicer and it worked perfectly. Thank you for leading me through the process. I am very grateful.

Wish you a wonderful day,