Extract sub-segment from segmentation based on seed and volume (in Python)

Hi everyone,

I’m currently having a segmented image, but now I want to create a new (sub-)segmentation from the segmented image based on an initial seed point (x,y,z) and with a given volume threshold, e.g. max 20 cc. I want to implement it in Python.
Has anyone ever done this or any idea what the easiest way is to do this?
Thanks in advance!

Kylie

This is exactly what Fast Marching segment editor effect does. It is provided by SegmentEditorExtraEffects extension.

I don’t think that this is effect can take into account masking during the region growing operation. But you can blank out the volume (set it to a very different intensity) outside the mask before applying Fast Marching.

Thank you for the fast reply! I’ll look into it :grinning_face_with_smiling_eyes:

1 Like

So I’m currently still struggling with it. The situation is that I already have a segmentation result, so I should set the output data of the vtkPichonFastMarching() either with setOutData() or SetOutput(), right? And add the seed point with either addSeed() or addSeedIJK()? So I can then perform the fm.show() operation with the given fraction? Or is there still additional information that I need to provide for the vtkPichonFastMarching?

Thanks in advance!

I would recommend to first just use the GUI. Once you confirmed that everything works as expected you can start Python scripting to automate everything.

1 Like