I am currently working on a custom module in 3D Slicer and would like to incorporate the functionality of the “Threshold” effect from the Segment Editor module.
My main goal is to allow users to:
Set threshold values (e.g., lower and upper bounds).
Preview the thresholded region in real-time on a specific image.
I’ve been trying to achieve this for some time now, but I haven’t been able to figure it out. I don’t need the full functionality of the Segment Editor, just these two features.
Could anyone guide me on how to accomplish this? Are there any Python examples or specific API calls I should look into?
Thank you for your response! It helped me a lot. Do you happen to have any modules that implement the Flood Filling effect and Keep Selected Island (from the Islands operation) that I could take inspiration from? It would be great to see how others have approached this topic.
For ‘Keep selected island’: no known reference. The module I linked in my previous post uses KEEP_LARGEST_ISLAND; if you use KEEP_SELECTED_ISLAND, it should do the trick.
But the ‘Flood filling’ effect already does that. Your goal is not very clear. If you don’t plan to use the ‘Segment editor’, you’ll have to rewrite much code, a lot of work to achieve robustness and efficiency.