[ITK] Python wrapper for first order ITKTextureFeatures

Matt McCormick matt.mccormick at kitware.com
Tue Sep 19 10:18:04 EDT 2017


Hi Yannick,

The FirstOrderTextureFeaturesImageFilter only has three template parameters:

https://github.com/InsightSoftwareConsortium/ITKTextureFeatures/blob/c1039d5ab834d8dba77ae4b9a3cc96a60788686b/include/itkFirstOrderTextureFeaturesImageFilter.h#L51

So the wrapping should be:

itk_wrap_class("itk::FirstOrderTextureFeaturesImageFilter" POINTER)
  foreach(d ${ITK_WRAP_IMAGE_DIMS})
    foreach(t ${WRAP_ITK_INT})
      itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}${ITKM_SE${d}}"
                      "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}},
${ITKT_SE${d}}")
  endforeach()
endforeach()
itk_end_wrap_class()


And the relationship with the MovingImageHistogramImageFilter is here:

 https://github.com/InsightSoftwareConsortium/ITKTextureFeatures/blob/c1039d5ab834d8dba77ae4b9a3cc96a60788686b/include/itkFirstOrderTextureFeaturesImageFilter.h#L53-L57

The fourth template parameter for MovingImageHistogramImageFilter is:

                                       typename
Function::FirstOrderTextureHistogram< typename TInputImage::PixelType,

   typename TOutputImage::PixelType > >

TInputImage::PixelType for a scalar Image is just the scalar (which
you have). TOutputImage::PixelType for a VectorImage is a
VariableLengthVector, which has a CMake variable defined to be

Mangling

    ITKM_VLV${ITKM_${type}}${dim}

C++ Type

   ITKT_VLV${ITKM_${type}}${dim}

as listed here:

  https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x48-1540009.5


I hope this explanation is helpful.

Matt

On Mon, Sep 18, 2017 at 6:03 PM,  <yannick.suter at istb.unibe.ch> wrote:
> Hi Matt,
>
> Thanks!
> I made the changes and am now using the VectorImag type in the MovingHistogramImageFilter part in the .wrap file, but still get the exact same error:
>
> Nothing known about base class 'itk::MovingHistogramImageFilter< itk::Image< short,2 >,itk::VectorImage< float,2 >,itk::FlatStructuringElement< 2 >,itk::Function::FirstOrderTextureHistogram< short,itk::VariableLengthVector< float > > >'. Ignored.
> /ITK/ITK/bin/Wrapping/Typedefs/itkFirstOrderTextureFeaturesImageFilter.i:99: Warning 401: Maybe you forgot to instantiate 'itk::MovingHistogramImageFilter< itk::Image< short,2 >,itk::VectorImage< float,2 >,itk::FlatStructuringElement< 2 >,itk::Function::FirstOrderTextureHistogram< short,itk::VariableLengthVector< float > > >' using %template
>
> What I find odd is that the error message states using a "VariableLengthVector<float> (itk::Function::FirstOrderTextureHistogram< short,itk::VariableLengthVector< float > > >' ), but my line is itk::Function::FirstOrderTextureHistogram< ${ITKT_${t}}, ${ITKT_VI${ITKM_F}${d}}>" with a VectorImage and not a VariableLengthVector. I tried changing to a VariableLengthVector in the .wrap file, but to no avail.
> I'm wrapping the base class "itkMovingHistogramImageFilterBase" as well, is this necessary?
> The whole .wrap file is at the end of the message if needed...
>
> Sorry for the endless questions and thank you very much for the help!
>
> Best,
>
> Yannick
>
>
> set(OutputVectorDim 8)
> itk_wrap_class("itk::FixedArray")
>   itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}")
> itk_end_wrap_class()
>
> itk_wrap_class("itk::Vector")
>   itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}")
> itk_end_wrap_class()
>
> WRAP_TYPE("itk::Image" "I" "itkImage.h")
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     ADD_TEMPLATE("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}")
>   endforeach()
> END_WRAP_TYPE()
>
> itk_wrap_class("itk::Image" POINTER)
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     itk_wrap_template("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}")
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_class("itk::ImageSource" POINTER)
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" "itk::Image<itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}>")
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_class("itk::ImageToImageFilter" POINTER)
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     foreach(t ${WRAP_ITK_INT})
>       itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}"
>                         "${ITKT_I${t}${d}}, itk::Image<itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}>")
>     endforeach()
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_include("itkFlatStructuringElement.h")
>
> WRAP_TYPE("itk::FlatStructuringElement" "SE")
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     ADD_TEMPLATE("${d}"  "${d}")
>   endforeach()
> END_WRAP_TYPE()
> set(itk_Wrap_StructuringElement ${WRAPPER_TEMPLATES})
>
> itk_wrap_simple_class("itk::ImageIOBase" )
>
> itk_wrap_class("itk::KernelImageFilter" POINTER)
>   foreach(t ${WRAP_ITK_INT})
>     foreach(d ${ITK_WRAP_IMAGE_DIMS})
>       itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}${ITKM_SE${d}}" "${ITKT_I${t}${d}}, ${ITKT_I${t}${d}}, ${ITKT_SE${d}}")
>     endforeach()
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_class("itk::ImageFileReader" POINTER)
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}"
>                       "itk::Image<itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}>")
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_class("itk::ImageFileWriter" POINTER)
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}"
>                       "itk::Image<itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}>")
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_include("itkMovingHistogramImageFilterBase.h")
> itk_wrap_class("itk::MovingHistogramImageFilterBase" POINTER)
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     foreach(t ${WRAP_ITK_INT})
>       itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}${ITKM_SE${d}}"
>                         "${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}},${ITKT_SE${d}}, itk::Function::FirstOrderTextureHistogram< ${ITKT_${t}}, ${ITKT_VI${ITKM_F}${d}} >")
>     endforeach()
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_include("itkFirstOrderTextureHistogram.h")
> itk_wrap_class("itk::Function::FirstOrderTextureHistogram")
>   foreach(t ${WRAP_ITK_INT})
>     itk_wrap_template("${ITKM_${t}}${ITKM_VI${ITKM_F}${d}} " "${ITKT_${t}}, ${ITKT_VI${ITKM_F}${d}}")
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_include("itkMovingHistogramImageFilter.h")
> itk_wrap_class("itk::MovingHistogramImageFilter" POINTER)
>   foreach(t ${WRAP_ITK_INT})
>     foreach(d ${ITK_WRAP_IMAGE_DIMS})
>       itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}${ITKM_SE${d}}"
>                         "${ITKT_I${t}${d}}${ITKM_VI${ITKM_F}${d}}, ${ITKT_SE${d}}, itk::Function::FirstOrderTextureHistogram< ${ITKT_${t}}, ${ITKT_VI${ITKM_F}${d}}>")
>     endforeach()
>   endforeach()
> itk_end_wrap_class()
>
> itk_wrap_class("itk::FirstOrderTextureFeaturesImageFilter" POINTER)
>   foreach(d ${ITK_WRAP_IMAGE_DIMS})
>     foreach(t ${WRAP_ITK_INT})
>       itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}${ITKM_SE${d}}"
>                       "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}, ${ITKT_SE${d}}, itk::Function::FirstOrderTextureHistogram< ${ITKT_${t}}, ${ITKT_VI${ITKM_F}${d}}>")
>   endforeach()
> endforeach()
> itk_end_wrap_class()
>
>


More information about the Community mailing list