[Insight-users] PDE deformable registration with image types other than itkImage
Koen Van Leemput
koen . vanleemput at hus . fi
Mon, 25 Aug 2003 14:31:48 +0300
Hi,
One of the niceties of ITK is that it is templated over the image type. As
long as an image type respects the API of itkImage, one can use any
definition. All one has to do is to implement a CopyInformation method that
copies certain information from one image into another, and ITK will
automatically push whatever information you add to your image type through
the pipeline.
However, I noticed that the PDE deformable registration framework wouldn't
work with any other image type than itkImage. Here is why:
1. itkMultiResolutionPDEDeformableRegistration.h defines an internal image
type itk::Image<float,dimension>, which results in exceptions being thrown at
run time because this internal image type can't copy its information from a
non-itkImage. My suggestion would be to closely follow the example of
itkMultiResolutionImageRegistrationMethod, where the image type is fully
exposed.
2. itkPDEDeformableRegistrationFilter.txx: in SmoothDeformationField(), the
information of m_TempField is "manually" set by explicitly calling
m_TempField->SetSpacing( field->GetSpacing() );
m_TempField->SetOrigin( field->GetOrigin() );
However, the image type at hand may have additional information to be copied,
and so I would suggest using
m_TempField->CopyInformation( field );
instead.
3. In itkDemonsRegistrationFunction->ComputeUpdate(), the following code is
used to convert a position in the image grid into physical space:
for( j = 0; j < ImageDimension; j++ )
{
mappedPoint[j] = double( index[j] ) * m_FixedImageSpacing[j] +
m_FixedImageOrigin[j];
mappedPoint[j] += it.GetCenterPixel()[j];
}
A more general approach, used throughout ITK, would be:
m_FixedImage->TransformIndexToPhysicalPoint( index, mappedPoint );
for( j = 0; j < ImageDimension; j++ )
{
mappedPoint[j] += it.GetCenterPixel()[j];
}
Of course, if there is a difference between these two versions for the image
type at hand, the demons forces will probably point wrongly as well, which
I'm very well aware of ;-)
- Koen