Reputation: 1
I'm using ITK python wrapper (ITK not simpleITK) to prototype µCT output automated processing. I need to compute 3D object thickness map, but this feature doesn't exist as-is in ITK. The pipeline is simple:
My problem is that the itk::RegionalMaximaImageFilter
does not behave as expected (does not preserve branches). So I wanted to write a custom function that check if the central pixel is >= to its neigborhood with a 3x3x3 sliding kernel.
My idea is to take advantage of the optimized itk::RegionalMaximaImageFilter
iterator (see here). However, even if this works perfectly with C++, I can't manage to find a workaround with Python (without wrapping c code with cython).
Upvotes: 0
Views: 383
Reputation: 1431
" I wanted to write a custom function that check if the central pixel is >= to its neigborhood with a 3x3x3 sliding kernel."
This is related to gray-scale morphology's dilate which is the maximum of all the pixels in a neighborhood. In SimpleITK ( since you tagged the post ) you could simply write:
isMaximumImg = (sitk.GrayscaleDilateImageFilter(inImg, 1) == inImg)
This will result in an image where if the pixel is equal to the maximum in the neighborhood, then the output value is 1, otherwise it would be 0. This should also be able to be implemented with ITK Python by composing a similar pipeline of Filters.
Upvotes: 0