diff --git a/Modules/Core/Blueprints/include/elxBlueprint.h b/Modules/Core/Blueprints/include/elxBlueprint.h index 0272082103ed9ec4a0fff5b08b673652f74a2e4b..9531a695642f936104a7d7b0124c23c94a95aa3b 100644 --- a/Modules/Core/Blueprints/include/elxBlueprint.h +++ b/Modules/Core/Blueprints/include/elxBlueprint.h @@ -19,30 +19,37 @@ public: elxNewMacro( Blueprint, itk::DataObject ); - typedef TComponentDescriptor ComponentDescriptorType; + typedef TComponentDescriptor ComponentDescriptorType; + typedef typename TComponentDescriptor::ComponentNameType ComponentNameType; typedef boost::adjacency_list< boost::listS, boost::listS, boost::directedS, - ComponentDescriptorType > GraphType; + ComponentDescriptorType > GraphType; - typedef typename boost::graph_traits< GraphType >::vertex_descriptor ComponentType; - typedef typename boost::graph_traits< GraphType >::vertex_iterator ComponentIterator, ComponentIteratorEnd; + typedef typename boost::graph_traits< GraphType >::vertex_descriptor ComponentType; + typedef typename boost::graph_traits< GraphType >::vertex_iterator ComponentIterator, ComponentIteratorEnd; - typedef typename boost::graph_traits< GraphType >::edge_descriptor ConnectionDescriptorType; - typedef typename boost::graph_traits< GraphType >::edge_iterator ConnectionIterator, ConnectionIteratorEnd; + + + // TODO: Why can't we get the vertex index map type like they show in + // http://www.boost.org/doc/libs/1_38_0/libs/graph/doc/quick_tour.html + // under "Access Vertex Set"? + typedef boost::vertex_index_t ComponentIndexType; + typedef typename boost::property_map< GraphType, ComponentIndexType >::type ComponentIndexMapType; - typedef typename boost::graph_traits< GraphType >::in_edge_iterator InputIterator, InputIteratorEnd; - typedef typename boost::graph_traits< GraphType >::out_edge_iterator OutputIterator, OutputIteratorEnd; + typedef typename boost::graph_traits< GraphType >::edge_descriptor ConnectionDescriptorType; + typedef typename boost::graph_traits< GraphType >::edge_iterator ConnectionIterator, ConnectionIteratorEnd; - void SetGraph( GraphType graph ) { this->m_Graph = graph; }; - GraphType GetGraph( void ) const { return m_Graph; }; + typedef typename boost::graph_traits< GraphType >::in_edge_iterator InputIterator, InputIteratorEnd; + typedef typename boost::graph_traits< GraphType >::out_edge_iterator OutputIterator, OutputIteratorEnd; - void AddComponent( ComponentDescriptorType component ); - void RemoveComponent( ComponentDescriptorType component ); + bool AddComponent( ComponentDescriptorType component ); + // bool SetComponent( ComponentIndexType componentIndex, ComponentDescriptorType component ); + // ComponentDescriptorType GetComponent( ComponentIndexType componentIndex ); - void AddConnection( ComponentDescriptorType upstream, ComponentDescriptorType downstream ); - void RemoveConnection( ConnectionDescriptorType connection ); + // bool SetConnection( ComponentIndexType upstream, ComponentIndexType downstream ); + ConnectionDescriptorType GetConnection( ConnectionDescriptorType Connection ); private: diff --git a/Modules/Core/Blueprints/include/elxComponentDescriptor.h b/Modules/Core/Blueprints/include/elxComponentDescriptor.h index c6ace2d9145d0b5d0e21cebcc025c50b4f47fae7..8cfcde65694a513cbf50750ab4bcfbce076f0d84 100644 --- a/Modules/Core/Blueprints/include/elxComponentDescriptor.h +++ b/Modules/Core/Blueprints/include/elxComponentDescriptor.h @@ -2,29 +2,29 @@ #define __ComponentDescriptor_h #include "elxMacro.h" -#include "itkLightObject.h" +#include "itkDataObject.h" namespace elx { -class ComponentDescriptor : public itk::LightObject +class ComponentDescriptor : public itk::DataObject { public: - elxNewMacro( ComponentDescriptor, itk::LightObject ); + elxNewMacro( ComponentDescriptor, itk::DataObject ); - typedef std::string ComponentNameType; - typedef std::map< std::string, std::vector< std::string > > ParameterMapType; + // Identifier to find component in the component database + typedef std::string ComponentNameType; - void SetComponentName( ComponentNameType componentName ) { this->m_ComponentName = componentName; }; - ComponentNameType GetComponentName( void ) { return this->m_ComponentName; }; + // TODO: Setter should validate ComponentName exists in ComponentDatabase + itkSetMacro( ComponentName, ComponentNameType ); + itkGetMacro( ComponentName, ComponentNameType ); private: - ComponentNameType m_ComponentName; - ParameterMapType m_ParameterMap; + ComponentNameType m_ComponentName; }; } -#endif // __ComponentDescriptor_h \ No newline at end of file +#endif // __ComponentDescriptor_h diff --git a/Modules/Core/Blueprints/src/elxBlueprint.hxx b/Modules/Core/Blueprints/src/elxBlueprint.hxx index b37fe4d645a030c696709ebdedd8715161bd1022..d5be04e68286a3550ebd33584557f7bae637eb0f 100644 --- a/Modules/Core/Blueprints/src/elxBlueprint.hxx +++ b/Modules/Core/Blueprints/src/elxBlueprint.hxx @@ -11,13 +11,14 @@ void Blueprint< ComponentDescriptor > ::Blueprint( void ) { - this->m_Graph = GraphType; + this->SetGraph( GraphType ); } ComponentDescriptorType Blueprint< ComponentDescriptor > ::AddComponent( ComponentDescriptorType component ) { + // TODO: Check that the component is in the component::ComponentName is in the ComponentDatabase this->Modified(); return this->m_Graph->add_vertex( component ); } diff --git a/Modules/Core/Blueprints/src/elxComponentDescriptor.hxx b/Modules/Core/Blueprints/src/elxComponentDescriptor.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b37f5f3fbf8bfbac685ad6eb3a43f88a59903827 --- /dev/null +++ b/Modules/Core/Blueprints/src/elxComponentDescriptor.hxx @@ -0,0 +1,46 @@ +#ifndef __ComponentDescriptor_hxx +#define __ComponentDescriptor_hxx + +#include "elxComponentDescriptor.h" + +// TODO: Need enum for component name? + +namespace elx { + +ComponentDescriptor +::ComponentDescriptor( const ComponentNameType componentName ) +{ + this->SetComponentName( componentName ); + this->SetComponentUniqueId( this->GenerateUniqueId() ); + this->SetParameterMap( this->ParameterMapType() ); +} + +ComponentDescriptor +::ComponentDescriptor( const ComponentNameType componentName, + const ComponentUniqueIdType componentUniqueId ) +{ + this->SetComponentName( componentName ); + this->SetComponentUniqueId( componentUniqueId ); + this->SetParameterMap( this->ParameterMapType() ); +} + +ComponentDescriptor +::ComponentDescriptor( const ComponentNameType componentName, + const ComponentIdType componentUniqueId, + const ParameterMapType parameterMap ) +{ + this->SetComponentName( componentName ); + this->SetComponentUniqueId( componentUniqueId ); + this->SetParameterMap( parameterMap ); +} + +ComponentDescriptor::ComponentIdType +ComponentDescriptor +::GenerateUniqueId() +{ + +} + +} // namespace elx + +#endif // __ComponentDescriptor_hxx \ No newline at end of file diff --git a/Modules/Core/ElastixFilter/CMakeLists.txt b/Modules/Core/ElastixFilter/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b83cfce3b85bc48c4c713194051c1e70655c7a95 --- /dev/null +++ b/Modules/Core/ElastixFilter/CMakeLists.txt @@ -0,0 +1 @@ +include_directories( include ) diff --git a/Modules/Core/ElastixFilter/include/elxElastixFilter.h b/Modules/Core/ElastixFilter/include/elxElastixFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..99dc4e6665b67236a9aec5076ad4defb59e733ff --- /dev/null +++ b/Modules/Core/ElastixFilter/include/elxElastixFilter.h @@ -0,0 +1,5 @@ +#ifndef __ElastixFilter_h +#define __ElastixFilter_h + + +#endif // #define __ElastixFilter_h \ No newline at end of file diff --git a/Testing/Unit/elxBluePrintTest.cxx b/Testing/Unit/elxBluePrintTest.cxx index d3cc27feb14fb9118b9c068071dcd9965bb849e5..5451c97bf31fa8f5ee420a012b5a03c48c11737c 100644 --- a/Testing/Unit/elxBluePrintTest.cxx +++ b/Testing/Unit/elxBluePrintTest.cxx @@ -6,21 +6,18 @@ namespace elx { TEST( Blueprint, Instantiation ) { - typedef Blueprint< ComponentDescriptor > BlueprintType; - BlueprintType::Pointer blueprint = BlueprintType::New(); + typedef Blueprint< ComponentDescriptor > BlueprintType; + BlueprintType::Pointer blueprint; + EXPECT_NO_THROW( blueprint = BlueprintType::New() ); typedef BlueprintType::ComponentDescriptorType ComponentDescriptorType; - ComponentDescriptorType::Pointer componentDescriptor = ComponentDescriptorType::New(); + ComponentDescriptorType::Pointer componentDescriptor; + EXPECT_NO_THROW( componentDescriptor = ComponentDescriptorType::New() ); typedef ComponentDescriptorType::ComponentNameType ComponentNameType; - ComponentNameType componentName = ComponentNameType("Metric"); - componentDescriptor->SetComponentName( componentName ); - - // We would like to save all data in the graph itself, but the following is - // not possible because the component (of type itk::LightObject has private copy - // constructor. How do we save data in graph and make this as itk-like as possible? - // Ideally when a component descriptor is changed the blueprint calls Modified() on itself - // blueprint->AddComponent( (*componentDescriptor) ); + ComponentNameType componentName; + EXPECT_NO_THROW( componentName = ComponentNameType("Metric") ); + EXPECT_NO_THROW( componentDescriptor->SetComponentName( componentName ) ); ASSERT_TRUE( true ); }