Dear ITK community,
after generating radially distorted images of lung tissue for my PhD project with ITKPython, I have realized that multiple filters I use do not support certain ITK data types. In order to solve this issue, I built the ITK python module myself and selected the previously missing ITK data types to be supported. However, after running a test script, the situation did not change. This is my test script that is supposed to show the supported data types of the NearestneighbourInterpolateImageFunction. After the build, itk.F should be supported as well:
`import itk
x = itk.NearestNeighborInterpolateImageFunction.GetTypes()
print(x)`
However, this is the output I receive:
`
Options:
[<class ‘itk.itkImagePython.itkImageD2’>, ]
[<class ‘itk.itkImagePython.itkImageD3’>, ]
[<class ‘itk.itkImagePython.itkImageF2’>, ]
[<class ‘itk.itkImagePython.itkImageF3’>, ]
[<class ‘itk.itkImagePython.itkImageSC2’>, ]
[<class ‘itk.itkImagePython.itkImageSC3’>, ]
[<class ‘itk.itkImagePython.itkImageSS2’>, ]
[<class ‘itk.itkImagePython.itkImageSS3’>, ]
[<class ‘itk.itkImagePython.itkImageUC2’>, ]
[<class ‘itk.itkImagePython.itkImageUC3’>, ]
[<class ‘itk.itkImagePython.itkImageULL2’>, ]
[<class ‘itk.itkImagePython.itkImageULL3’>, ]
[<class ‘itk.itkImagePython.itkImageUS2’>, ]
[<class ‘itk.itkImagePython.itkImageUS3’>, ]
None
Process finished with exit code 0`
For the build process, this was my knowledge souce:
https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch3.html#x39-440003.7
The error message of my original script for the radial image warping is the following:
Traceback (most recent call last): File "./Test_Displacement.py", line 49, in <module> interpolator = itk.NearestNeighborInterpolateImageFunction[ImageType, itk.F].New() File "/home/reimelta/.local/lib/python2.7/site-packages/itkTemplate.py", line 340, in __getitem__ raise TemplateTypeError(self, tuple(cleanParameters)) itkTemplate.TemplateTypeError: itk.NearestNeighborInterpolateImageFunction is not wrapped for input type
itk.Image[itk.US,3], itk.F`.
To limit the size of the package, only a limited number of
types are available in ITK Python. To print the supported
types, run the following command in your python environment:
itk.NearestNeighborInterpolateImageFunction.GetTypes()
Possible solutions:
-
If you are an application user:
** Convert your input image into a supported format (see below).
** Contact developer to report the issue. -
If you are an application developer, force input images to be
loaded in a supported pixel type.e.g.: instance = itk.NearestNeighborInterpolateImageFunction[itk.Image[itk.SS,2], itk.D].New(my_input)
-
(Advanced) If you are an application developer, build ITK Python yourself and
turned toON
the corresponding CMake option to wrap the pixel type or image
dimension you need. When configuring ITK with CMake, you can set
ITK_WRAP_${type}
(replace ${type} with appropriate pixel type such as
double
). If you need to support images with 4 or 5 dimensions, you can add
these dimensions to the list of dimensions in the CMake variable
ITK_WRAP_IMAGE_DIMS
.
Supported input types:
itk.Image[itk.SS,2]
itk.Image[itk.UC,2]
itk.Image[itk.US,2]
itk.Image[itk.F,2]
itk.Image[itk.SS,3]
itk.Image[itk.UC,3]
itk.Image[itk.US,3]
itk.Image[itk.F,3]`
My question is: what could be the most common errors during a special build of the ITKPython module?
Thank you in advance!
Alex Reimelt