From 10c19c7db15ed2f91c78ee778eebc1e78b2ac8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 7 May 2024 08:47:29 -0400 Subject: [PATCH] ENH: Support nearest neighbor interpolator for montaging label maps Co-authored-by: Matt McCormick --- wrapping/itkTileMergeImageFilter.wrap | 27 ++++++++++++++++++--------- wrapping/itkTileMontage.wrap | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/wrapping/itkTileMergeImageFilter.wrap b/wrapping/itkTileMergeImageFilter.wrap index 3c0d3783..e408cb62 100644 --- a/wrapping/itkTileMergeImageFilter.wrap +++ b/wrapping/itkTileMergeImageFilter.wrap @@ -1,13 +1,22 @@ +itk_wrap_include("itkLinearInterpolateImageFunction.h") +itk_wrap_include("itkNearestNeighborInterpolateImageFunction.h") itk_wrap_class("itk::TileMergeImageFilter" POINTER) - foreach(d ${ITK_WRAP_IMAGE_DIMS}) - foreach(t ${WRAP_ITK_SCALAR}) - itk_wrap_template("${ITKM_I${t}${d}}" "${ITKT_I${t}${d}}, double") - endforeach() - foreach(t ${WRAP_ITK_RGB}) - itk_wrap_template("${ITKM_I${t}${d}}" "${ITKT_I${t}${d}}, itk::RGBPixel") - endforeach() - foreach(t ${WRAP_ITK_RGBA}) - itk_wrap_template("${ITKM_I${t}${d}}" "${ITKT_I${t}${d}}, itk::RGBAPixel") + foreach(iif LinearInterpolateImageFunction NearestNeighborInterpolateImageFunction) + if (${iif} STREQUAL "LinearInterpolateImageFunction") + set(abbr "L") # abbreviation to use in Python wrapping type name + else() + set(abbr "NN") + endif() + foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_SCALAR}) + itk_wrap_template("${ITKM_I${t}${d}}${abbr}" "${ITKT_I${t}${d}}, double, itk::${iif}<${ITKT_I${t}${d}}>") + endforeach() + foreach(t ${WRAP_ITK_RGB}) + itk_wrap_template("${ITKM_I${t}${d}}${abbr}" "${ITKT_I${t}${d}}, itk::RGBPixel, itk::${iif}<${ITKT_I${t}${d}}>") + endforeach() + foreach(t ${WRAP_ITK_RGBA}) + itk_wrap_template("${ITKM_I${t}${d}}${abbr}" "${ITKT_I${t}${d}}, itk::RGBAPixel, itk::${iif}<${ITKT_I${t}${d}}>") + endforeach() endforeach() endforeach() itk_end_wrap_class() diff --git a/wrapping/itkTileMontage.wrap b/wrapping/itkTileMontage.wrap index bc67b141..e0c8f32a 100644 --- a/wrapping/itkTileMontage.wrap +++ b/wrapping/itkTileMontage.wrap @@ -2,6 +2,7 @@ itk_wrap_class("itk::TileMontage" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_SCALAR}) itk_wrap_template("${ITKM_I${t}${d}}${ITKM_F}" "${ITKT_I${t}${d}},${ITKT_F}") + itk_wrap_template("${ITKM_I${t}${d}}${ITKM_D}" "${ITKT_I${t}${d}},${ITKT_D}") endforeach() endforeach() itk_end_wrap_class()