Commit 8b0673e8 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: removed all uses of 'index' in Blueprint API

parent fe474e1a
......@@ -63,9 +63,10 @@ public:
typedef boost::graph_traits< GraphType >::out_edge_iterator OutputIteratorType;
typedef std::pair< OutputIteratorType, OutputIteratorType > OutputIteratorPairType;
// Interface for managing components
ComponentIndexType AddComponent( ComponentNameType name);
ComponentIndexType AddComponent(ComponentNameType name, ParameterMapType parameterMap);
bool AddComponent( ComponentNameType name);
bool AddComponent(ComponentNameType name, ParameterMapType parameterMap);
ParameterMapType GetComponent(ComponentNameType name);
void SetComponent(ComponentNameType, ParameterMapType parameterMap);
......@@ -92,12 +93,14 @@ public:
bool DeleteConnection(ComponentNameType upstream, ComponentNameType downstream);
bool ConnectionExists(ComponentNameType upstream, ComponentNameType downstream);
// TODO: can we really regard this as deprecated? Remove then.
// Returns iterator for all connections in the graph
ConnectionIteratorPairType GetConnectionIterator(void);
//ConnectionIteratorPairType GetConnectionIterator(void);
// Returns the outgoing connections from a component in the graph,
// i.e. all components that reads data from given component
OutputIteratorPairType GetOutputIterator(const ComponentNameType name);
//OutputIteratorPairType GetOutputIterator(const ComponentNameType name);
// Returns a vector of the Component names at the outgoing direction
// TODO: should this be an iterator over the names?
......@@ -106,7 +109,7 @@ public:
void WriteBlueprint( const std::string filename );
private:
ConnectionIndexType GetConnectionIndex( ComponentNameType upsteam, ComponentNameType downstream );
GraphType m_Graph;
......
......@@ -40,26 +40,24 @@ namespace selx {
return parameterMaplabel_writer<ParameterMapType>(n);
}
Blueprint::ComponentIndexType
bool
Blueprint
::AddComponent(ComponentNameType name)
{
this->Modified();
ComponentIndexType index = this->m_Graph.add_vertex(name, { name, { {} } });
// Return component index so component can retrieved at a later time
return index;
// Returns true is addition was successful
return this->m_Graph.insert_vertex(name, { name, { {} } }).second;
}
Blueprint::ComponentIndexType
bool
Blueprint
::AddComponent(ComponentNameType name, ParameterMapType parameterMap)
{
this->Modified();
ComponentIndexType index = this->m_Graph.add_vertex(name, { name, parameterMap });
// Return component index so component can retrieved at a later time
return index;
// Returns true is addition was successful
return this->m_Graph.insert_vertex(name, { name, parameterMap }).second;
}
Blueprint::ParameterMapType
......@@ -171,19 +169,20 @@ Blueprint
return boost::edge_by_label( upstream, downstream, this->m_Graph).second;
}
Blueprint::ConnectionIteratorPairType
// TODO: can we really regard this as deprecated? Remove then.
/*
Blueprint::ConnectionIteratorPairType
Blueprint
::GetConnectionIterator(void) {
return boost::edges(this->m_Graph);
}
Blueprint::OutputIteratorPairType
Blueprint::OutputIteratorPairType
Blueprint
::GetOutputIterator(const ComponentNameType name) {
return boost::out_edges(this->m_Graph.vertex(name), this->m_Graph);
}
*/
Blueprint::ComponentNamesType
Blueprint
::GetOutputNames(const ComponentNameType name) {
......
......@@ -8,7 +8,6 @@ class BlueprintTest : public ::testing::Test {
public:
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ComponentIndexType ComponentIndexType;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
......@@ -24,17 +23,17 @@ TEST_F( BlueprintTest, AddComponent )
BlueprintPointerType blueprint;
EXPECT_NO_THROW( blueprint = Blueprint::New() );
ComponentIndexType index0;
EXPECT_NO_THROW( index0 = blueprint->AddComponent( "MyComponentName" ) );
bool success0;
EXPECT_NO_THROW( success0 = blueprint->AddComponent( "MyComponentName" ) );
ComponentIndexType index1;
EXPECT_NO_THROW(index1 = blueprint->AddComponent("MyComponentName", parameterMap));
bool success1;
EXPECT_NO_THROW( success1 = blueprint->AddComponent("MyComponentName", parameterMap));
}
TEST_F( BlueprintTest, GetComponent )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index = blueprint->AddComponent("MyComponentName", parameterMap);
blueprint->AddComponent("MyComponentName", parameterMap);
ParameterMapType parameterMapTest;
EXPECT_NO_THROW( parameterMapTest = blueprint->GetComponent( "MyComponentName" ) );
......@@ -44,7 +43,7 @@ TEST_F( BlueprintTest, GetComponent )
TEST_F( BlueprintTest, SetComponent )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index = blueprint->AddComponent( "MyComponentName", parameterMap);
blueprint->AddComponent( "MyComponentName", parameterMap);
ParameterMapType parameterMapTest;
EXPECT_NO_THROW(blueprint->SetComponent("MyComponentName", parameterMap));
......@@ -57,7 +56,7 @@ TEST_F( BlueprintTest, SetComponent )
// TEST_F( BlueprintTest, DeleteComponent )
// {
// BlueprintPointerType blueprint = Blueprint::New();
// ComponentIndexType index = blueprint->AddComponent( parameterMap );
// blueprint->AddComponent( parameterMap );
//
// ParameterMapType parameterMapTest;
// EXPECT_NO_THROW( parameterMapTest = blueprint->GetComponent( index ) );
......@@ -71,9 +70,9 @@ TEST_F( BlueprintTest, AddConnection )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index0 = blueprint->AddComponent( "Component0" );
ComponentIndexType index1 = blueprint->AddComponent( "Component1" );
ComponentIndexType index2 = blueprint->AddComponent( "Component2" );
blueprint->AddComponent( "Component0" );
blueprint->AddComponent( "Component1" );
blueprint->AddComponent( "Component2" );
// Connection should not exist
EXPECT_FALSE(blueprint->ConnectionExists("Component0", "Component1"));
......@@ -104,8 +103,8 @@ TEST_F( BlueprintTest, GetConnection )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index0 = blueprint->AddComponent("Component0");
ComponentIndexType index1 = blueprint->AddComponent("Component1");
blueprint->AddComponent("Component0");
blueprint->AddComponent("Component1");
ParameterMapType parameterMapTest0;
EXPECT_TRUE(blueprint->AddConnection("Component0", "Component1", parameterMap));
......@@ -117,8 +116,8 @@ TEST_F( BlueprintTest, SetConnection )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index0 = blueprint->AddComponent("Component0");
ComponentIndexType index1 = blueprint->AddComponent("Component1");
blueprint->AddComponent("Component0");
blueprint->AddComponent("Component1");
blueprint->AddConnection("Component0", "Component1", parameterMap);
ParameterMapType parameterMapTest0;
......@@ -138,8 +137,8 @@ TEST_F( BlueprintTest, DeleteConnection )
{
BlueprintPointerType blueprint = Blueprint::New();
ComponentIndexType index0 = blueprint->AddComponent("Component0");
ComponentIndexType index1 = blueprint->AddComponent("Component1");
blueprint->AddComponent("Component0");
blueprint->AddComponent("Component1");
blueprint->AddConnection("Component0", "Component1");
// Connection should exist
......@@ -161,20 +160,20 @@ TEST_F( BlueprintTest, WriteBlueprint )
component0Parameters["NameOfClass"] = { "MyMetric" };
component0Parameters["Dimensionality"] = { "3" };
component0Parameters["Kernel"] = { "5", "5", "5" };
ComponentIndexType index0 = blueprint->AddComponent("Metric", component0Parameters);
blueprint->AddComponent("Metric", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "MyFiniteDifferenceCalculator" };
component1Parameters["Delta"] = { "0.01" };
ComponentIndexType index1 = blueprint->AddComponent("MetricGradient", component1Parameters);
blueprint->AddComponent("MetricGradient", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "MyOptimizer" };
ComponentIndexType index2 = blueprint->AddComponent("Optimizer", component2Parameters);
blueprint->AddComponent("Optimizer", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "MyTransform" };
ComponentIndexType index3 = blueprint->AddComponent("Transform", component3Parameters);
blueprint->AddComponent("Transform", component3Parameters);
blueprint->AddConnection("Metric", "MetricGradient");
blueprint->AddConnection("MetricGradient", "Optimizer");
......
......@@ -18,7 +18,6 @@ public:
typedef Overlord::Pointer OverlordPointerType;
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ConstPointer BlueprintConstPointerType;
typedef Blueprint::ComponentIndexType ComponentIndexType;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
typedef DataManager DataManagerType;
......@@ -54,22 +53,22 @@ TEST_F(ElastixComponentTest, ImagesOnly)
ParameterMapType component0Parameters;
component0Parameters["NameOfClass"] = { "ElastixComponent" };
component0Parameters["RegistrationSettings"] = { "rigid" };
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
component1Parameters["Dimensionality"] = { "2" }; // should be derived from the inputs
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
component2Parameters["Dimensionality"] = { "2" }; // should be derived from the inputs
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageSinkComponent" };
component3Parameters["Dimensionality"] = { "2" }; // should be derived from the inputs
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType connection1Parameters;
......
......@@ -18,7 +18,6 @@ public:
typedef Overlord::Pointer OverlordPointerType;
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ConstPointer BlueprintConstPointerType;
typedef Blueprint::ComponentIndexType ComponentIndexType;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
......@@ -39,8 +38,8 @@ public:
ParameterMapType transformComponentParameters;
transformComponentParameters["NameOfClass"] = { "TransformComponent1" };
ComponentIndexType index0 = blueprint->AddComponent("Metric", metricComponentParameters);
ComponentIndexType index1 = blueprint->AddComponent("Transform", transformComponentParameters);
blueprint->AddComponent("Metric", metricComponentParameters);
blueprint->AddComponent("Transform", transformComponentParameters);
ParameterMapType metric2TransformConnectionParameters;
metric2TransformConnectionParameters["NameOfInterface"] = { "TransformedImageInterface" };
......
......@@ -30,7 +30,6 @@ public:
typedef Overlord::Pointer OverlordPointerType;
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ConstPointer BlueprintConstPointerType;
typedef Blueprint::ComponentIndexType ComponentIndexType;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
typedef DataManager DataManagerType;
......@@ -94,22 +93,22 @@ TEST_F(RegistrationItkv4Test, ImagesOnly)
ParameterMapType component0Parameters;
component0Parameters["NameOfClass"] = { "ItkImageRegistrationMethodv4Component" };
component0Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
component1Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
component2Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageFilterSinkComponent" };
component3Parameters["Dimensionality"] = { "3" }; // should be derived from the outputs
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType connection1Parameters;
......@@ -147,27 +146,27 @@ TEST_F(RegistrationItkv4Test, WithANTSCCMetric)
ParameterMapType component0Parameters;
component0Parameters["NameOfClass"] = { "ItkImageRegistrationMethodv4Component" };
component0Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
component1Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
component2Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageFilterSinkComponent" };
component3Parameters["Dimensionality"] = { "3" }; // should be derived from the outputs
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType component4Parameters;
component4Parameters["NameOfClass"] = { "ItkANTSNeighborhoodCorrelationImageToImageMetricv4Component" };
component4Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index4 = blueprint->AddComponent("Metric", component4Parameters);
blueprint->AddComponent("Metric", component4Parameters);
ParameterMapType connection1Parameters;
......@@ -208,27 +207,27 @@ TEST_F(RegistrationItkv4Test, WithMeanSquaresMetric)
ParameterMapType component0Parameters;
component0Parameters["NameOfClass"] = { "ItkImageRegistrationMethodv4Component" };
component0Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
component1Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
component2Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageFilterSinkComponent" };
component3Parameters["Dimensionality"] = { "3" }; // should be derived from the outputs
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType component4Parameters;
component4Parameters["NameOfClass"] = { "ItkMeanSquaresImageToImageMetricv4Component" };
component4Parameters["Dimensionality"] = { "3" }; // should be derived from the inputs
ComponentIndexType index4 = blueprint->AddComponent("Metric", component4Parameters);
blueprint->AddComponent("Metric", component4Parameters);
ParameterMapType connection1Parameters;
......@@ -270,32 +269,32 @@ TEST_F(RegistrationItkv4Test, DisplacementField2D)
ParameterMapType component0Parameters;
component0Parameters["NameOfClass"] = { "ItkImageRegistrationMethodv4Component" };
component0Parameters["Dimensionality"] = { "2" }; // should be derived from the inputs
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
component1Parameters["Dimensionality"] = { "2" }; // should be derived from the inputs
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
component2Parameters["Dimensionality"] = { "2" }; // should be derived from the inputs
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageFilterSinkComponent" };
component3Parameters["Dimensionality"] = { "2" }; // should be derived from the outputs
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType component4Parameters;
component4Parameters["NameOfClass"] = { "DisplacementFieldItkImageFilterSinkComponent" };
component4Parameters["Dimensionality"] = { "2" }; // should be derived from the outputs
ComponentIndexType index4 = blueprint->AddComponent("ResultDisplacementFieldSink", component4Parameters);
blueprint->AddComponent("ResultDisplacementFieldSink", component4Parameters);
ParameterMapType component5Parameters;
component5Parameters["NameOfClass"] = { "ItkANTSNeighborhoodCorrelationImageToImageMetricv4Component" };
component5Parameters["Dimensionality"] = { "2" }; // should be derived from the inputs
ComponentIndexType index5 = blueprint->AddComponent("Metric", component5Parameters);
blueprint->AddComponent("Metric", component5Parameters);
ParameterMapType connection1Parameters;
......
......@@ -44,7 +44,6 @@ public:
typedef Overlord::Pointer OverlordPointerType;
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ConstPointer BlueprintConstPointerType;
typedef Blueprint::ComponentIndexType ComponentIndexType;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
typedef DataManager DataManagerType;
......@@ -83,27 +82,27 @@ TEST_F(WBIRDemoTest, itkv4_SVF_ANTSCC)
ParameterMapType component0Parameters;
component0Parameters["NameOfClass"] = { "ItkImageRegistrationMethodv4Component" };
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageFilterSinkComponent" };
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType component4Parameters;
component4Parameters["NameOfClass"] = { "DisplacementFieldItkImageFilterSinkComponent" };
ComponentIndexType index4 = blueprint->AddComponent("ResultDisplacementFieldSink", component4Parameters);
blueprint->AddComponent("ResultDisplacementFieldSink", component4Parameters);
ParameterMapType component5Parameters;
component5Parameters["NameOfClass"] = { "ItkANTSNeighborhoodCorrelationImageToImageMetricv4Component" };
ComponentIndexType index5 = blueprint->AddComponent("Metric", component5Parameters);
blueprint->AddComponent("Metric", component5Parameters);
ParameterMapType connection1Parameters;
......@@ -155,27 +154,27 @@ TEST_F(WBIRDemoTest, itkv4_SVF_MSD)
ParameterMapType component0Parameters;
component0Parameters["NameOfClass"] = { "ItkImageRegistrationMethodv4Component" };
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageFilterSinkComponent" };
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType component4Parameters;
component4Parameters["NameOfClass"] = { "DisplacementFieldItkImageFilterSinkComponent" };
ComponentIndexType index4 = blueprint->AddComponent("ResultDisplacementFieldSink", component4Parameters);
blueprint->AddComponent("ResultDisplacementFieldSink", component4Parameters);
ParameterMapType component5Parameters;
component5Parameters["NameOfClass"] = { "ItkMeanSquaresImageToImageMetricv4Component" };
ComponentIndexType index5 = blueprint->AddComponent("Metric", component5Parameters);
blueprint->AddComponent("Metric", component5Parameters);
ParameterMapType connection1Parameters;
......@@ -230,19 +229,19 @@ TEST_F(WBIRDemoTest, elastix_BS_NCC)
//component0Parameters["RegistrationPreset"] = { "rigid" };
component0Parameters["Transform"] = { "BSplineTransform" };
component0Parameters["Metric"] = { "AdvancedNormalizedCorrelation" };
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageSinkComponent" };
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType connection1Parameters;
//optionally, tie properties to connection to avoid ambiguities
......@@ -288,19 +287,19 @@ TEST_F(WBIRDemoTest, elastix_BS_MSD)
//component0Parameters["RegistrationPreset"] = { "rigid" };
component0Parameters["Transform"] = { "BSplineTransform" };
component0Parameters["Metric"] = { "AdvancedMeanSquares" };
ComponentIndexType index0 = blueprint->AddComponent("RegistrationMethod", component0Parameters);
blueprint->AddComponent("RegistrationMethod", component0Parameters);
ParameterMapType component1Parameters;
component1Parameters["NameOfClass"] = { "ItkImageSourceFixedComponent" };
ComponentIndexType index1 = blueprint->AddComponent("FixedImageSource", component1Parameters);
blueprint->AddComponent("FixedImageSource", component1Parameters);
ParameterMapType component2Parameters;
component2Parameters["NameOfClass"] = { "ItkImageSourceMovingComponent" };
ComponentIndexType index2 = blueprint->AddComponent("MovingImageSource", component2Parameters);
blueprint->AddComponent("MovingImageSource", component2Parameters);
ParameterMapType component3Parameters;
component3Parameters["NameOfClass"] = { "ItkImageSinkComponent" };
ComponentIndexType index3 = blueprint->AddComponent("ResultImageSink", component3Parameters);
blueprint->AddComponent("ResultImageSink", component3Parameters);
ParameterMapType connection1Parameters;
//optionally, tie properties to connection to avoid ambiguities
......
......@@ -22,7 +22,6 @@ public:
typedef Overlord::Pointer OverlordPointerType;
typedef Blueprint::Pointer BlueprintPointerType;
typedef Blueprint::ConstPointer BlueprintConstPointerType;
typedef Blueprint::ComponentIndexType ComponentIndexType;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
......@@ -53,8 +52,8 @@ public:
// Setting of the component are considered as criteria too. If the components can interpret the parameters, it's all good.
componentParameters["Sigma"] = { "2.5" };
ComponentIndexType index0 = blueprint->AddComponent("FistStageFilter", componentParameters);
ComponentIndexType index1 = blueprint->AddComponent("SecondStageFilter", componentParameters);
blueprint->AddComponent("FistStageFilter", componentParameters);
blueprint->AddComponent("SecondStageFilter", componentParameters);
// TODO: For now, the connections to make are explicitly indicated by the Interface name.
// Design consideration: connections might be indicated by higher concepts ( MetricCostConnection: value and/or derivative? DefaultPipeline? )
......@@ -67,12 +66,12 @@ public:
/** Add a description of the SourceComponent*/
ParameterMapType sourceComponentParameters;
sourceComponentParameters["NameOfClass"] = { "ItkImageSourceComponent" };
ComponentIndexType sourceIndex = blueprint->AddComponent("Source", sourceComponentParameters);
blueprint->AddComponent("Source", sourceComponentParameters);
/** Add a description of the SinkComponent*/
ParameterMapType sinkComponentParameters;
sinkComponentParameters["NameOfClass"] = { "ItkImageFilterSinkComponent" };
ComponentIndexType sinkIndex = blueprint->AddComponent("Sink", sinkComponentParameters);
blueprint->AddComponent("Sink", sinkComponentParameters);
/** Connect Sink and Source to the itkImageFilter Components*/
blueprint->AddConnection("Source", "FistStageFilter", connectionParameters); //
......
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