Skip to content

Commit

Permalink
ENH: Add TransformType to ElastixRegistrationMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Dekker committed Dec 7, 2022
1 parent a2e140d commit debc79e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 5 additions & 4 deletions Core/Main/itkElastixRegistrationMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class ITK_TEMPLATE_EXPORT ElastixRegistrationMethod : public itk::ImageSource<TF

using FixedMaskType = Image<unsigned char, FixedImageDimension>;
using MovingMaskType = Image<unsigned char, MovingImageDimension>;
using TransformType = Transform<double, FixedImageDimension, MovingImageDimension>;

using FixedImageType = TFixedImage;
using MovingImageType = TMovingImage;
Expand Down Expand Up @@ -259,17 +260,17 @@ class ITK_TEMPLATE_EXPORT ElastixRegistrationMethod : public itk::ImageSource<TF
GetNumberOfTransforms() const;

/** Returns the nth transformation, produced during the last Update(). */
SmartPointer<Transform<double, FixedImageDimension, MovingImageDimension>>
SmartPointer<TransformType>
GetNthTransform(const unsigned int n) const;

/** Returns the combination transformation, produced during the last Update(). */
SmartPointer<Transform<double, FixedImageDimension, MovingImageDimension>>
SmartPointer<TransformType>
GetCombinationTransform() const;

/** Converts the specified elastix Transform object to the corresponding ITK Transform object. Returns null if there
* is no corresponding ITK Transform type. */
static SmartPointer<Transform<double, FixedImageDimension, MovingImageDimension>>
ConvertToItkTransform(const Transform<double, FixedImageDimension, MovingImageDimension> &);
static SmartPointer<TransformType>
ConvertToItkTransform(const TransformType &);

protected:
ElastixRegistrationMethod();
Expand Down
10 changes: 4 additions & 6 deletions Core/Main/itkElastixRegistrationMethod.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::GetNumberOfTransforms() co
template <typename TFixedImage, typename TMovingImage>
auto
ElastixRegistrationMethod<TFixedImage, TMovingImage>::GetNthTransform(const unsigned int n) const
-> SmartPointer<Transform<double, FixedImageDimension, MovingImageDimension>>
-> SmartPointer<TransformType>
{
const auto * const transformContainer = m_ElastixMain->GetElastixBase().GetTransformContainer();

Expand All @@ -831,8 +831,7 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::GetNthTransform(const unsi

template <typename TFixedImage, typename TMovingImage>
auto
ElastixRegistrationMethod<TFixedImage, TMovingImage>::GetCombinationTransform() const
-> SmartPointer<Transform<double, FixedImageDimension, MovingImageDimension>>
ElastixRegistrationMethod<TFixedImage, TMovingImage>::GetCombinationTransform() const -> SmartPointer<TransformType>
{
const auto * const transformContainer = m_ElastixMain->GetElastixBase().GetTransformContainer();

Expand All @@ -853,9 +852,8 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::GetCombinationTransform()

template <typename TFixedImage, typename TMovingImage>
auto
ElastixRegistrationMethod<TFixedImage, TMovingImage>::ConvertToItkTransform(
const Transform<double, FixedImageDimension, MovingImageDimension> & elxTransform)
-> SmartPointer<Transform<double, FixedImageDimension, MovingImageDimension>>
ElastixRegistrationMethod<TFixedImage, TMovingImage>::ConvertToItkTransform(const TransformType & elxTransform)
-> SmartPointer<TransformType>
{
const auto * const combinationTransform =
dynamic_cast<const itk::AdvancedCombinationTransform<double, FixedImageDimension> *>(&elxTransform);
Expand Down

0 comments on commit debc79e

Please sign in to comment.