Open thewtex opened 3 years ago
A simple check for this is changing the PixelType from float to double in the test added in: https://github.com/SuperElastix/elastix/pull/323
@N-Dekker @mstaring @stefanklein is it possible to take a look at this? I think a cast of the type is intended and required somewhere, which I do not know where that should be.
I was unaware of this as I was trying to use transformix to deform an atlas (uchar image).
Current status:
TransformixFilter<TMovingImage>
:
https://github.com/SuperElastix/elastix/blob/d8e9e1b5bcd1184ca9d3b343e61ccc85857ce407/Core/Main/itkTransformixFilter.h#L58-L59 When using Python + ITKElastix, the image type may be specified in square brackets:ImageType = itk.Image[itk.F, 2]
transformix_filter = itk.TransformixFilter[ImageType].New()
parameter_map =
{
"FixedInternalImagePixelType": ("float"),
"MovingInternalImagePixelType": ("float")
... [other parameters here] ...
}
parameter_object = itk.ParameterObject.New()
parameter_object.AddParameterMap(parameter_map)
transformix_filter.SetMovingImage(moving_image)
transformix_filter.SetTransformParameterObject(parameter_object)
ELASTIX_IMAGE_2D_PIXEL_TYPES
, ELASTIX_IMAGE_3D_PIXEL_TYPES
, etc)That's it for now! Even though it may be somewhat inconvenient, I think it works well.
When
itk::TransformixFilter
is templated with aTMovingImage
that does not match the internalElastixTemplate
TMovingImage
, thisdynamic_cast
will fail:https://github.com/SuperElastix/elastix/blob/a187f9af5d11abff558faad1aaa4605e8c15bcce/Core/Kernel/elxElastixTemplate.hxx#L100-L101
and no moving image will be detected here:
https://github.com/SuperElastix/elastix/blob/a187f9af5d11abff558faad1aaa4605e8c15bcce/Core/Kernel/elxElastixTemplate.hxx#L387-L388
and no transformation is applied here:
https://github.com/SuperElastix/elastix/blob/a187f9af5d11abff558faad1aaa4605e8c15bcce/Core/Kernel/elxTransformixMain.cxx#L145