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

WIP:

parent f1b3fdef
......@@ -62,6 +62,9 @@ public:
NetworkBuilder();
virtual ~NetworkBuilder() {};
virtual std::unique_ptr<NetworkBuilderBase> ConstructNewDerivedInstance(void);
virtual bool AddBlueprint(const std::unique_ptr<Blueprint> &blueprint);
/** Read configuration at the blueprints nodes and edges and return true if all components could be uniquely selected*/
......
......@@ -29,6 +29,15 @@ NetworkBuilder<ComponentList>::NetworkBuilder() : m_isConfigured(false), m_Bluep
{
}
template< typename ComponentList >
std::unique_ptr<NetworkBuilderBase>
NetworkBuilder<ComponentList>::ConstructNewDerivedInstance(void)
{
return std::unique_ptr<NetworkBuilderBase>(new NetworkBuilder<ComponentList>);
}
template< typename ComponentList >
bool
NetworkBuilder<ComponentList>::AddBlueprint(const std::unique_ptr<Blueprint> &blueprint)
......
......@@ -64,6 +64,9 @@ public:
virtual ~NetworkBuilderBase() {};
/** To create a derived NetworkBuilder from a NetworkBuilderBase pointer without knowing the template arguments of the derived*/
virtual std::unique_ptr<NetworkBuilderBase> ConstructNewDerivedInstance(void) = 0;
virtual bool AddBlueprint(const std::unique_ptr<Blueprint> &blueprint) = 0;
/** Read configuration at the blueprints nodes and edges and return true if all components could be uniquely selected*/
......
......@@ -85,22 +85,19 @@ SuperElastixFilter
// the component selectors until no more unique components can be found.
if (!this->m_Blueprint)
{
//TODO: remove this check here by making m_Blueprint primary input
itkExceptionMacro(<< "Setting a Blueprint is required first.")
}
if (this->m_Blueprint->Modified())
if (this->m_Blueprint->GetMTime() > this->GetMTime())
{
// Was m_Blueprint modified by Set() or by AddBlueprint?
// Was Blueprint modified by Set() or by AddBlueprint?
// delete previous blueprint and start all over with new one
m_NetworkBuilder = m_NetworkBuilder->ConstructNewDerivedInstance();
this->m_NetworkBuilder->AddBlueprint(this->m_Blueprint->Get());
}
this->m_NetworkBuilder->AddBlueprint(this->m_Blueprint->Get());
this->m_AllUniqueComponents = this->m_NetworkBuilder->Configure();
if (this->m_BlueprintConnectionModified == true)
{
//TODO:
}
if( ( m_InputConnectionModified == true ) || ( this->m_BlueprintConnectionModified == true ) )
{
......
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