wasserth / TotalSegmentator

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

error when using roi_subset #314

Closed mingtian126 closed 3 months ago

mingtian126 commented 3 months ago

I try to segment lungs using the following: totalsegmentator(input_path, output_path,preview=False,roi_subset=['lung_upper_left' , 'lung_upper_right', 'lung_lower_left' 'lung_lower_right' , 'lung_middle_right']) It worked beautifully couple of months ago, but now I got the following message on my linux system: crop_mask[organ_seg_data == class_map_inv[roi]] = 1


KeyError: 'lung_upper_left'
Tried using task="lung_vessels", it works. But I'd like to have lungs as well, don't know how to use task instead of roi_subset.
I tested the same thing on window system (a virtual machine), it works as before.
I reinstalled the totalsegmentator on my linux, still same.
Thank you!
mingtian126 commented 3 months ago

Found the problem, the new version changed the name to lung_upper_lobe_left etc.

mingtian126 commented 3 months ago

subset name changed!

hari3100 commented 1 month ago

Hi, I suppose I'm trying to do something similar , i want to create a python code using this model, that can create segmentations only for a specific organ, like in your case lungs , i want for liver. It would really great if you can guide me on how i can do that , Im not understanding how and where to use this roi_subset. Or maybe you have created a python code already you can share that , i will teach myself. Thank you.

mingtian126 commented 1 month ago

Here's the python code for segmenting selected organ(s): totalsegmentator(inPath, outPath,preview=False, roi_subset=['liver','gallbladder', 'kidney_left','kidney_right', 'pancreas','spleen','stomach']) Hope this helps.