It seems the itk::JoinImageFilter is not wrapped to python (yet). I could not find it in the 5.1.2 release.
Is there a list of filters which have been wrapped?
I would expect a class named itk.join_image_filter
. The only filter in itk with join
in the name, is join_series_image_filter. I think that filter results in a different ordering of the data though.
I am trying to join components of a tensor image (stored as scalar images) and thought it a good task to start using the python interface instead of c++.
Is there an alternative or way to join the image components?
-
I tried
join_filter = itk.JoinImageFilter[type(components[0]), itk.Image[itk.F, 6]].New()
but itk.JoinImageFilter also is not available. -
I also tried to stack the images with numpy:
tensor_image = np.stack([itk.array_view_from_image(c) for c in components], axis=3)
but
itk.image_view_from_array(tensor_image, is_vector=True)
fails (error pasted below)
Should I create an issue on github?
Traceback (most recent call last):
File “E:\Develop\Scripts\MIDA_dti.venv\lib\site-packages\itkTemplate.py”, line 336, in getitem
return(self.template[tuple(cleanParameters)])
KeyError: (, 4)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “E:\Develop\Scripts\MIDA_dti.venv\lib\site-packages\itkTemplate.py”, line 340, in getitem
return(self.template[tuple(cleanParameters)])
KeyError: (, 4)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “make_tensor_image.py”, line 18, in
itk.image_view_from_array(tensor_image)
File “E:\Develop\Scripts\MIDA_dti.venv\lib\site-packages\itkExtras.py”, line 299, in GetImageViewFromArray
return _GetImageFromArray(arr, “GetImageViewFromArray”, is_vector)
File “E:\Develop\Scripts\MIDA_dti.venv\lib\site-packages\itkExtras.py”, line 272, in _GetImageFromArray
ImageType = itk.Image[PixelType, Dimension]
File “E:\Develop\Scripts\MIDA_dti.venv\lib\site-packages\itkTemplate.py”, line 342, in getitem
raise TemplateTypeError(self, tuple(cleanParameters))
itkTemplate.TemplateTypeError: itk.Image is not wrapped for input typeitk.F, int
.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.Image.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.Image[itk.RGBPixel[itk.UC], int].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.RGBPixel[itk.UC]
itk.RGBAPixel[itk.UC]
itk.Vector[itk.F,2]
itk.Vector[itk.F,3]
itk.Vector[itk.F,4]
itk.CovariantVector[itk.F,2]
itk.CovariantVector[itk.F,3]
…