Python script example using DistanceTransformWatershed3D

Hi guys,

can anyone provide me an example of a python script using MorphoLibJ DistanceTransformWatershed3D() method?

From the doc it looks to me as if this has only the run method. So something like

from inra.ijpb.plugins import DistanceTransformWatershed3D

DistanceTransformWatershed3D().run(imp, "...........")

or how is this used?

Thanks,

Sebi

It’s true the Javadoc doesn’t help a lot in this case. You have to look at the source code (e.g. by using the Source button in Fiji’s search bar results) to discover that the plugin is essentially a small list of calls into the API of the actual library:

Hope that helps :slight_smile:

1 Like

Hi,

I think i figured it out using your hints.

...
weights = ChamferWeights3D.BORGEFORS.getFloatWeights()
normalize = True
dynamic = 2
connectivity = 26
dist = BinaryImages.distanceMap( imp.getImageStack(), weights, normalize)
Images3D.invert(dist)
imp = ExtendedMinimaWatershed.extendedMinimaWatershed(dist, imp.getImageStack(), dynamic, connectivity, 32, False ) 
...

And this seems to work. Thanks.

Sebi

1 Like