wasserth / TotalSegmentator

Tool for robust segmentation of >100 important anatomical structures in CT and MR images
Apache License 2.0
1.56k stars 257 forks source link

Segmentations getting arbitrary cutoffs #220

Closed EvelKylenievel closed 10 months ago

EvelKylenievel commented 1 year ago

Hello, I am using TotalSeg 2.0.5 and getting consistent issues with flat edges for some pieces of anatomy. My aortas and some of my lungs are getting a clean cut as if a much too small bounding box gets placed on the CT image before segmentation begins. As you can see in the 3rd of the images I am uploading, the CT image contains the full anatomy but it fails to segment correctly.

I am running it as follows: TotalSegmentator -i input -o output --roi_subset lung_lower_lobe_left lung_lower_lobe_right TotalSegmentator -i input -o output -ta heartchambers_highres

Thank you for your help!

-Lung Segmentation with flat face (not a great lung seg in general)- gray_lung_cutoff

-Aorta seg standalone- aorta

-Aorta seg with source CT- aorta_and_ct

StefanFischer commented 1 year ago

Same issue here :) Thank you for the nice work on the totalsegmentator, it is a great tool!

StefanFischer commented 1 year ago

Actually this issue does not occur in totalsegmentator v1 for the same CT input volumes

wasserth commented 1 year ago

When you use the option --roi_subset or a subtask (-ta) which focuses on one body region, then a fast low resolution model is run first to crop the image to the region of interest and then the actual model is run. Probably this fast low resolution model failed. Does it work well without --roi_subset? Can you share the dataset which me so I can try to reproduce it and maybe find out why the fast low resolution model fails?

StefanFischer commented 1 year ago

grafik this is the segmentation failure of the aorta. the segmentation was run with "-ta total". i send you the regarding volume via email. failure of the aorta is in our dataset at around 80%

EvelKylenievel commented 1 year ago

Thanks for adding your data Stefan, I am unable to share my dataset but I can confirm this issue persists with '-ta total' and is not a problem in TotalSegmentator1

wasserth commented 1 year ago

I figured out the problem with the data from Stefan: He was running first -ta total and then -ta heartchambers_highres. heartchambers_highres will crop to only the heart region and also segment the aorta. This highres cropped aorta segmentation then overwrites the file with the same name from -ta total if you chose the same output folder. The reason why the lung segmentation is also cropped is not really clear to me.

EvelKylenievel commented 1 year ago

Thank you for the help Jakob! And for maintaining this great tool. I am getting around this issue by running --roi_subset aorta after heartchambers_highres. The lung segmentation issue persists but it's not nearly as important for now.

EvelKylenievel commented 11 months ago

StefanFischer

failure of the aorta is in our dataset at around 80%

I've found the aorta seg failures that aren't due to a bounding box error are because of patient orientations that do no match with the scan direction metadata. For example a prone patient with an orientation indicating they are on their back will fail. Changing the image orientation with .SetDirection() has solved the issue for me.