Commit 96dc99dd authored by Floris Berendsen's avatar Floris Berendsen
Browse files

WIP: implementation of CompositeTransformComponent

parent 8a241029
......@@ -30,8 +30,9 @@ namespace selx
template< class InternalComputationValueType, int Dimensionality >
class ItkCompositeTransformComponent :
public SuperElastixComponent<
Accepting< >,
Providing< MultiStageTransformInterface< InternalComputationValueType, Dimensionality >, itkTransformInterface<InternalComputationValueType, Dimensionality> >
Accepting<MultiStageTransformInterface< InternalComputationValueType, Dimensionality > >,
Providing<itkTransformInterface<InternalComputationValueType, Dimensionality>,
RunRegistrationInterface>
>
{
public:
......@@ -48,10 +49,10 @@ public:
typedef typename itk::CompositeTransform< InternalComputationValueType, Dimensionality > CompositeTransformType;
virtual typename TransformType::Pointer GetTransformFixedInitialTransform(int stageIndex) override;
virtual typename TransformType::Pointer GetTransformMovingInitialTransform(int stageIndex) override;
virtual void SetResultTransform(typename TransformType::Pointer resultTransform, int stageIndex) override;
virtual int Set(MultiStageTransformInterface< InternalComputationValueType, Dimensionality > *) override;
virtual typename void RunRegistration() override;
virtual typename TransformType::Pointer GetItkTransform() override;
virtual bool MeetsCriterion( const ComponentBase::CriterionType & criterion ) override;
......@@ -62,6 +63,7 @@ public:
private:
typename CompositeTransformType::Pointer m_CompositeTransform;
typename std::vector<MultiStageTransformInterface< InternalComputationValueType, Dimensionality >*> m_registrationStages;
protected:
......
......@@ -37,33 +37,33 @@ ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >::
}
template< class InternalComputationValueType, int Dimensionality >
typename ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >::TransformType::Pointer
int
ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >
::GetTransformFixedInitialTransform(int stageIndex)
::Set(MultiStageTransformInterface< InternalComputationValueType, Dimensionality >* component)
{
return nullptr;
// todo how do we organize the fixedtransforms?
this->m_registrationStages.push_back(component);
return 1;
}
template< class InternalComputationValueType, int Dimensionality >
typename ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >::TransformType::Pointer
ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >
::GetTransformMovingInitialTransform(int stageIndex)
ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >::GetItkTransform()
{
return nullptr;
return (typename TransformType::Pointer)this->m_CompositeTransform;
}
template< class InternalComputationValueType, int Dimensionality >
void
ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >
::SetResultTransform(typename TransformType::Pointer resultTransform, int stageIndex)
{
}
template< class InternalComputationValueType, int Dimensionality >
typename ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >::TransformType::Pointer
ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >::GetItkTransform()
ItkCompositeTransformComponent< InternalComputationValueType, Dimensionality >::RunRegistration()
{
return (typename TransformType::Pointer)this->m_CompositeTransform;
for (auto & stage : this->m_registrationStages)
{
stage->SetMovingInitialTransform(this->m_CompositeTransform);
stage->RunRegistration();
this->m_CompositeTransform->AppendTransform(stage->GetItkTransform());
}
return;
}
template< class InternalComputationValueType, int Dimensionality >
......
......@@ -44,6 +44,7 @@ class ItkImageRegistrationMethodv4Component :
itkOptimizerv4Interface< InternalComputationValueType >
>,
Providing< itkTransformInterface< InternalComputationValueType, Dimensionality >,
MultiStageTransformInterface< InternalComputationValueType, Dimensionality >,
RunRegistrationInterface
>
>
......@@ -64,6 +65,7 @@ public:
using TransformType = typename itkTransformInterface< InternalComputationValueType, Dimensionality >::TransformType;
using TransformPointer = typename itkTransformInterface< InternalComputationValueType, Dimensionality >::TransformPointer;
using CompositeTransformType = typename MultiStageTransformInterface< InternalComputationValueType, Dimensionality >::CompositeTransformType;
using TransformParametersAdaptorsContainerInterfaceType
= itkTransformParametersAdaptorsContainerInterface< InternalComputationValueType, Dimensionality >;
......@@ -89,6 +91,11 @@ public:
virtual void RunRegistration() override;
virtual void SetFixedInitialTransform(typename CompositeTransformType::Pointer fixedInitialTransform) override;
virtual void SetMovingInitialTransform(typename CompositeTransformType::Pointer movingInitialTransform) override;
virtual typename std::string GetComponentName() override;
//BaseClass methods
virtual bool MeetsCriterion( const ComponentBase::CriterionType & criterion ) override;
......
......@@ -271,6 +271,29 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputati
return this->m_theItkFilter->GetModifiableTransform();
}
template< int Dimensionality, class TPixel, class InternalComputationValueType >
void
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >
::SetFixedInitialTransform(typename CompositeTransformType::Pointer fixedInitialTransform)
{
return this->m_theItkFilter->SetFixedInitialTransform(fixedInitialTransform);
}
template< int Dimensionality, class TPixel, class InternalComputationValueType >
void
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >
::SetMovingInitialTransform(typename CompositeTransformType::Pointer movingInitialTransform)
{
return this->m_theItkFilter->SetMovingInitialTransform(movingInitialTransform);
}
template< int Dimensionality, class TPixel, class InternalComputationValueType >
typename std::string
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >
::GetComponentName()
{
return "to be implemented";
}
template< int Dimensionality, class TPixel, class InternalComputationValueType >
bool
......
......@@ -31,6 +31,8 @@
#include "itkGaussianExponentialDiffeomorphicTransformParametersAdaptor.h"
#include "itkGaussianExponentialDiffeomorphicTransform.h"
#include "itkCompositeTransform.h"
#include "itkImage.h"
#include "itkMesh.h"
......@@ -312,9 +314,12 @@ class MultiStageTransformInterface
{
public:
using TransformBaseType = itk::Transform< InternalComputationValueType, Dimensionality, Dimensionality >;
virtual typename TransformBaseType::Pointer GetTransformFixedInitialTransform(int stageIndex) = 0;
virtual typename TransformBaseType::Pointer GetTransformMovingInitialTransform(int stageIndex) = 0;
virtual void SetResultTransform(typename TransformBaseType::Pointer resultTransform, int stageIndex) = 0;
using CompositeTransformType = itk::CompositeTransform<InternalComputationValueType, Dimensionality >;
virtual void SetFixedInitialTransform(typename CompositeTransformType::Pointer) = 0;
virtual void RunRegistration(void) = 0;
virtual void SetMovingInitialTransform(typename CompositeTransformType::Pointer) = 0;
virtual typename TransformBaseType::Pointer GetItkTransform() = 0;
virtual typename std::string GetComponentName() = 0;
};
} // end namespace selx
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment