TotalSegmentator
TotalSegmentator copied to clipboard
Segmentation mask is flipped
... Another strange problem is that in ITK-Snap, when I first load the ct image and then add the result as segmentation, the direction will be reversed. It was correct when I chose to add as additional. I'm not sure where is the problem.
Originally posted by @ZZZsn in https://github.com/wasserth/TotalSegmentator/issues/18#issuecomment-1250803493
I encountered the same problem, so I thought it may deserve its own issue. As an input data, I have an abdominal ct scan from the Learn2Reg challenge. When I open it in ITKSnap I get the following meta data with dimensions (x: 384, y: 320, z: 512): Voxel Spacing (x: 1, y: 1, z: 1), Origin (x: 0, y: -318, z: 0), Orientation Code: RAI When I open one of the segmentation masks, however, I get: Voxel Spacing (x: 1, y: 0.9984, z: 0.999), Origin (x: 383, y: 1, z: 0), Orientation Code: RAI
As @ZZZsn mentioned: When I load the segmentation as an additional image, it fits perfectly. When I load it as a segmentation, it is flipped. So how comes that the spacing, but most of all the origin, is altered from the original ct scan?
Good questions. Can you send me the image so I can try to reproduce the issue?
I have encountered this problem before, but I haven't encountered it since I updated the new version. I hope this solution will help you find the reason.
I changed the code so now all header fields from the input are copied to the output file. Can you try it again with the latest master?
That works fine, thanks a lot. Though, I had to downgrade to python 3.9 because of the following error when trying to install TotalSegmentator with python 3.10
ERROR: Could not find a version that satisfies the requirement SimpleITK==2.0.2 (from totalsegmentator) (from versions: 1.0.1, 1.2.0, 2.1.0, 2.1.1.1, 2.1.1.2, 2.2.0) ERROR: No matching distribution found for SimpleITK==2.0.2
fyi. I had no issues loading to itksnap.
--
single nifti can be generated using wasserth's convenience method from totalsegmentator.libs import combine_masks_to_multilabel_file
Output organs from TotalSegmentator looks amazing (testing on my hospital's wb pet/ct protocol).
color lut file available here. https://github.com/pangyuteng/totalsegmentator-and-friends/blob/main/assess/docker-with-weights/itksnap.label