fedesemeraro / SlicerTomoSAM

An extension of 3D Slicer using the Segment Anything Model (SAM) to aid the segmentation of 3D data from tomography or other imaging techniques.
Other
55 stars 9 forks source link

TomoSAM, threshold masking, and editable area #21

Open FossilTurtles opened 2 weeks ago

FossilTurtles commented 2 weeks ago

Hi there,

Congrats and thank you for your great work with TomoSAM! I am testing it to see if it can help speed up segmentation of fossil vertebrates. When segmenting bone material, we would generally like to keep the internal bone structure in order to, for example, separately segment a canal or study bone compactness. Threshold masking usually does a good job, allowing us to select only the material of interest (here bone) and not the cavities inside. Here is an example:

Capture d’écran 2024-09-18 à 10 16 18

When I select my object by prompting a point in TomoSAM, the resulting mask includes the internal cavity, despite threshold masking being activated in the Segment Editor module:

Capture d’écran 2024-09-18 à 10 17 42

Excluding point does not work well:

Capture d’écran 2024-09-18 à 10 18 34

Now I understand SAM works differently, but would there be a way of making TomoSAM take into account threshold masking?

A second related issue concerns the editable area. When set to "Outside all segments" in the Segment Editor module, any selection with a segmentation tool will not overlap with previously segmented parts. TomoSAM does not take this into account either.

Both of these features (threshold masking and editable area) are much used in the field of morphology. Including them in TomoSAM could really make this extension extremely useful for morphologists.

Thanks, Jérémy.

pieper commented 2 weeks ago

@FossilTurtles I agree with your suggestion that TomoSAM should behave like other editor effects in terms of masking and threshold rules.

One suggestion as a workaround is to first make the whole-bone mask using TomoSAM and then do a threshold within the segments to make new segments of the internal structures.

FossilTurtles commented 2 weeks ago

@pieper Yep, good point, this workaround does work. Thanks.

But it will be a time saver if TomoSAM somehow took threshold and masking into consideration natively.