[Insight-developers] strange results with python wrapper

Brad King brad.king at kitware.com
Fri May 20 15:56:01 EDT 2005


Gaetan Lehmann wrote:
> python WhiteTopHatFilter2.py MedianImageFilter.png
> modules loaded
> 2 238
> 2 230
> 2 230
> 0 65535

Okay, this is quite simple.  Once I copied your script from that machine 
the problem occurred on my machine too.  Here is the reason:

# Python:
kernel = itkBinaryBallStructuringElementUS2()
radius = kernel.GetRadius()
radius.Fill(3)
kernel.SetRadius(radius)

// C++:
StructEltType ball;
ball.SetRadius(3);
ball.CreateStructuringElement();

The python version does not call CreateStructuringElement, so the 
erosion and dilation run with different settings in Python than in C++.

I've created a feature request to have this mistake diagnosed at runtime 
by ITK:

http://www.itk.org/Bug/bug.php?op=show&bugid=1877&pos=0

-Brad


More information about the Insight-developers mailing list