LabelImageGenericInterpolateImageFunction and BSplineInterpolateImageFunction


I recently discovered an excellent remote module which separately interpolates each label in a segmentation image generically over a templated interpolator, and then takes the maximum value for the output. I’ve tried it for linear and bspline interpolation (with the default spline order) and it works great! I’m now wondering about using it with bspline interpolation for a non-default spline order. Since the spline order is set on the interpolator instance, rather than as a template argument, I don’t see an obvious way to do this with the current API. I think we could get around this issue by providing a Geter to m_InternalInterpolators, so the user could set the spline order manually on the internal instances, but I’m not sure if this is the best way to approach it. Happy to supply a patch if this sounds like a good idea, and apologies if I’ve missed something obvious!

Best, and thanks in advance,


Adding a GetModifiable* sounds reasonable to me.

1 Like

Gave it a shot, but it ended up being more complicated than I’d anticipated, since the internal interpolator vector isn’t allocated until the input image is set (which occurs inside ResampleImageFilter). In the end, it was easier to leave the class alone and instead override the constructor of BSplineInterpolateImageFilter to change the default value. I added a test demonstrating the idea:

1 Like