Commit 5835b638 authored by FBerendsen's avatar FBerendsen
Browse files

ENH: exposed InternalComputationValueType as template paramter of...

ENH: exposed InternalComputationValueType as template paramter of ItkImageRegistrationMethod4vComponent
parent 19b0c99e
......@@ -33,17 +33,17 @@
namespace selx
{
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType>
class ItkImageRegistrationMethodv4Component :
public SuperElastixComponent<
Accepting< itkImageFixedInterface< Dimensionality, TPixel >,
itkImageMovingInterface< Dimensionality, TPixel >,
itkTransformInterface< double, Dimensionality >,
itkTransformParametersAdaptorsContainerInterface< double, Dimensionality >,
itkTransformInterface< InternalComputationValueType, Dimensionality >,
itkTransformParametersAdaptorsContainerInterface< InternalComputationValueType, Dimensionality >,
itkMetricv4Interface< Dimensionality, TPixel >,
itkOptimizerv4Interface< double >
itkOptimizerv4Interface< InternalComputationValueType >
>,
Providing< itkTransformInterface< double, Dimensionality >,
Providing< itkTransformInterface< InternalComputationValueType, Dimensionality >,
RunRegistrationInterface
>
>
......@@ -58,7 +58,7 @@ public:
virtual ~ItkImageRegistrationMethodv4Component();
typedef TPixel PixelType;
using TransformInternalComputationValueType = double; //should be in class template
using TransformInternalComputationValueType = InternalComputationValueType;
// Get the type definitions from the interfaces
......@@ -115,7 +115,7 @@ protected:
// return the class name and the template arguments to uniquely identify this component.
static inline const std::map<std::string, std::string> TemplateProperties()
{
return{ { keys::NameOfClass, "ItkImageRegistrationMethodv4Component" }, { keys::PixelType, PodString<TPixel>::Get() }, { keys::Dimensionality, std::to_string(Dimensionality) } };
return{ { keys::NameOfClass, "ItkImageRegistrationMethodv4Component" }, { keys::PixelType, PodString<TPixel>::Get() },{ keys::InternalComputationValueType, PodString<InternalComputationValueType>::Get() }, { keys::Dimensionality, std::to_string(Dimensionality) } };
}
};
......
......@@ -114,8 +114,8 @@ public:
}
};
template< int Dimensionality, class TPixel >
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::ItkImageRegistrationMethodv4Component() : m_TransformAdaptorsContainerInterface(
template< int Dimensionality, class TPixel, class InternalComputationValueType >
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::ItkImageRegistrationMethodv4Component() : m_TransformAdaptorsContainerInterface(
nullptr )
{
m_theItkFilter = TheItkFilterType::New();
......@@ -126,15 +126,15 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::ItkImageRegistr
}
template< int Dimensionality, class TPixel >
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::~ItkImageRegistrationMethodv4Component()
template< int Dimensionality, class TPixel, class InternalComputationValueType >
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::~ItkImageRegistrationMethodv4Component()
{
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
int
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >
::Set( itkImageFixedInterface< Dimensionality, TPixel > * component )
{
auto fixedImage = component->GetItkImageFixed();
......@@ -145,9 +145,9 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
int
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >
::Set( itkImageMovingInterface< Dimensionality, TPixel > * component )
{
auto movingImage = component->GetItkImageMoving();
......@@ -157,9 +157,9 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
int
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( itkTransformInterface< TransformInternalComputationValueType,
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::Set( itkTransformInterface< TransformInternalComputationValueType,
Dimensionality > * component )
{
this->m_theItkFilter->SetInitialTransform( component->GetItkTransform() );
......@@ -168,9 +168,9 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( itkTransfo
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
int
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( TransformParametersAdaptorsContainerInterfaceType * component )
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::Set( TransformParametersAdaptorsContainerInterfaceType * component )
{
// store the interface to the ParametersAdaptorsContainer since during the setup of the connections the TransformParametersAdaptorComponent might not be fully connected and thus does not have the adaptors ready.
this->m_TransformAdaptorsContainerInterface = component;
......@@ -178,9 +178,9 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( TransformP
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
int
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( itkMetricv4Interface< Dimensionality, TPixel > * component )
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::Set( itkMetricv4Interface< Dimensionality, TPixel > * component )
{
//TODO: The optimizer must be set explicitly, since this is a work-around for a bug in itkRegistrationMethodv4.
//TODO: report bug to itk: when setting a metric, the optimizer must be set explicitly as well, since default optimizer setup breaks.
......@@ -190,9 +190,9 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( itkMetricv
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
int
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( itkOptimizerv4Interface< OptimizerInternalComputationValueType > * component )
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::Set( itkOptimizerv4Interface< OptimizerInternalComputationValueType > * component )
{
//TODO: The optimizer must be set explicitly, since this is a work-around for a bug in itkRegistrationMethodv4.
//TODO: report bug to itk: when setting a metric, the optimizer must be set explicitly as well, since default optimizer setup breaks.
......@@ -202,9 +202,9 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::Set( itkOptimiz
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
void
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::RunRegistration( void )
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::RunRegistration( void )
{
typename FixedImageType::ConstPointer fixedImage = this->m_theItkFilter->GetFixedImage();
typename MovingImageType::ConstPointer movingImage = this->m_theItkFilter->GetMovingImage();
......@@ -255,18 +255,18 @@ ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::RunRegistration
}
template< int Dimensionality, class TPixel >
typename ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >::TransformPointer
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
typename ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >::TransformPointer
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >
::GetItkTransform()
{
return this->m_theItkFilter->GetModifiableTransform();
}
template< int Dimensionality, class TPixel >
template< int Dimensionality, class TPixel, class InternalComputationValueType >
bool
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel >
ItkImageRegistrationMethodv4Component< Dimensionality, TPixel, InternalComputationValueType >
::MeetsCriterion(const ComponentBase::CriterionType & criterion)
{
bool hasUndefinedCriteria(false);
......
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