.vtk export misalignment with CT scans

Hi! I have been using Slicer for a while but I am still unfamiliar with some issues.

When I export my CT scans as a .vtk file and reimport them into Slicer and compare them with my CT scans, they don’t align. This is a problem because when I use the .vtk files in Bonemat, they don’t align with the mesh file I generate.

I tried matching the images and was successful in orienting them. However, the slicer positioning in each axis was still off despite looking the same. I can keep editing these CT files, but I have dozens and it’s inconvenient to keep doing this. Is there a way to export .vtk files that match orientation in CT scans so I can use them in Bonemat without misalignment?

.vtk format doesn’t preserve the image orientation information. If you really need to use this format for compatibility you should be able to reconstruct a valid geometry manually or ideally use tools that are aware of orientations.

Do you have any recommendation for what tools I should use?

What are you trying to do?

Utilize Bonemat Batch Processing.

I require a .vtk file for the CT scans. But the .vtk file doesn’t align with the CT scans. I need the .vtk file to be axis-aligned to the CT scan, so my object (a bone) can utilize Bonemat that assigns material property to the bone based on the CT scan alignment.

I don’t know if anyone here uses Bonemat (I don’t) but probably it makes assumptions about the image data (identity orientation maybe?) so you can use Slicer to resample your image data until it matches. I see that Bonemat has a restrictive non-commercial license so I’m not interested in learning more about it, but if it’s just assigning scalars to vertices of a mesh you can easily so that with Slicer using either VTK or numpy operations.

Hi William,

I am using Bonemat and have similar issues. I am not exporting VTK files, but STL files derived from a segmentation in Slicer. For some of my DICOM series I see a missalignment in Bonemat between STL derived FE meshes and the DICOM series. This happens for DICOM series where the IJK to RAS Direction Matrix is not made up of solely zeros and ones.

I assume that bonemat does not read the orientation from the DICOM header but sets standard orientation. However I could not find anything in the documentation regarding this so I will dig into the code. Maybe this also helps you?

Best,
Daniel

This error has been reported a few times here on the forum. The problem is that DICOM image import in Bonemat is implemented poorly.

I would recommend not to use Bonemat but instead use the corresponding features in Slicer - see more details here:

1 Like

Hi Andras,

thank you, I will look into Slicers capability. I use Bonemat primarily because of its capability to map to Finite Element Meshes.

Best regards,
Daniel

Slicer can map CTs to volumetric meshes, too. You can also do all the other steps (proper DICOM image import, segmentation, create FE mesh, sample CT image at mesh point positions, etc.). The only thing that may need some work is to find out what FE mesh file formats Slicer can export, what FE mesh formats your solver can load, and if there is no common format between them then use a converter or a different exporter in Slicer.

1 Like