Load mesh with wavefront (obj) format

I use 3DSlicer to load a mesh, which was created from a volume with suffix .mhd.
The volume is loaded using ITK and the mesh is generated using vtk marchingcube by an in-house tool. The mesh is saved into wavefront format with suffix obj.

I have several questions:

  1. Is the mesh created in the LPS space no matter what AnatomicalOrientation is in the mhd file?
  2. As I load the mesh into 3DSlicer, is it rendered in the RAS space?

Thank a lot!


In recent Slicer versions, surface meshes are assumed to be in LPS coordinate system, unless you specify RAS coordinate system in the file header. See more information here: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide/Slicer#Slicer_5.0:_Models_are_saved_in_LPS_coordinate_system_by_default

Many thanks for your promptly reply.

For the mesh creation, I use ITK to load a .mhd file and then convert it to vtkImage and then use vtkMarchingcube to generate a mesh. Is the mesh created in the volume space determined by the offset and the transformMatrix (offset and transformMatrix are tags in .mhd file ) no matter what the AnatomicalOrientation is?

ITK follows current guidance on interpretation of mha files in that it ignores the AnatomicalOrientation field and assumes the image is defined in LPS coordinate system. Since current Slicer versions expect meshes to be in LPS coordinate system, there should be no need for conversion.

Note that you don’t need to use marching cubes in an external software. You can load the mha file directly into Slicer as a segmentation node (select “Segmentation” in Add data dialog in the description column). Mesh representation of the segmentation will be created automatically when needed, using methods that are better than simple marching cubes (flying edges filter followed by Taubin smoothing) - when you right-click on the segmentation and choose export to model, or click show 3D in Segment Editor.

What is the end goal of your project? What are the steps in your workflow that have not been completed yet?

Thanks Andras.
We are developing a specific surgery planning system with segmentation and mesh generation. Slicer has powerful edit functionality and we often use it to edit our segmentation results and visualize the mesh.
But sometimes the mesh and the segmentation volume do not align well in the 3D rendering window. Now I understand it is because the mesh might not be created in the LPS space.

Thanks a lot for your help!

Thanks for the information. In case you don’t know, Slicer is used as a basis of several surgical planning and real-time guidance systems (including commercial ones, with regulatory approval), with completely custom GUI layer (you would not recognize that the engine of the application is Slicer). Check out these links for some more details:

Yes, I know and also use them too.
Thank you so much for your help!

1 Like