Foreground Masking via command line

Hi all,
I would need an automatic way of running Foreground Masking via command line.

As far as I understood it is not a cli module, so I need to load the image and run the mask generation via a python script.
However, I didn’t find a way for accessing its logic.

Any suggestion?
Thanks a lot.


Hi Paolo -

Can you elaborate on what you mean by Foreground Masking ?


Hi Steve,
I mean this module:


Hmm, I don’t recall that one, perhaps we deprecated it. But it looks like you can do the same thing with the segment editor pretty easily.

1 Like

Thanks @pieper, I got it !

If volume geometries are matching then you can also do masking (or combine volumes with various functions) using standard numpy array operations. See this example in the script repository.

Hi @lassoan
thanks for answering.
I was interested in generating the mask, so I think I’ll give a try to something different to foreground masking.


Otsu (and about 6-8 other) automatic threshold computation methods are available in Threshold effect and morphological opening is available in Smoothing effect in Segment Editor. You can use these effects from Python as shown in examples in the script repository.

1 Like