Commit 6e44525a authored by Floris Berendsen's avatar Floris Berendsen
Browse files

WIP: split InterfaceTraits.h and moved to corresponding selx*Interfaces.h

parent 31faac4b
......@@ -17,7 +17,7 @@
#
#=========================================================================
include( selxCMakeColors )
#include( selxCMakeColors )
# ---------------------------------------------------------------------
# Private macros
......
......@@ -20,6 +20,7 @@
#ifndef selxElastixInterfaces_h
#define selxElastixInterfaces_h
#include "elxElastixFilter.h"
#include "elxElastixFilter.h"
namespace selx
......@@ -34,6 +35,15 @@ public:
virtual elastixTransformParameterObject * GetTransformParameterObject() = 0;
};
template< class F, class M >
struct Properties< elastixTransformParameterObjectInterface< F, M >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "elastixTransformParameterObjectInterface" } }; // TODO map F and M to strings?
}
};
} // end namespace selx
#endif // #define selxElastixInterfaces_h
......@@ -20,6 +20,8 @@
#ifndef selxExamplesInterfaces_h
#define selxExamplesInterfaces_h
#include selxInterfaces.h
namespace selx
{
// Define the providing interfaces abstractly
......@@ -64,6 +66,52 @@ public:
virtual int Update( ConflictinUpdateInterface * ) = 0;
};
template< >
struct Properties< MetricValueInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "MetricValueInterface" } };
}
};
template< >
struct Properties< MetricDerivativeInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "MetricDerivativeInterface" } };
}
};
template< >
struct Properties< OptimizerUpdateInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "OptimizerUpdateInterface" } };
}
};
template< >
struct Properties< ConflictinUpdateInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "ConflictinUpdateInterface" } };
}
};
template< >
struct Properties< TransformedImageInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "TransformedImageInterface" } };
}
};
} // end namespace selx
#endif // #define selxExamplesInterfaces_h
......@@ -20,8 +20,8 @@
#ifndef selxSinksAndSourcesInterfaces_h
#define selxSinksAndSourcesInterfaces_h
#include "selxInterfaces.h"
#include "itkDataObject.h"
#include "selxAnyFileReader.h"
#include "selxAnyFileWriter.h"
......@@ -59,6 +59,26 @@ public:
virtual DataObjectPointer GetInitializedOutput( void ) = 0;
};
template< >
struct Properties< SourceInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "SourceInterface" } };
}
};
template< >
struct Properties< SinkInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "SinkInterface" } };
}
};
} // end namespace selx
#endif // #define selxSinksAndSourcesInterfaces_h
......@@ -20,6 +20,8 @@
#ifndef selxRegistrationMethodv4Interfaces_h
#define selxRegistrationMethodv4Interfaces_h
#include "selxInterfaces.h"
#include <string>
#include "itkProcessObject.h"
......@@ -192,6 +194,119 @@ public:
virtual typename TransformBaseType::Pointer GetItkTransform() = 0;
virtual const typename std::string GetComponentName() = 0;
};
// InterfaceName<T>::Get() should return "itkImageSourceInterface" no matter over which arguments itkImageSourceInterface is templated
template< int D, class TPixel >
struct Properties< itkImageInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D, class TPixel >
struct Properties< itkImageFixedInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageFixedInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D >
struct Properties< itkImageDomainFixedInterface< D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageDomainFixedInterface" }, { keys::Dimensionality, std::to_string( D ) } };
}
};
template< int D, class TPixel >
struct Properties< itkImageMovingInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageMovingInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D, class TPixel >
struct Properties< DisplacementFieldItkImageSourceInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "DisplacementFieldItkImageSourceInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D, class TPixel >
struct Properties< itkMeshInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkMeshInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D, class TPixel, class InternalComputationValueType >
struct Properties< itkMetricv4Interface< D, TPixel, InternalComputationValueType >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkMetricv4Interface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() } };
}
};
template< class InternalComputationValueType >
struct Properties< itkOptimizerv4Interface< InternalComputationValueType >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkOptimizerv4Interface" }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< itkTransformInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkTransformInterface" }, { keys::Dimensionality, std::to_string( D ) } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< MultiStageTransformInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "MultiStageTransformInterface" }, { keys::Dimensionality, std::to_string(D) } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< itkTransformParametersAdaptorsContainerInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkTransformParametersAdaptorsContainerInterface" }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() }, { keys::Dimensionality, std::to_string( D ) } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< itkGaussianExponentialDiffeomorphicTransformParametersAdaptorsContainerInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkGaussianExponentialDiffeomorphicTransformParametersAdaptorsContainerInterface" }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() }, { keys::Dimensionality, std::to_string( D ) } };
}
};
} // end namespace selx
#endif // #define selxRegistrationMethodv4Interfaces_h
......@@ -24,7 +24,6 @@
#include "itkObjectFactory.h"
#include "itkMacro.h"
#include "selxInterfaceStatus.h"
//#include "itkComponentBase.h"
#include <list>
#include <iostream>
#include <fstream>
......
......@@ -24,10 +24,7 @@
namespace selx
{
/** \class MetricComponent1Factory
* \brief Create instances of MetaImageIO objects using an object factory.
* \ingroup ITKIOMeta
*/
template< class ComponentT >
class ComponentFactory : public itk::ObjectFactoryBase
{
......
......@@ -17,9 +17,7 @@
*
*=========================================================================*/
#include "selxComponentFactory.h"
//#include "itkMetricComponent1.h"
#include "itkVersion.h"
//#include "ComponentTraits.h"
#include <typeinfo>
namespace selx
{
......@@ -50,18 +48,4 @@ ComponentFactory< ComponentT >::GetDescription() const
}
// Undocumented API used to register during static initialization.
// DO NOT CALL DIRECTLY.
/*
static bool MetricComponent1FactoryHasBeenRegistered;
void MetricComponent1FactoryRegister__Private(void)
{
if( ! MetricComponent1FactoryHasBeenRegistered )
{
MetricComponent1FactoryHasBeenRegistered = true;
MetricComponent1Factory::RegisterOneFactory();
}
}
*/
} // end namespace selx
......@@ -52,167 +52,6 @@ struct Properties< InterfaceAcceptor< InterfaceType >>
// The specializations for each type of Interface supported by the toolbox
template< >
struct Properties< MetricValueInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "MetricValueInterface" } };
}
};
template< >
struct Properties< MetricDerivativeInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "MetricDerivativeInterface" } };
}
};
template< >
struct Properties< OptimizerUpdateInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "OptimizerUpdateInterface" } };
}
};
template< >
struct Properties< ConflictinUpdateInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "ConflictinUpdateInterface" } };
}
};
template< >
struct Properties< TransformedImageInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "TransformedImageInterface" } };
}
};
// InterfaceName<T>::Get() should return "itkImageSourceInterface" no matter over which arguments itkImageSourceInterface is templated
template< int D, class TPixel >
struct Properties< itkImageInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D, class TPixel >
struct Properties< itkImageFixedInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageFixedInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D >
struct Properties< itkImageDomainFixedInterface< D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageDomainFixedInterface" }, { keys::Dimensionality, std::to_string( D ) } };
}
};
template< int D, class TPixel >
struct Properties< itkImageMovingInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkImageMovingInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D, class TPixel >
struct Properties< DisplacementFieldItkImageSourceInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "DisplacementFieldItkImageSourceInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< int D, class TPixel >
struct Properties< itkMeshInterface< D, TPixel >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkMeshInterface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() } };
}
};
template< >
struct Properties< SourceInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "SourceInterface" } };
}
};
template< >
struct Properties< SinkInterface >
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "SinkInterface" } };
}
};
template< int D, class TPixel, class InternalComputationValueType >
struct Properties< itkMetricv4Interface< D, TPixel, InternalComputationValueType >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkMetricv4Interface" }, { keys::Dimensionality, std::to_string( D ) }, { keys::PixelType, PodString< TPixel >::Get() }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() } };
}
};
template< class InternalComputationValueType >
struct Properties< itkOptimizerv4Interface< InternalComputationValueType >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkOptimizerv4Interface" }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< itkTransformInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkTransformInterface" }, { keys::Dimensionality, std::to_string( D ) } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< MultiStageTransformInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "MultiStageTransformInterface" }, { keys::Dimensionality, std::to_string(D) } };
}
};
template< class F, class M >
struct Properties< elastixTransformParameterObjectInterface< F, M >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "elastixTransformParameterObjectInterface" } }; // TODO map F and M to strings?
}
};
template< >
struct Properties< RegistrationControllerStartInterface >
{
......@@ -248,22 +87,5 @@ struct Properties< ReconnectTransformInterface >
return { { keys::NameOfInterface, "ReconnectTransformInterface" } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< itkTransformParametersAdaptorsContainerInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkTransformParametersAdaptorsContainerInterface" }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() }, { keys::Dimensionality, std::to_string( D ) } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< itkGaussianExponentialDiffeomorphicTransformParametersAdaptorsContainerInterface< InternalComputationValueType, D >>
{
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkGaussianExponentialDiffeomorphicTransformParametersAdaptorsContainerInterface" }, { keys::InternalComputationValueType, PodString< InternalComputationValueType >::Get() }, { keys::Dimensionality, std::to_string( D ) } };
}
};
} // end namespace selx
#endif // #define InterfaceTraits_h
......@@ -20,6 +20,8 @@
#ifndef selxInterfaces_h
#define selxInterfaces_h
#include selxInterfaceTraits.h
namespace selx
{
// Define the providing interfaces abstractly
......
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