[Insight-developers] Default boundary condition for WindowedSinc as constant?
Bradley Lowekamp
blowekamp at mail.nih.gov
Tue Dec 18 13:09:23 EST 2012
Hello,
As I am finally integrating the different interpolators into SimpleITK. I am giving them a close look over.
The set of WindowSincInterpolateImageFunctions takes a Boundary condition template parameter. This defaults to ConstantBoundaryCondition. That is by default the pixels are zero outside the image, and they are not zero flux. This results in quite a bit of ringing and fading around my test images. It seems just wrong.
I can easily specify this parameter as the ZeroFluxNeumannBoundaryCondition (I don't think we have a mirror/reflective boundary, which is another possibility), and things look quite good and as I expect the output to be. I was curious as to what others were doing so I perused BRAINS and ANTS, grepping for the sinc interpolator. And to my surprise they are using the default!
Is there a reason that this default is preferred? Or is it that I am not processing a single blob in the center of a black image (aka a brain)?
Also in terms of consistency across the interpolators, this is the only one which takes a boundary condition template parameters. The other interpolators appear to behave sensibly, and exhibit a zero-flux type boundary condition. I think the default for this may need to be changed.
I have this little example I have been working on in SimpleITK with the famed cthead1.png data input. Here is a code snippet:
image = image[(size[0]//2-25):(size[0]//2+25),(size[1]//2-25):(size[1]//2+25)]
iterps = [sitk.sitkNearestNeighbor,
sitk.sitkLinear,
sitk.sitkBSpline,
sitk.sitkGaussian,
sitk.sitkHammingWindowedSinc,
sitk.sitkCosineWindowedSinc,
sitk.sitkWelchWindowedSinc,
sitk.sitkLanczosWindowedSinc,
sitk.sitkBlackmanWindowedSinc]
eFactor=5
image_list = []
for i in iterps:
image_list.append( sitk.Expand( image, [eFactor]*3, i ))
tiles = sitk.Tile( image_list, [3,0] )
And the following is the output with the different boundary conditions:
http://erie.nlm.nih.gov/~blowek1/images/expand_interp_cbc.png
http://erie.nlm.nih.gov/~blowek1/images/expand_interp_zfbc.png
Thanks for you feedback,
Brad
More information about the Insight-developers
mailing list