ITK icon indicating copy to clipboard operation
ITK copied to clipboard

ITK Python and output of WatershedImageFilter

Open brad-t-moore opened this issue 3 years ago • 5 comments

Description

WatershedImageFilter produces an itk.ULL (IdentifierType) Image. CastImageFilter doesn't wrap itk.ULL.

https://github.com/InsightSoftwareConsortium/ITK/blob/f98f6a8920c2b8af175865458fade50439a81c3a/Modules/Segmentation/Watersheds/include/itkWatershedImageFilter.h

Expected behavior

The current Python example: https://itk.org/ITKExamples/src/Segmentation/Watersheds/SegmentWithWatershedImageFilter/Documentation.html

works by using ScalarToRGBColormapImageFilter which is wrapped for ULL.

Would like to be able to have either ULL supported/wrapped in CastImageFilter or modifying WaterShedImageFilter to take OutputImageType (with default IdentifierType) as a parameter. Thoughts?

Versions

itk-5.2.0.post2

If the commit number is required, run $ git rev-parse --short HEAD. -->

Environment

Python 3.7.6 Windows 10

brad-t-moore avatar May 24 '21 15:05 brad-t-moore

Watershed filter tends to produce a lot of segments. It is probably not enough to just add an output image template type which defaults to the current output type. If anyone takes up modifying it, they will have to ensure that segment count overflows don't crash the filter and are handled somehow.

Adding a type specification for ULL->UL (and maybe some other target types) should be relatively easy and straightforward.

dzenanz avatar May 24 '21 18:05 dzenanz

Sure, so just add a ULL to UL and ULL to double in the CastImageFilter wrapping?

brad-t-moore avatar May 25 '21 15:05 brad-t-moore

With dimensions 2,3,4 as that is what itk.Image is wrapped for (don't see any ULL in vector images).

brad-t-moore avatar May 25 '21 15:05 brad-t-moore

Yes, I think that will do it.

dzenanz avatar May 25 '21 18:05 dzenanz

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 11:04 stale[bot]