Commit 20076dbd authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: Networkbuilder handles named parallel connections

parent 316bf229
......@@ -169,26 +169,23 @@ BlueprintImpl
return false;
}
if( this->ConnectionExists( upstream, downstream ) )
{
// a connection exists, but multiple parallel connections are allowed. Depending on the existing names, it should be added or overridden
// Multiple parallel connections are allowed. If a connection with the name "name" exists it should be overridden, otherwise just added.
boost::graph_traits<GraphType>::out_edge_iterator ei, ei_end;
// too bad edge_range_by_label doesn't exist
boost::tie(ei, ei_end) = boost::edge_range(this->m_Graph.vertex(upstream), this->m_Graph.vertex(downstream), this->m_Graph.graph());
boost::graph_traits<GraphType>::out_edge_iterator ei, ei_end;
// too bad edge_range_by_label doesn't exist
boost::tie(ei, ei_end) = boost::edge_range(this->m_Graph.vertex(upstream), this->m_Graph.vertex(downstream), this->m_Graph.graph());
for (; ei != ei_end; ++ei)
for (; ei != ei_end; ++ei)
{
auto existingName = boost::get(&ConnectionPropertyType::name, this->m_Graph.graph(), *ei);
if (name == existingName)
{
auto existingName = boost::get(&ConnectionPropertyType::name, this->m_Graph.graph(), *ei);
if (name == existingName)
{
// override previous parameterMap
boost::put(&ConnectionPropertyType::parameterMap, this->m_Graph.graph(), *ei, parameterMap);
return true;
}
// override previous parameterMap
boost::put(&ConnectionPropertyType::parameterMap, this->m_Graph.graph(), *ei, parameterMap);
return true;
}
} // no existing connections named "name" were found.
}// no existing connections named "name" were found.
boost::add_edge_by_label(upstream, downstream, { name, parameterMap }, this->m_Graph);
return true;
}
......@@ -348,60 +345,64 @@ BlueprintImpl
{
for( auto incomingName : other.GetInputNames( componentName ) )
{
// Does other blueprint have a connection that already exists?
if( this->ConnectionExists( incomingName, componentName ) )
for (auto connectionName : other.GetConnectionNames(incomingName, componentName ) )
{
// Connection exists, check if properties can be merged
auto ownProperties = this->GetConnection( incomingName, componentName );
auto othersProperties = other.GetConnection( incomingName, componentName );
for( auto const & othersEntry : othersProperties )
// Does other blueprint have a connection that already exists?
if (this->ConnectionExists(incomingName, componentName, connectionName ))
{
// Does other use a property key that already exists in this component?
if( ownProperties.count( othersEntry.first ) )
// Connection exists, check if properties can be merged
auto ownProperties = this->GetConnection( incomingName, componentName, connectionName );
auto othersProperties = other.GetConnection( incomingName, componentName, connectionName );
for( auto const & othersEntry : othersProperties )
{
auto && ownValues = ownProperties[ othersEntry.first ];
auto && otherValues = othersEntry.second;
// Are the property values equal?
if( ownValues.size() != otherValues.size() )
{
// No, based on the number of values we see that it is different. Blueprints cannot be Composed
this->m_Graph = graph_backup;
return false;
}
else
// Does other use a property key that already exists in this component?
if( ownProperties.count( othersEntry.first ) )
{
ParameterValueType::const_iterator ownValue;
ParameterValueType::const_iterator otherValue;
for( ownValue = ownValues.begin(), otherValue = otherValues.begin(); ownValue != ownValues.end(); ++ownValue, ++otherValue )
auto && ownValues = ownProperties[ othersEntry.first ];
auto && otherValues = othersEntry.second;
// Are the property values equal?
if( ownValues.size() != otherValues.size() )
{
if( *otherValue != *ownValue )
// No, based on the number of values we see that it is different. Blueprints cannot be Composed
this->m_Graph = graph_backup;
return false;
}
else
{
ParameterValueType::const_iterator ownValue;
ParameterValueType::const_iterator otherValue;
for( ownValue = ownValues.begin(), otherValue = otherValues.begin(); ownValue != ownValues.end(); ++ownValue, ++otherValue )
{
// No, at least one value is different. Blueprints cannot be Composed
this->m_Graph = graph_backup;
return false;
if( *otherValue != *ownValue )
{
// No, at least one value is different. Blueprints cannot be Composed
this->m_Graph = graph_backup;
return false;
}
}
}
}
}
else
{
// Property key doesn't exist yet, add entry to this component
auto ownProperties = this->GetConnection( incomingName, componentName );
ownProperties[ othersEntry.first ] = othersEntry.second;
this->SetConnection( incomingName, componentName, ownProperties );
}
else
{
// Property key doesn't exist yet, add entry to this component
auto ownProperties = this->GetConnection( incomingName, componentName, connectionName );
ownProperties[ othersEntry.first ] = othersEntry.second;
this->SetConnection( incomingName, componentName, ownProperties, connectionName );
return true;
}
} // end loop otherProperties
}
else // connection with connectionName does not exist
{
// Create Connection copying properties of other
this->SetConnection( incomingName, componentName, other.GetConnection( incomingName, componentName, connectionName ), connectionName );
}
}
else
{
// Create Component copying properties of other
this->SetConnection( incomingName, componentName, other.GetConnection( incomingName, componentName ) );
}
}
}
return true;
}
BlueprintImpl::ComponentNamesType
......@@ -435,6 +436,25 @@ BlueprintImpl
return container;
}
BlueprintImpl::ConnectionNamesType
BlueprintImpl
::GetConnectionNames(const ComponentNameType upstream, const ComponentNameType downstream) const
{
ConnectionNamesType container;
boost::graph_traits<GraphType>::out_edge_iterator ei, ei_end;
// too bad edge_range_by_label doesn't exist
boost::tie(ei, ei_end) = boost::edge_range(this->m_Graph.vertex(upstream), this->m_Graph.vertex(downstream), this->m_Graph.graph());
for (; ei != ei_end; ++ei)
{
container.push_back(boost::get(&ConnectionPropertyType::name, this->m_Graph.graph(), *ei));
}
return container;
}
void
BlueprintImpl
::Write( const std::string filename )
......
......@@ -120,13 +120,13 @@ public:
// SetConnection with parameters parameterMap between components upstream and downstream.
// The connection name is to distinguish parallel connections. For single connections name = "" is typical.
bool SetConnection( ComponentNameType upstream, ComponentNameType downstream, ParameterMapType parameterMap, ConnectionNameType name = "");
bool SetConnection( ComponentNameType upstream, ComponentNameType downstream, ParameterMapType parameterMap, ConnectionNameType name );
ParameterMapType GetConnection( ComponentNameType upstream, ComponentNameType downstream, ConnectionNameType name = "" ) const;
ParameterMapType GetConnection( ComponentNameType upstream, ComponentNameType downstream, ConnectionNameType name ) const;
bool DeleteConnection( ComponentNameType upstream, ComponentNameType downstream, ConnectionNameType name = "" );
bool DeleteConnection( ComponentNameType upstream, ComponentNameType downstream, ConnectionNameType name );
bool ConnectionExists( ComponentNameType upstream, ComponentNameType downstream, ConnectionNameType name = "" ) const;
bool ConnectionExists( ComponentNameType upstream, ComponentNameType downstream, ConnectionNameType name ) const;
bool ComposeWith( const BlueprintImpl & other );
......@@ -136,6 +136,9 @@ public:
// Returns a vector of the Component names at the outgoing direction
ComponentNamesType GetOutputNames( const ComponentNameType name ) const;
// Returns a vector of the connection names between upstream and downstream
ComponentNamesType GetConnectionNames(const ComponentNameType upstream, const ComponentNameType downstream) const;
void Write( const std::string filename );
void MergeFromFile(const std::string & filename);
......
......@@ -186,48 +186,50 @@ NetworkBuilder< ComponentList >::ApplyConnectionConfiguration()
{
for( auto const & acceptingComponentName : this->m_Blueprint.GetOutputNames( providingComponentName ) )
{
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( providingComponentName, acceptingComponentName );
// TODO: #110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
for( const auto& connectionProperty : connectionProperties )
for ( auto const & connectionName : this->m_Blueprint.GetConnectionNames( providingComponentName, acceptingComponentName ) )
{
assert( connectionProperty.second.size() <= 1 );
if( connectionProperty.second.size() == 1 ) {
interfaceCriteria[connectionProperty.first] = connectionProperty.second[0];
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( providingComponentName, acceptingComponentName, connectionName );
// TODO: #110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
for( const auto& connectionProperty : connectionProperties )
{
assert( connectionProperty.second.size() <= 1 );
if( connectionProperty.second.size() == 1 ) {
interfaceCriteria[connectionProperty.first] = connectionProperty.second[0];
}
}
}
this->m_ComponentSelectorContainer[ providingComponentName ]->AddProvidingInterfaceCriteria( interfaceCriteria );
this->m_Logger.Log(LogLevel::DBG,
"Finding component for '{0}': {1} component(s) satisfies 'ProvidingInterface' {2} and previous criteria.",
providingComponentName,
this->m_ComponentSelectorContainer[providingComponentName]->NumberOfComponents(),
this->m_Logger << interfaceCriteria );
this->m_ComponentSelectorContainer[ acceptingComponentName ]->AddAcceptingInterfaceCriteria( interfaceCriteria );
this->m_Logger.Log(LogLevel::DBG,
"Finding component for '{0}': {1} component(s) satisfies 'AcceptingInterface' {2} and previous criteria.",
acceptingComponentName,
this->m_ComponentSelectorContainer[acceptingComponentName]->NumberOfComponents(),
this->m_Logger << interfaceCriteria );
if( this->m_ComponentSelectorContainer[ acceptingComponentName ]->NumberOfComponents() == 0 )
{
std::string msg = acceptingComponentName + "does not provide any connections with the given criteria.";
this->m_Logger.Log( LogLevel::ERR, msg );
throw std::runtime_error( msg );
}
// TODO: connectionName in log message
this->m_ComponentSelectorContainer[ providingComponentName ]->AddProvidingInterfaceCriteria( interfaceCriteria );
this->m_Logger.Log(LogLevel::DBG,
"Finding component for '{0}': {1} component(s) satisfies 'ProvidingInterface' {2} and previous criteria.",
providingComponentName,
this->m_ComponentSelectorContainer[providingComponentName]->NumberOfComponents(),
this->m_Logger << interfaceCriteria );
this->m_ComponentSelectorContainer[ acceptingComponentName ]->AddAcceptingInterfaceCriteria( interfaceCriteria );
this->m_Logger.Log(LogLevel::DBG,
"Finding component for '{0}': {1} component(s) satisfies 'AcceptingInterface' {2} and previous criteria.",
acceptingComponentName,
this->m_ComponentSelectorContainer[acceptingComponentName]->NumberOfComponents(),
this->m_Logger << interfaceCriteria );
if( this->m_ComponentSelectorContainer[ acceptingComponentName ]->NumberOfComponents() == 0 )
{
std::string msg = acceptingComponentName + "does not provide any connections with the given criteria.";
this->m_Logger.Log( LogLevel::ERR, msg );
throw std::runtime_error( msg );
}
if( this->m_ComponentSelectorContainer[ providingComponentName ]->NumberOfComponents() == 0 )
{
std::string msg = providingComponentName + "does not accept any connections with the given criteria.";
this->m_Logger.Log( LogLevel::ERR, msg );
if( this->m_ComponentSelectorContainer[ providingComponentName ]->NumberOfComponents() == 0 )
{
std::string msg = providingComponentName + "does not accept any connections with the given criteria.";
this->m_Logger.Log( LogLevel::ERR, msg );
}
}
}
}
return;
}
......@@ -251,30 +253,34 @@ NetworkBuilder< ComponentList >::PropagateConnectionsWithUniqueComponents()
// if the accepting component is also not uniquely selected, we do not try to check all valid combinations, since this would make the handshake logic too complicated
if( std::find( nonUniqueComponentNames.begin(), nonUniqueComponentNames.end(), acceptingComponentName ) == nonUniqueComponentNames.end() )
{
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( componentName, acceptingComponentName );
// TODO: #110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
for( const auto& connectionProperty : connectionProperties )
for ( const auto & connectionName : this->m_Blueprint.GetConnectionNames( componentName, acceptingComponentName ) )
{
assert( connectionProperty.second.size() <= 1 );
if( connectionProperty.second.size() == 1 ) {
interfaceCriteria[connectionProperty.first] = connectionProperty.second[0];
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( componentName, acceptingComponentName, connectionName );
// TODO: #110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
for( const auto& connectionProperty : connectionProperties )
{
assert( connectionProperty.second.size() <= 1 );
if( connectionProperty.second.size() == 1 ) {
interfaceCriteria[connectionProperty.first] = connectionProperty.second[0];
}
}
}
auto acceptingComponent = this->m_ComponentSelectorContainer[ acceptingComponentName ]->GetComponent();
const unsigned int beforeCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log( LogLevel::DBG, "Propagating 'ProvidingInterface' properties from '{0}' to {2} components at '{1}' ... ", componentName, acceptingComponentName, beforeCriteria );
this->m_ComponentSelectorContainer[ componentName ]->RequireProvidingInterfaceTo( acceptingComponent, interfaceCriteria );
const unsigned int afterCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log( LogLevel::DBG, "Propagating 'ProvidingInterface' properties from '{0}' to {2} components at '{1}' ... Done. Reduced '{1}' to {3} components", componentName, acceptingComponentName, beforeCriteria, afterCriteria );
if( beforeCriteria > afterCriteria )
{
anySelectionNarrowed = true;
// TODO: connectionName in log message
auto acceptingComponent = this->m_ComponentSelectorContainer[ acceptingComponentName ]->GetComponent();
const unsigned int beforeCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log( LogLevel::DBG, "Propagating 'ProvidingInterface' properties from '{0}' to {2} components at '{1}' ... ", componentName, acceptingComponentName, beforeCriteria );
this->m_ComponentSelectorContainer[ componentName ]->RequireProvidingInterfaceTo( acceptingComponent, interfaceCriteria );
const unsigned int afterCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log( LogLevel::DBG, "Propagating 'ProvidingInterface' properties from '{0}' to {2} components at '{1}' ... Done. Reduced '{1}' to {3} components", componentName, acceptingComponentName, beforeCriteria, afterCriteria );
if( beforeCriteria > afterCriteria )
{
anySelectionNarrowed = true;
}
this->m_Logger.Log( LogLevel::TRC, "Selection Narrowed: {} ", anySelectionNarrowed );
}
this->m_Logger.Log( LogLevel::TRC, "Selection Narrowed: {} ", anySelectionNarrowed );
}
}
// check all components that provide to component "componentName"
......@@ -283,32 +289,35 @@ NetworkBuilder< ComponentList >::PropagateConnectionsWithUniqueComponents()
// if the providing component is also not uniquely selected, we do not try to check all valid combinations, since this would make the handshake logic too complicated
if( std::find( nonUniqueComponentNames.begin(), nonUniqueComponentNames.end(), providingComponentName ) == nonUniqueComponentNames.end() )
{
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( providingComponentName, componentName );
// TODO:#110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
for( const auto& connectionProperty : connectionProperties )
for (const auto & connectionName : this->m_Blueprint.GetConnectionNames( providingComponentName, componentName ) )
{
assert( connectionProperty.second.size() <= 1 );
if( connectionProperty.second.size() == 1 ) {
interfaceCriteria[connectionProperty.first] = connectionProperty.second[0];
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( providingComponentName, componentName, connectionName);
// TODO:#110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
for( const auto& connectionProperty : connectionProperties )
{
assert( connectionProperty.second.size() <= 1 );
if( connectionProperty.second.size() == 1 ) {
interfaceCriteria[connectionProperty.first] = connectionProperty.second[0];
}
}
}
// TODO(FB): Use this to provide more info to user
auto providingComponent = this->m_ComponentSelectorContainer[ providingComponentName ]->GetComponent();
// TODO(FB): Use this to provide more info to user
auto providingComponent = this->m_ComponentSelectorContainer[ providingComponentName ]->GetComponent();
const unsigned int beforeCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log(LogLevel::DBG, "Propagating 'AcceptingInterface' properties from '{0}' to {2} components at '{1}' ... ", componentName, providingComponentName, beforeCriteria);
this->m_ComponentSelectorContainer[ componentName ]->RequireAcceptingInterfaceFrom( providingComponent, interfaceCriteria );
const unsigned int afterCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log(LogLevel::DBG, "Propagating 'AcceptingInterface' properties from '{0}' to {2} components at '{1}' ... Done. Reduced '{1}' to {3} components", componentName, providingComponentName, beforeCriteria, afterCriteria);
const unsigned int beforeCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log(LogLevel::DBG, "Propagating 'AcceptingInterface' properties from '{0}' to {2} components at '{1}' ... ", componentName, providingComponentName, beforeCriteria);
this->m_ComponentSelectorContainer[ componentName ]->RequireAcceptingInterfaceFrom( providingComponent, interfaceCriteria );
const unsigned int afterCriteria = this->m_ComponentSelectorContainer[ componentName ]->NumberOfComponents();
this->m_Logger.Log(LogLevel::DBG, "Propagating 'AcceptingInterface' properties from '{0}' to {2} components at '{1}' ... Done. Reduced '{1}' to {3} components", componentName, providingComponentName, beforeCriteria, afterCriteria);
if( beforeCriteria > afterCriteria )
{
anySelectionNarrowed = true;
if( beforeCriteria > afterCriteria )
{
anySelectionNarrowed = true;
}
this->m_Logger.Log( LogLevel::TRC, "Selection Narrowed: {} ", anySelectionNarrowed );
}
this->m_Logger.Log( LogLevel::TRC, "Selection Narrowed: {} ", anySelectionNarrowed );
}
}
}
......@@ -330,26 +339,42 @@ NetworkBuilder< ComponentList >::ConnectComponents()
ComponentBase::Pointer providingComponent = this->m_ComponentSelectorContainer[ providingComponentName ]->GetComponent();
ComponentBase::Pointer acceptingComponent = this->m_ComponentSelectorContainer[ acceptingComponentName ]->GetComponent();
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( providingComponentName, acceptingComponentName );
// multiple parallel 'named' connections between 2 components can exist
auto connectionNames = this->m_Blueprint.GetConnectionNames( providingComponentName, acceptingComponentName );
for ( auto connectionName : connectionNames )
{
BlueprintImpl::ParameterMapType connectionProperties = this->m_Blueprint.GetConnection( providingComponentName, acceptingComponentName, connectionName );
// TODO:#110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
std::for_each( connectionProperties.begin(), connectionProperties.end(), [ &interfaceCriteria ](
BlueprintImpl::ParameterMapType::value_type kv ) mutable {
if( kv.second.size() > 0 )
{
interfaceCriteria[ kv.first ] = kv.second[ 0 ];
}
} );
// TODO:#110
ComponentBase::InterfaceCriteriaType interfaceCriteria;
std::for_each( connectionProperties.begin(), connectionProperties.end(), [ &interfaceCriteria ](
BlueprintImpl::ParameterMapType::value_type kv ) mutable {
if( kv.second.size() > 0 )
{
interfaceCriteria[ kv.first ] = kv.second[ 0 ];
}
} );
this->m_Logger.Log(LogLevel::DBG, "Connect '{0}' to '{1}' ... ", providingComponentName, acceptingComponentName );
int numberOfConnections = acceptingComponent->AcceptConnectionFrom( providingComponent, interfaceCriteria );
this->m_Logger.Log(LogLevel::DBG, "Connect '{0}' to '{1}' ... Done, by {2} interface(s).", providingComponentName, acceptingComponentName, numberOfConnections );
std::string message1, message2;
if (connectionNames.size() > 1) // specialize log messages if multiple parallel connections exist
{
message1 = "Connect '{0}' to '{1}' by connection '{2}' ... ";
message2 = "Connect '{0}' to '{1}' by connection '{3}' ... Done, by {2} interface(s).";
}
else
{
message1 = "Connect '{0}' to '{1}' ... ";
message2 = "Connect '{0}' to '{1}' ... Done, by {2} interface(s).";
if( numberOfConnections == 0 )
{
isAllSuccess = false;
this->m_Logger.Log( LogLevel::CRT, "Connection from '{0}' to '{1}' was specified but no compatible interfaces were found.", providingComponentName, acceptingComponentName);
}
this->m_Logger.Log(LogLevel::DBG, message1 , providingComponentName, acceptingComponentName, connectionName);
int numberOfConnections = acceptingComponent->AcceptConnectionFrom(providingComponent, interfaceCriteria);
this->m_Logger.Log(LogLevel::DBG, message2 , providingComponentName, acceptingComponentName, numberOfConnections, connectionName);
if( numberOfConnections == 0 )
{
isAllSuccess = false;
this->m_Logger.Log( LogLevel::CRT, "Connection from '{0}' to '{1}' was specified but no compatible interfaces were found.", providingComponentName, acceptingComponentName);
}
}
}
}
......
......@@ -64,7 +64,7 @@ public:
ParameterMapType metric2TransformConnectionParameters;
metric2TransformConnectionParameters[ "NameOfInterface" ] = { "TransformedImageInterface" };
blueprint->SetConnection( "Transform", "Metric", metric2TransformConnectionParameters );
blueprint->SetConnection( "Transform", "Metric", metric2TransformConnectionParameters, "" );
logger->SetLogLevel( LogLevel::TRC );
}
......@@ -209,39 +209,39 @@ TEST_F( NetworkBuilderTest, DeduceComponentsFromConnections )
ParameterMapType connection1Parameters;
connection1Parameters[ "NameOfInterface" ] = { "itkImageFixedInterface" };
blueprint->SetConnection( "FixedImageSource", "RegistrationMethod", connection1Parameters );
blueprint->SetConnection( "FixedImageSource", "RegistrationMethod", connection1Parameters, "" );
ParameterMapType connection2Parameters;
connection2Parameters[ "NameOfInterface" ] = { "itkImageMovingInterface" };
blueprint->SetConnection( "MovingImageSource", "RegistrationMethod", connection2Parameters );
blueprint->SetConnection( "MovingImageSource", "RegistrationMethod", connection2Parameters, "" );
ParameterMapType connection3Parameters;
connection3Parameters[ "NameOfInterface" ] = { "itkImageInterface" };
blueprint->SetConnection( "ResampleFilter", "ResultImageSink", connection3Parameters );
blueprint->SetConnection( "ResampleFilter", "ResultImageSink", connection3Parameters, "" );
ParameterMapType connection4Parameters;
connection4Parameters[ "NameOfInterface" ] = { "DisplacementFieldItkImageSourceInterface" };
blueprint->SetConnection( "TransformDisplacementFilter", "ResultDisplacementFieldSink", connection4Parameters );
blueprint->SetConnection( "TransformDisplacementFilter", "ResultDisplacementFieldSink", connection4Parameters, "" );
ParameterMapType connection5Parameters;
connection5Parameters[ "NameOfInterface" ] = { "itkMetricv4Interface" };
blueprint->SetConnection( "Metric", "RegistrationMethod", connection5Parameters );
blueprint->SetConnection( "FixedImageSource", "Transform", { {} } );
blueprint->SetConnection( "Transform", "RegistrationMethod", { {} } );
blueprint->SetConnection( "FixedImageSource", "TransformResolutionAdaptor", { {} } );
blueprint->SetConnection( "TransformResolutionAdaptor", "RegistrationMethod", { {} } );
blueprint->SetConnection( "Optimizer", "RegistrationMethod", { { "InternalComputationValueType", { "double" } } } );
blueprint->SetConnection( "RegistrationMethod", "TransformDisplacementFilter", { {} } );
blueprint->SetConnection( "FixedImageSource", "TransformDisplacementFilter", { {} } );
blueprint->SetConnection( "RegistrationMethod", "ResampleFilter", { {} } );
blueprint->SetConnection( "FixedImageSource", "ResampleFilter", { {} } );
blueprint->SetConnection( "MovingImageSource", "ResampleFilter", { { keys::NameOfInterface, { "itkImageMovingInterface" } } } );
blueprint->SetConnection( "RegistrationMethod", "Controller", { {} } ); //RunRegistrationInterface
blueprint->SetConnection( "ResampleFilter", "Controller", { {} } ); //ReconnectTransformInterface
blueprint->SetConnection( "TransformDisplacementFilter", "Controller", { {} } ); //ReconnectTransformInterface
blueprint->SetConnection( "Metric", "RegistrationMethod", connection5Parameters, "" );
blueprint->SetConnection( "FixedImageSource", "Transform", { {} }, "" );
blueprint->SetConnection( "Transform", "RegistrationMethod", { {} }, "" );
blueprint->SetConnection( "FixedImageSource", "TransformResolutionAdaptor", { {} }, "" );
blueprint->SetConnection( "TransformResolutionAdaptor", "RegistrationMethod", { {} }, "" );
blueprint->SetConnection( "Optimizer", "RegistrationMethod", { { "InternalComputationValueType", { "double" } } }, "" );
blueprint->SetConnection( "RegistrationMethod", "TransformDisplacementFilter", { {} }, "" );
blueprint->SetConnection( "FixedImageSource", "TransformDisplacementFilter", { {} }, "" );
blueprint->SetConnection( "RegistrationMethod", "ResampleFilter", { {} }, "" );
blueprint->SetConnection( "FixedImageSource", "ResampleFilter", { {} }, "" );
blueprint->SetConnection( "MovingImageSource", "ResampleFilter", { { keys::NameOfInterface, { "itkImageMovingInterface" } } }, "" );
blueprint->SetConnection( "RegistrationMethod", "Controller", { {} }, "" ); //RunRegistrationInterface
blueprint->SetConnection( "ResampleFilter", "Controller", { {} }, "" ); //ReconnectTransformInterface
blueprint->SetConnection( "TransformDisplacementFilter", "Controller", { {} }, "" ); //ReconnectTransformInterface
std::unique_ptr< NetworkBuilderBase > networkBuilder( new NetworkBuilder< RegisterComponents >( *logger, *blueprint ) );
bool allUniqueComponents;
......
Markdown is supported
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