# LabelImageGenericInterpolateImageFunction and BSplineInterpolateImageFunction

**URL:** https://discourse.itk.org/t/labelimagegenericinterpolateimagefunction-and-bsplineinterpolateimagefunction/2668
**Category:** Engineering
**Created:** [January 31, 2020, 3:52pm UTC](https://discourse.itk.org/t/labelimagegenericinterpolateimagefunction-and-bsplineinterpolateimagefunction/2668 "2020-01-31T15:52:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![DVigneault](https://discourse.itk.org/user_avatar/discourse.itk.org/dvigneault/32/189_2.png) [@DVigneault](https://discourse.itk.org/u/DVigneault)
#### Post date: [January 31, 2020, 3:52pm UTC](https://discourse.itk.org/t/labelimagegenericinterpolateimagefunction-and-bsplineinterpolateimagefunction/2668/1 "2020-01-31T15:52:37Z")

</div>

All–

I recently discovered an excellent [remote module](https://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator) 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 `Get`er 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,

–Davis

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [January 31, 2020, 4:03pm UTC](https://discourse.itk.org/t/labelimagegenericinterpolateimagefunction-and-bsplineinterpolateimagefunction/2668/2 "2020-01-31T16:03:24Z")

</div>

Adding a `GetModifiable*` sounds reasonable to me.

---

<div class="post-metadata">

### Author: ![DVigneault](https://discourse.itk.org/user_avatar/discourse.itk.org/dvigneault/32/189_2.png) [@DVigneault](https://discourse.itk.org/u/DVigneault)
#### Post date: [January 31, 2020, 6:14pm UTC](https://discourse.itk.org/t/labelimagegenericinterpolateimagefunction-and-bsplineinterpolateimagefunction/2668/3 "2020-01-31T18:14:13Z")

</div>

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:

> <https://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator/pull/19>
