Commit 715e53be authored by Floris Berendsen's avatar Floris Berendsen
Browse files

STYLE: uncrustify

parent 9c85d908
......@@ -89,7 +89,7 @@ public:
ItkSyNImageRegistrationMethodComponent< 3, double >,
ItkSyNImageRegistrationMethodComponent< 2, float >,
ItkANTSNeighborhoodCorrelationImageToImageMetricv4Component< 3, double >,
ItkMeanSquaresImageToImageMetricv4Component< 3, double, double>,
ItkMeanSquaresImageToImageMetricv4Component< 3, double, double >,
ItkANTSNeighborhoodCorrelationImageToImageMetricv4Component< 2, float >,
ItkMeanSquaresImageToImageMetricv4Component< 2, float, double >,
ItkAffineTransformComponent< double, 3 >,
......
......@@ -124,7 +124,7 @@ public:
ComponentNamesType GetOutputNames( const ComponentNameType name ) const;
// Returns a vector of the Component names at the incoming direction
ComponentNamesType GetInputNames(const ComponentNameType name) const;
ComponentNamesType GetInputNames( const ComponentNameType name ) const;
void WriteBlueprint( const std::string filename );
......
......@@ -282,22 +282,24 @@ Blueprint
return container;
}
Blueprint::ComponentNamesType
Blueprint
::GetInputNames(const ComponentNameType name) const
::GetInputNames( const ComponentNameType name ) const
{
ComponentNamesType container;
ComponentNamesType container;
//auto vertex = this->m_Graph.vertex(name);
//boost::in_edges(vertex, this->m_Graph);
InputIteratorPairType inputIteratorPair = boost::in_edges(this->m_Graph.vertex(name), this->m_Graph);
for (auto it = inputIteratorPair.first; it != inputIteratorPair.second; ++it)
InputIteratorPairType inputIteratorPair = boost::in_edges( this->m_Graph.vertex( name ), this->m_Graph );
for( auto it = inputIteratorPair.first; it != inputIteratorPair.second; ++it )
{
container.push_back(this->m_Graph.graph()[it->m_source].name);
container.push_back( this->m_Graph.graph()[ it->m_source ].name );
}
return container;
}
Blueprint::ConnectionIndexType
Blueprint
::GetConnectionIndex( ComponentNameType upstream, ComponentNameType downstream ) const
......
......@@ -31,11 +31,11 @@ namespace selx
{
namespace keys
{
const char * const NameOfInterface = "NameOfInterface"; // Each Interface has a sting name
const char * const NameOfClass = "NameOfClass"; // Each Component has a sting name
const char * const Dimensionality = "Dimensionality"; // Template int parameter
const char * const PixelType = "PixelType"; // Template POD parameter
const char * const InternalComputationValueType = "InternalComputationValueType"; // Template POD parameter for transforms or optimizers etc.
const char * const NameOfInterface = "NameOfInterface"; // Each Interface has a sting name
const char * const NameOfClass = "NameOfClass"; // Each Component has a sting name
const char * const Dimensionality = "Dimensionality"; // Template int parameter
const char * const PixelType = "PixelType"; // Template POD parameter
const char * const InternalComputationValueType = "InternalComputationValueType"; // Template POD parameter for transforms or optimizers etc.
const char * const SourceInterface = "SourceInterface"; // Special interface that connects to the outside of the SuperElastixFilter
const char * const SinkInterface = "SinkInterface"; // Special interface that connects to the outside of the SuperElastixFilter
......
......@@ -23,50 +23,47 @@
namespace selx
{
template< typename T >
struct PodString
{
static_assert( StaticErrorMessageRevealT< T >::False, "Please Implement PodString<T> for this T" );
};
template< >
struct PodString< unsigned int >
{
static const char * Get()
{
return "unsigned int";
}
};
template< typename T >
struct PodString
{
static_assert(StaticErrorMessageRevealT<T>::False, "Please Implement PodString<T> for this T");
};
template< >
struct PodString< unsigned int >
{
static const char * Get()
{
return "unsigned int";
}
};
template< >
struct PodString< int >
{
static const char * Get()
{
return "int";
}
};
template< >
struct PodString< float >
{
static const char * Get()
{
return "float";
}
};
template< >
struct PodString< int >
{
static const char * Get()
{
return "int";
}
};
template< >
struct PodString< float >
{
static const char * Get()
{
return "float";
}
};
template< >
struct PodString< double >
{
static const char * Get()
{
return "double";
}
};
template< >
struct PodString< double >
{
static const char * Get()
{
return "double";
}
};
}
#endif //selxPodString_h
\ No newline at end of file
#endif //selxPodString_h
......@@ -21,9 +21,9 @@
namespace selx
{
// helper to display type name in static assert error message (required, at least for VC++ 2013)
template <typename T>
struct StaticErrorMessageRevealT { enum { False = false }; };
// helper to display type name in static assert error message (required, at least for VC++ 2013)
template< typename T >
struct StaticErrorMessageRevealT { enum { False = false }; };
}
#endif // selxStaticErrorMessageRevealT_h
\ No newline at end of file
#endif // selxStaticErrorMessageRevealT_h
......@@ -35,29 +35,31 @@
namespace selx
{
enum class CriterionStatus { Satisfied, Failed, Unknown };
enum class CriterionStatus { Satisfied, Failed, Unknown };
CriterionStatus CheckTemplateProperties(const std::map<std::string, std::string> templateProperties, const std::pair<std::string, std::vector<std::string>> criterion)
CriterionStatus
CheckTemplateProperties( const std::map< std::string, std::string > templateProperties,
const std::pair< std::string, std::vector< std::string >> criterion )
{
if( templateProperties.count( criterion.first ) == 1 ) // e.g. is "Dimensionality" a template property? Or is NameOfClass queried?
{
if (templateProperties.count(criterion.first) == 1) // e.g. is "Dimensionality" a template property? Or is NameOfClass queried?
if( criterion.second.size() != 1 ) // criteria can be of format: "keystring": ["value1", value2","value3"], but for templateproperties only 1 value is allowed.
{
if (criterion.second.size() != 1) // criteria can be of format: "keystring": ["value1", value2","value3"], but for templateproperties only 1 value is allowed.
{
std::stringstream msg;
msg << "The criterion " << criterion.first << " may have only 1 value";
throw std::runtime_error(msg.str());
//itkExceptionMacro("The criterion " << criterion.first << " may have only 1 value");
}
for (auto const & criterionValue : criterion.second)
std::stringstream msg;
msg << "The criterion " << criterion.first << " may have only 1 value";
throw std::runtime_error( msg.str() );
//itkExceptionMacro("The criterion " << criterion.first << " may have only 1 value");
}
for( auto const & criterionValue : criterion.second )
{
if( criterionValue != templateProperties.at( criterion.first ) )
{
if (criterionValue != templateProperties.at(criterion.first))
{
return CriterionStatus::Failed;
}
return CriterionStatus::Failed;
}
return CriterionStatus::Satisfied;
}
return CriterionStatus::Unknown;
return CriterionStatus::Satisfied;
}
return CriterionStatus::Unknown;
}
}
#endif //selxCheckTemplateProperties_h
......@@ -53,9 +53,9 @@ public:
typedef std::map< ParameterKeyType, ParameterValueType > CriteriaType;
typedef std::pair< ParameterKeyType, ParameterValueType > CriterionType;
typedef std::map< std::string, std::string > InterfaceCriteriaType;
typedef std::map< std::string, std::string > InterfaceCriteriaType;
virtual int AcceptConnectionFrom(ComponentBase*, const InterfaceCriteriaType) = 0;
virtual int AcceptConnectionFrom( ComponentBase *, const InterfaceCriteriaType ) = 0;
virtual int AcceptConnectionFrom( ComponentBase * ) = 0;
......@@ -64,13 +64,14 @@ public:
virtual bool MeetsCriterion( const CriterionType & criterion ) = 0;
virtual InterfaceStatus CanAcceptConnectionFrom(ComponentBase*, const InterfaceCriteriaType) = 0;
virtual InterfaceStatus CanAcceptConnectionFrom( ComponentBase *, const InterfaceCriteriaType ) = 0;
virtual unsigned int CountAcceptingInterfaces(const InterfaceCriteriaType) = 0;
virtual unsigned int CountAcceptingInterfaces( const InterfaceCriteriaType ) = 0;
virtual unsigned int CountProvidingInterfaces( const InterfaceCriteriaType ) = 0;
virtual unsigned int CountProvidingInterfaces(const InterfaceCriteriaType) = 0;
protected:
ComponentBase() {}
virtual ~ComponentBase() {}
};
......
......@@ -50,10 +50,10 @@ public:
itkNewMacro( Self );
/** Convenient typedefs. */
typedef ComponentBase::Pointer ComponentBasePointer;
typedef ComponentBase::CriteriaType CriteriaType;
typedef ComponentBase::CriterionType CriterionType;
typedef ComponentBase::InterfaceCriteriaType InterfaceCriteriaType;
typedef ComponentBase::Pointer ComponentBasePointer;
typedef ComponentBase::CriteriaType CriteriaType;
typedef ComponentBase::CriterionType CriterionType;
typedef ComponentBase::InterfaceCriteriaType InterfaceCriteriaType;
typedef std::list< ComponentBasePointer > ComponentListType;
typedef ComponentListType::size_type NumberOfComponentsType;
......@@ -62,16 +62,19 @@ public:
/** Narrow selection criteria*/
void AddCriterion( const CriterionType & criterion );
void AddAcceptingInterfaceCriteria(const InterfaceCriteriaType & interfaceCriteria);
void AddProvidingInterfaceCriteria(const InterfaceCriteriaType & interfaceCriteria);
void AddAcceptingInterfaceCriteria( const InterfaceCriteriaType & interfaceCriteria );
void AddProvidingInterfaceCriteria( const InterfaceCriteriaType & interfaceCriteria );
unsigned int NumberOfComponents( void );
unsigned int NumberOfComponents(void);
/** Check for multiple versus 1 or 0 components*/
bool HasMultipleComponents( void );
unsigned int RequireAcceptingInterfaceFrom(ComponentBasePointer other, const InterfaceCriteriaType & interfaceCriteria);
unsigned int RequireProvidingInterfaceTo(ComponentBasePointer other, const InterfaceCriteriaType & interfaceCriteria);
unsigned int RequireAcceptingInterfaceFrom( ComponentBasePointer other, const InterfaceCriteriaType & interfaceCriteria );
unsigned int RequireProvidingInterfaceTo( ComponentBasePointer other, const InterfaceCriteriaType & interfaceCriteria );
/** Return Component or Nullptr*/
ComponentBasePointer GetComponent( void );
......
......@@ -23,4 +23,4 @@ namespace selx
{
enum class InterfaceStatus { success, noaccepter, noprovider, multiple };
}
#endif //interfaceStatus_h
\ No newline at end of file
#endif //interfaceStatus_h
......@@ -37,14 +37,14 @@ namespace selx
template< typename T >
struct Properties
{
static_assert(StaticErrorMessageRevealT<T>::False, "Please Implement Properties<InterfaceType> for this InterfaceType");
static_assert( StaticErrorMessageRevealT< T >::False, "Please Implement Properties<InterfaceType> for this InterfaceType" );
};
// Properties<T>::Get() should return the same name no matter whether T is an acceptor or provider interface.
template< typename InterfaceType >
struct Properties< InterfaceAcceptor< InterfaceType >>
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return Properties< InterfaceType >::Get();
}
......@@ -55,43 +55,43 @@ struct Properties< InterfaceAcceptor< InterfaceType >>
template< >
struct Properties< MetricValueInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "MetricValueInterface" } };
return { { keys::NameOfInterface, "MetricValueInterface" } };
}
};
template< >
struct Properties< MetricDerivativeInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "MetricDerivativeInterface" } };
return { { keys::NameOfInterface, "MetricDerivativeInterface" } };
}
};
template< >
struct Properties< OptimizerUpdateInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "OptimizerUpdateInterface" } };
return { { keys::NameOfInterface, "OptimizerUpdateInterface" } };
}
};
template< >
struct Properties< ConflictinUpdateInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "ConflictinUpdateInterface" } };
return { { keys::NameOfInterface, "ConflictinUpdateInterface" } };
}
};
template< >
struct Properties< TransformedImageInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "TransformedImageInterface" } };
return { { keys::NameOfInterface, "TransformedImageInterface" } };
}
};
......@@ -99,166 +99,163 @@ struct Properties< TransformedImageInterface >
template< int D, class TPixel >
struct Properties< itkImageInterface< D, TPixel >>
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkImageInterface" }, { keys::Dimensionality, std::to_string(D) }, { keys::PixelType, PodString<TPixel>::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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkImageFixedInterface" }, { keys::Dimensionality, std::to_string(D) }, { keys::PixelType, PodString<TPixel>::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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkImageDomainFixedInterface" }, { keys::Dimensionality, std::to_string(D) } };
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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkImageMovingInterface" }, { keys::Dimensionality, std::to_string(D) }, { keys::PixelType, PodString<TPixel>::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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "DisplacementFieldItkImageSourceInterface" }, { keys::Dimensionality, std::to_string(D) }, { keys::PixelType, PodString<TPixel>::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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkMeshInterface" }, { keys::Dimensionality, std::to_string(D) }, { keys::PixelType, PodString<TPixel>::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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "SourceInterface" } };
return { { keys::NameOfInterface, "SourceInterface" } };
}
};
template< >
struct Properties< SinkInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "SinkInterface" } };
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()
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() } };
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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkOptimizerv4Interface" }, { keys::InternalComputationValueType, PodString<InternalComputationValueType>::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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkTransformInterface" }, { keys::Dimensionality, std::to_string(D) } };
return { { keys::NameOfInterface, "itkTransformInterface" }, { 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()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "elastixTransformParameterObjectInterface" } }; // TODO map F and M to strings?
return { { keys::NameOfInterface, "elastixTransformParameterObjectInterface" } }; // TODO map F and M to strings?
}
};
template< >
struct Properties< RegistrationControllerStartInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "RegistrationControllerStartInterface" } };
return { { keys::NameOfInterface, "RegistrationControllerStartInterface" } };
}
};
template< >
struct Properties< RunRegistrationInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "RunRegistrationInterface" } };
return { { keys::NameOfInterface, "RunRegistrationInterface" } };
}
};
template< >
struct Properties< AfterRegistrationInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "AfterRegistrationInterface" } };
return { { keys::NameOfInterface, "AfterRegistrationInterface" } };
}
};
template< >
struct Properties< ReconnectTransformInterface >
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "ReconnectTransformInterface" } };
return { { keys::NameOfInterface, "ReconnectTransformInterface" } };
}
};
template< class InternalComputationValueType, int D >
struct Properties< itkTransformParametersAdaptorsContainerInterface< InternalComputationValueType, D >>
{
static const std::map<std::string, std::string> Get()
static const std::map< std::string, std::string > Get()
{
return{ { keys::NameOfInterface, "itkTransformParametersAdaptorsContainerInterface" }, { keys::InternalComputationValueType, PodString<InternalComputationValueType>::Get() }, { keys::Dimensionality, std::to_string(D) } };
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()
static const std::map< std::string, std::string > Get()
{
return { { keys::NameOfInterface, "itkGaussianExponentialDiffeomorphicTransformParametersAdaptorsContainerInterface" }, { keys::InternalComputationValueType, PodString<InternalComputationValueType>::Get() }, {