Commit a58c4909 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: removed itk:LightProcessObject inheritance of Overlord

parent 2a95d093
......@@ -64,7 +64,6 @@ public:
}
BlueprintPointerType blueprint;
Overlord::Pointer overlord;
};
TEST_F(ElastixComponentTest, ImagesOnly)
......
......@@ -70,8 +70,6 @@ namespace selx {
class WBIRDemoTest : public ::testing::Test {
public:
typedef Overlord::Pointer OverlordPointerType;
/** Fill SUPERelastix' component data base by registering various components */
typedef TypeList <
DisplacementFieldItkImageFilterSinkComponent<2, float>,
......
......@@ -42,12 +42,10 @@
namespace selx
{
class Overlord : public itk::LightProcessObject
class Overlord
{
public:
selxNewMacro(Overlord, itk::LightProcessObject);
typedef ComponentBase::CriteriaType CriteriaType;
typedef ComponentBase::CriterionType CriterionType;
typedef ComponentBase::ParameterValueType ParameterValueType;
......@@ -68,6 +66,11 @@ namespace selx
typedef std::map <
std::string, SinkInterface* > SinkInterfaceMapType;
Overlord();
~Overlord() {};
SourceInterfaceMapType GetSourceInterfaces();
SinkInterfaceMapType GetSinkInterfaces();
......@@ -76,9 +79,15 @@ namespace selx
typedef itk::VectorContainer <
unsigned int, ComponentType::Pointer > ComponentsContainerType;
//TODO make const correct
//itkSetConstObjectMacro(Blueprint, Blueprint);
itkSetObjectMacro(Blueprint, Blueprint);
//void SetBlueprint(Blueprint const * blueprint){
// m_Blueprint = blueprint;
//}
void SetBlueprint(Blueprint::Pointer blueprint){
m_Blueprint = blueprint;
}
bool Configure();
bool Execute();
......@@ -86,9 +95,6 @@ namespace selx
AnyFileWriterType::Pointer GetOutputFileWriter(const ComponentNameType&);
protected:
Overlord();
virtual ~Overlord() {};
public: // temporarily from private to public during refactoring SuperElastixFilter.
void ApplyNodeConfiguration();
void ApplyConnectionConfiguration();
......@@ -104,7 +110,8 @@ namespace selx
bool ReconnectTransforms();
//TODO make const correct
//Blueprint::ConstPointer m_Blueprint;
BlueprintType::Pointer m_Blueprint;
//Blueprint const * m_Blueprint;
Blueprint::Pointer m_Blueprint;
ComponentSelectorContainerType m_ComponentSelectorContainer;
bool m_isConfigured;
bool m_allUniqueComponents;
......
......@@ -191,7 +191,7 @@ namespace selx
SourceInterface* provingSourceInterface = dynamic_cast<SourceInterface*> (&(*component));
if (provingSourceInterface == nullptr) // is actually a double-check for sanity: based on criterion cast should be successful
{
itkExceptionMacro("dynamic_cast<SourceInterface*> fails, but based on component criterion it shouldn't")
std::runtime_error::runtime_error("dynamic_cast<SourceInterface*> fails, but based on component criterion it shouldn't");
}
sourceInterfaceMap[componentSelector.first]=provingSourceInterface;
......@@ -217,7 +217,7 @@ namespace selx
SinkInterface* provingSinkInterface = dynamic_cast<SinkInterface*> (&(*component));
if (provingSinkInterface == nullptr) // is actually a double-check for sanity: based on criterion cast should be successful
{
itkExceptionMacro("dynamic_cast<SinkInterface*> fails, but based on component criterion it shouldn't")
std::runtime_error::runtime_error("dynamic_cast<SinkInterface*> fails, but based on component criterion it shouldn't");
}
sinkInterfaceMap[componentSelector.first] = provingSinkInterface;
}
......@@ -277,7 +277,7 @@ namespace selx
RunRegistrationInterface* providingRunRegistrationInterface = dynamic_cast<RunRegistrationInterface*> (&(*runRegistrationComponent));
if (providingRunRegistrationInterface == nullptr) // is actually a double-check for sanity: based on criterion cast should be successful
{
itkExceptionMacro("dynamic_cast<RunRegistrationInterface*> fails, but based on component criterion it shouldn't")
std::runtime_error::runtime_error("dynamic_cast<RunRegistrationInterface*> fails, but based on component criterion it shouldn't");
}
// For testing purposes, all Sources are connected to an ImageWriter
providingRunRegistrationInterface->RunRegistration();
......@@ -293,7 +293,7 @@ namespace selx
AfterRegistrationInterface* providingAfterRegistrationInterface = dynamic_cast<AfterRegistrationInterface*> (&(*afterRegistrationComponent));
if (providingAfterRegistrationInterface == nullptr) // is actually a double-check for sanity: based on criterion cast should be successful
{
itkExceptionMacro("dynamic_cast<AfterRegistrationInterface*> fails, but based on component criterion it shouldn't")
std::runtime_error::runtime_error("dynamic_cast<AfterRegistrationInterface*> fails, but based on component criterion it shouldn't");
}
// For testing purposes, all Sources are connected to an ImageWriter
providingAfterRegistrationInterface->AfterRegistration();
......@@ -318,7 +318,7 @@ namespace selx
ReconnectTransformInterface* providingInterface = dynamic_cast<ReconnectTransformInterface*> (component.GetPointer());
if (providingInterface == nullptr) // is actually a double-check for sanity: based on criterion cast should be successful
{
itkExceptionMacro("dynamic_cast<ReconnectTransformInterface*> fails, but based on component criterion it shouldn't")
std::runtime_error::runtime_error("dynamic_cast<ReconnectTransformInterface*> fails, but based on component criterion it shouldn't");
}
// For testing purposes, all Sources are connected to an ImageWriter
providingInterface->ReconnectTransform();
......@@ -355,7 +355,9 @@ namespace selx
SourceInterfaceMapType sources = this->GetSourceInterfaces();
if (sources.count(inputName) != 1)
{
itkExceptionMacro(<< "No Source component found by name:" << inputName);
std::stringstream msg;
msg << "No Source component found by name:" << inputName;
std::runtime_error::runtime_error(msg.str());
}
return sources[inputName]->GetInputFileReader();
......@@ -366,7 +368,9 @@ namespace selx
SinkInterfaceMapType sinks = this->GetSinkInterfaces();
if (sinks.count(outputName) != 1)
{
itkExceptionMacro(<< "No Sink component found by name:" << outputName);
std::stringstream msg;
msg << "No Sink component found by name : " << outputName;
std::runtime_error::runtime_error(msg.str());
}
return sinks[outputName]->GetOutputFileWriter();
......@@ -377,7 +381,9 @@ namespace selx
SinkInterfaceMapType sinks = this->GetSinkInterfaces();
if (sinks.count(outputName) != 1)
{
itkExceptionMacro(<< "No Sink component found by name:" << outputName);
std::stringstream msg;
msg << "No Sink component found by name : " << outputName;
std::runtime_error::runtime_error(msg.str());
}
return sinks[outputName]->GetInitializedOutput();
......
......@@ -34,7 +34,7 @@ namespace selx {
class OverlordTest : public ::testing::Test {
public:
typedef Overlord::Pointer OverlordPointerType;
//typedef Overlord::Pointer OverlordPointerType;
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ConstPointer BlueprintConstPointerType;
typedef Blueprint::ParameterMapType ParameterMapType;
......@@ -72,19 +72,20 @@ public:
itk::ObjectFactoryBase::UnRegisterAllFactories();
}
//std::unique_ptr<Blueprint> blueprint(new Blueprint());
BlueprintPointerType blueprint;
Overlord::Pointer overlord;
//Overlord::Pointer overlord;
};
TEST_F( OverlordTest, Create )
{
EXPECT_NO_THROW( overlord = Overlord::New() );
std::unique_ptr<Overlord> overlord(new Overlord());
EXPECT_NO_THROW( overlord->SetBlueprint(blueprint) );
}
TEST_F(OverlordTest, Configure)
{
overlord = Overlord::New();
std::unique_ptr<Overlord> overlord(new Overlord());
overlord->SetBlueprint(blueprint);
bool allUniqueComponents;
EXPECT_NO_THROW(allUniqueComponents = overlord->Configure());
......
......@@ -68,7 +68,7 @@ private:
//TODO make const correct
//Blueprint::ConstPointer m_Blueprint;
Blueprint::Pointer m_Blueprint;
Overlord::Pointer m_Overlord;
std::unique_ptr<Overlord> m_Overlord;
};
} // namespace elx
......
......@@ -15,7 +15,7 @@ namespace selx
SuperElastixFilter< ComponentTypeList >
::SuperElastixFilter( void )
{
this->m_Overlord = Overlord::New();
this->m_Overlord = std::unique_ptr<Overlord> (new Overlord());
RegisterFactoriesByTypeList<ComponentTypeList>::Register();
......
......@@ -45,7 +45,6 @@ namespace selx {
class itkImageFilterTest : public ::testing::Test {
public:
typedef Overlord::Pointer OverlordPointerType;
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ConstPointer BlueprintConstPointerType;
typedef Blueprint::ParameterMapType ParameterMapType;
......@@ -116,7 +115,7 @@ public:
}
BlueprintPointerType blueprint;
Overlord::Pointer overlord;
};
TEST_F(itkImageFilterTest, Run)
......
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