From: Leonardo Florez-Valencia Date: Fri, 28 Oct 2016 02:27:54 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~75 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=cpPlugins.git;a=commitdiff_plain;h=db0a767418f78b371c1e4fb0db00e6b75df74ff3 ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e757da..d1dc9ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,6 @@ INCLUDE(cmake/Functions.cmake) ## == Build different parts == ## =========================== -SUBDIRS(appli lib plugins) -#SUBDIRS(appli cmake lib plugins) +SUBDIRS(appli cmake lib plugins) ## eof - $RCSfile$ diff --git a/appli/CMakeLists.txt b/appli/CMakeLists.txt index 46ade1e..cc05c08 100644 --- a/appli/CMakeLists.txt +++ b/appli/CMakeLists.txt @@ -1,7 +1,7 @@ SUBDIRS( bash examples - # PipelineEditor + PipelineEditor ) ## eof - $RCSfile$ diff --git a/appli/PipelineEditor/CMakeLists.txt b/appli/PipelineEditor/CMakeLists.txt index 29debcf..0febd97 100644 --- a/appli/PipelineEditor/CMakeLists.txt +++ b/appli/PipelineEditor/CMakeLists.txt @@ -1,8 +1,15 @@ IF(Qt4_FOUND) - AppFromDir(_app_name ${CMAKE_CURRENT_SOURCE_DIR}) - IF(_app_name) - TARGET_LINK_LIBRARIES(${_app_name} ${cpBaseQtApplication_LIB} ${cpPlugins_Paths_LIB}) - ENDIF(_app_name) + INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR} + ${PROJECT_BINARY_DIR} + ${PROJECT_SOURCE_DIR}/lib + ${PROJECT_BINARY_DIR}/lib + ) + CompileAppFromDir(PipelineEditor ${CMAKE_CURRENT_SOURCE_DIR}) + TARGET_LINK_LIBRARIES( + PipelineEditor + cpBaseQtApplication + ) ENDIF(Qt4_FOUND) ## eof - $RCSfile$ diff --git a/appli/bash/Config.h.in b/appli/bash/Config.h.in index f891794..953661b 100644 --- a/appli/bash/Config.h.in +++ b/appli/bash/Config.h.in @@ -13,6 +13,7 @@ #include // ------------------------------------------------------------------------- +#define cpPlugins_CONFIG_BOOLEAN_TYPES "@cpPlugins_CONFIG_BOOLEAN_TYPES@" #define cpPlugins_CONFIG_INTEGER_TYPES "@cpPlugins_CONFIG_INTEGER_TYPES@" #define cpPlugins_CONFIG_REAL_TYPES "@cpPlugins_CONFIG_REAL_TYPES@" #define cpPlugins_CONFIG_PROCESS_DIMENSIONS "@cpPlugins_CONFIG_PROCESS_DIMENSIONS@" @@ -131,6 +132,10 @@ namespace cpPlugins_bash // ----------------------------------------------------------------------- inline void LoadDefinitions( TCommands& commands ) { + commands[ "define" ].push_back( + std::string( "bool_types=" ) + + std::string( cpPlugins_CONFIG_BOOLEAN_TYPES ) + ); commands[ "define" ].push_back( std::string( "int_types=" ) + std::string( cpPlugins_CONFIG_INTEGER_TYPES ) @@ -163,11 +168,14 @@ namespace cpPlugins_bash std::string( "matrices=" ) + std::string( cpPlugins_CONFIG_MATRICES ) ); + if( std::string( cpPlugins_CONFIG_INTEGER_TYPES ) != "" ) + commands[ "define" ].push_back( + std::string( "uint_types=unsigned #int_types#" ) + ); commands[ "define" ].push_back( - std::string( "uint_types=unsigned #int_types#" ) - ); - commands[ "define" ].push_back( - std::string( "scalar_pixels=#int_types#;#uint_types#;#real_types#" ) + std::string( + "scalar_pixels=#bool_types#;#int_types#;#uint_types#;#real_types#" + ) ); } diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 4da395c..01bd598 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -59,13 +59,18 @@ ENDFUNCTION() ## ------------------------------------------------------------------------- FUNCTION( - CreateLib - lib_name - lib_type + PrepareSourceFiles + out_sources_list + out_headers_list + out_headers_paths ) +SET(_config_extensions .c.in .cpp.in .cxx.in .h.in .hpp.in .hxx.in .ui.in) +SET(_sources_extensions .c .cpp .cxx) +SET(_headers_extensions .h .hpp .hxx) +SET(_qt_ui_extensions .ui) +SET(_demangler_extensions .d) ## -- Configure inputs -SET(_config_extensions .c.in .cpp.in .cxx.in .h.in .hpp.in .hxx.in .ui.in) SET(_all_files) FOREACH(_file ${ARGN}) GET_FILENAME_COMPONENT(_ext ${_file} EXT) @@ -89,10 +94,6 @@ FOREACH(_file ${ARGN}) ENDFOREACH(_file) ## -- Separate files -SET(_sources_extensions .c .cpp .cxx) -SET(_headers_extensions .h .hpp .hxx) -SET(_qt_ui_extensions .ui) -SET(_demangler_extensions .d) SET(_srcs) SET(_hdrs) SET(_qts) @@ -164,8 +165,22 @@ FOREACH(_hdr ${_hdrs}) LIST(APPEND _hdrs_paths ${_path}) ENDIF(${_path_idx} EQUAL -1) ENDFOREACH(_hdr) + +SET(${out_sources_list} ${_srcs} PARENT_SCOPE) +SET(${out_headers_list} ${_hdrs} PARENT_SCOPE) +SET(${out_headers_paths} ${_hdrs_paths} PARENT_SCOPE) + +ENDFUNCTION() + +## ------------------------------------------------------------------------- +FUNCTION( + CreateLib + lib_name + lib_type + ) +PrepareSourceFiles(_srcs _hdrs _paths ${ARGN}) INCLUDE_DIRECTORIES( - ${_hdrs_paths} + ${_paths} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) @@ -179,7 +194,6 @@ IF(_srcs) STATIC_DEFINE ${lib_name}_BUILT_AS_STATIC ) ENDIF(_srcs) - ENDFUNCTION() ## ------------------------------------------------------------------------- @@ -296,4 +310,28 @@ CreateLib(${lib_name} SHARED ${_files}) ENDFUNCTION() +## ------------------------------------------------------------------------- +FUNCTION( + CompileAppFromDir + app_name + app_dir + ) +FILE(GLOB_RECURSE _files "${app_dir}/*") +PrepareSourceFiles(_srcs _hdrs _paths ${_files} ${ARGN}) +INCLUDE_DIRECTORIES( + ${_paths} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ) +IF(_srcs) + SET(_app_os_target) + IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + SET(_app_os_target WIN32) + ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + SET(_app_os_target MACOSX_BUNDLE) + ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_srcs} ${_hdrs}) +ENDIF(_srcs) +ENDFUNCTION() + ## eof - $RCSfile$ diff --git a/cmake/Options.cmake b/cmake/Options.cmake index edd8126..c745a7b 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -3,6 +3,7 @@ ## =============================== SET(cpPlugins_CONFIG_NUMBER_OF_FILES "10" CACHE STRING "Number of compiled files.") +SET(cpPlugins_CONFIG_BOOLEAN_TYPES "bool" CACHE STRING "Accepted boolean types.") SET(cpPlugins_CONFIG_INTEGER_TYPES "char;short;int;long" CACHE STRING "Accepted integer types.") SET(cpPlugins_CONFIG_REAL_TYPES "float;double" CACHE STRING "Accepted real types.") SET(cpPlugins_CONFIG_PROCESS_DIMENSIONS "1;2;3;4" CACHE STRING "Accepted processing dimensions.") @@ -14,6 +15,7 @@ SET(cpPlugins_CONFIG_MATRICES "Matrix" CACHE STRING "Accepted matrices.") SET( _all_configs + cpPlugins_CONFIG_BOOLEAN_TYPES cpPlugins_CONFIG_INTEGER_TYPES cpPlugins_CONFIG_REAL_TYPES cpPlugins_CONFIG_PROCESS_DIMENSIONS diff --git a/lib/Instances/BaseObjects.i b/lib/Instances/BaseObjects.i index 2923be1..699df69 100644 --- a/lib/Instances/BaseObjects.i +++ b/lib/Instances/BaseObjects.i @@ -7,7 +7,11 @@ tinclude itk#vectors#:h|hxx tinclude itk#matrices#:h|hxx tinclude itk#diff_tensors#:h|hxx tinclude itkSymmetricEigenAnalysis:h|hxx +tinclude vnl/vnl_vector:h|hxx +cinclude vnl/vnl_c_vector.hxx + +instances vnl_vector< bool > instances itk::Array< #scalar_pixels# > instances itk::FixedArray< #scalar_pixels#, #process_dims# > instances itk::FixedArray< #scalar_pixels#, 8 > diff --git a/lib/Instances/ImageFiltersBases.i b/lib/Instances/ImageFiltersBases.i index 4d2044a..f7364f3 100644 --- a/lib/Instances/ImageFiltersBases.i +++ b/lib/Instances/ImageFiltersBases.i @@ -2,12 +2,14 @@ header #define ITK_MANUAL_INSTANTIATION tinclude itkImageSource:h|hxx +cinclude complex cinclude itk#color_pixels#.h cinclude itk#vectors#.h cinclude itk#diff_tensors#.h cinclude itk#matrices#.h instances itk::ImageSource< itk::Image< #scalar_pixels#, #process_dims# > > +instances itk::ImageSource< itk::Image< std::complex< #real_types# >, #process_dims# > > instances itk::ImageSource< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > > instances itk::ImageSource< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > > instances itk::ImageSource< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > > diff --git a/lib/Instances/ImageIterators.i b/lib/Instances/ImageIterators.i index f35474c..c77e0ca 100644 --- a/lib/Instances/ImageIterators.i +++ b/lib/Instances/ImageIterators.i @@ -4,12 +4,14 @@ define iter=ImageRegionConstIterator;ImageRegionIterator;ImageScanlineConstItera tinclude itk#iter#:h|hxx +cinclude complex cinclude itk#color_pixels#.h cinclude itk#vectors#.h cinclude itk#diff_tensors#.h cinclude itk#matrices#.h instances itk::#iter#< itk::Image< #scalar_pixels#, #process_dims# > > +instances itk::#iter#< itk::Image< std::complex< #real_types# >, #process_dims# > > instances itk::#iter#< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > > instances itk::#iter#< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > > instances itk::#iter#< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > > diff --git a/lib/Instances/Meshes.i b/lib/Instances/Meshes.i index 6e37a2f..fd098bd 100644 --- a/lib/Instances/Meshes.i +++ b/lib/Instances/Meshes.i @@ -1,11 +1,19 @@ header #define ITK_MANUAL_INSTANTIATION +define cells=Vertex;Line;Triangle;Polygon + tinclude itkMesh:h|hxx tinclude itkPointSet:h|hxx +tinclude itk#cells#Cell:h|hxx +tinclude itkCellInterface:h|hxx cinclude itkMapContainer.hxx cinclude itkVectorContainer.hxx +itk::CellInterface< #real_types#, itk::CellTraitsInfo< #visual_dims#, float, float, unsigned long, unsigned long, unsigned long, itk::Point< float, #visual_dims# >, itk::VectorContainer< unsigned long, itk::Point< float, #visual_dims# > >, std::set< unsigned long, std::less< unsigned long >, std::allocator< unsigned long > > > > + +instances itk::#cells#Cell< itk::CellInterface< #real_types#, itk::CellTraitsInfo< #visual_dims#, float, float, unsigned long, unsigned long, unsigned long, itk::Point< float, #visual_dims# >, itk::VectorContainer< unsigned long, itk::Point< float, #visual_dims# > >, std::set< unsigned long, std::less< unsigned long >, std::allocator< unsigned long > > > > > + instances itk::PointSet< #real_types#, #visual_dims# > instances itk::Mesh< #real_types#, #visual_dims# > diff --git a/lib/Instances/SimpleImages.i b/lib/Instances/SimpleImages.i index ab100bb..6d20764 100644 --- a/lib/Instances/SimpleImages.i +++ b/lib/Instances/SimpleImages.i @@ -5,12 +5,14 @@ tinclude itkImageBase:h|hxx tinclude itkImage:h|hxx tinclude itkImportImageContainer:h|hxx +cinclude complex cinclude itk#color_pixels#.h cinclude itk#vectors#.h cinclude itk#diff_tensors#.h cinclude itk#matrices#.h instances itk::ImportImageContainer< unsigned long, #scalar_pixels# > +instances itk::ImportImageContainer< unsigned long, std::complex< #real_types# > > instances itk::ImportImageContainer< unsigned long, itk::#color_pixels#< #scalar_pixels# > > instances itk::ImportImageContainer< unsigned long, itk::#vectors#< #real_types#, #process_dims# > > instances itk::ImportImageContainer< unsigned long, itk::#diff_tensors#< #real_types# > > @@ -20,6 +22,7 @@ instances itk::ImageRegion< #process_dims# > instances itk::ImageBase< #process_dims# > instances itk::Image< #scalar_pixels#, #process_dims# > +instances itk::Image< std::complex< #real_types# >, #process_dims# > instances itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > instances itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > instances itk::Image< itk::#diff_tensors#< #real_types# >, 3 > diff --git a/lib/cpBaseQtApplication/Block.cxx b/lib/cpBaseQtApplication/Block.cxx index 5ee8f08..352c566 100644 --- a/lib/cpBaseQtApplication/Block.cxx +++ b/lib/cpBaseQtApplication/Block.cxx @@ -53,7 +53,13 @@ Block( // Add input ports auto inputs = this->m_Filter->GetInputsNames( ); for( auto iIt = inputs.begin( ); iIt != inputs.end( ); ++iIt ) - this->addInputPort( iIt->c_str( ) ); + { + this->addInputPort( + iIt->c_str( ), + this->m_Filter->IsInputMultiple( iIt->c_str( ) ) + ); + + } // rof // Add output ports auto outputs = this->m_Filter->GetOutputsNames( ); @@ -116,9 +122,9 @@ setNamePort( const QString& txt ) // ------------------------------------------------------------------------- cpBaseQtApplication::InputPort* cpBaseQtApplication::Block:: -addInputPort( const QString& txt ) +addInputPort( const QString& txt, bool multiple ) { - InputPort* ip = new InputPort( this ); + InputPort* ip = new InputPort( this, multiple ); ip->setExtendedName( "" ); ip->setName( txt ); this->m_InputPorts[ txt.toStdString( ) ] = ip; diff --git a/lib/cpBaseQtApplication/Block.h b/lib/cpBaseQtApplication/Block.h index 738339d..76a114a 100644 --- a/lib/cpBaseQtApplication/Block.h +++ b/lib/cpBaseQtApplication/Block.h @@ -40,7 +40,7 @@ namespace cpBaseQtApplication void setEditor( Editor* editor ); void setNamePort( const QString& txt ); - InputPort* addInputPort( const QString& txt ); + InputPort* addInputPort( const QString& txt, bool multiple ); OutputPort* addOutputPort( const QString& txt ); InputPort* inputPort( const QString& txt ); diff --git a/lib/cpBaseQtApplication/Canvas.cxx b/lib/cpBaseQtApplication/Canvas.cxx index c55141f..85e7bfb 100644 --- a/lib/cpBaseQtApplication/Canvas.cxx +++ b/lib/cpBaseQtApplication/Canvas.cxx @@ -91,44 +91,6 @@ keyPressEvent( QKeyEvent* event ) default: break; } // hctiws - /* TODO - if( event->key( ) == del_key ) - { - auto _items = this->items( ); - auto i = _items.begin( ); - while( i != _items.end( ) ) - { - if( ( *i )->isSelected( ) ) - { - Block* b = dynamic_cast< Block* >( *i ); - Connection* c = dynamic_cast< Connection* >( *i ); - if( b != NULL ) - { - if( this->m_Editor->deleteFilter( b->namePort( ).toStdString( ) ) ) - delete b; - } - else if( c != NULL ) - { - if( - this->m_Editor->deleteConnection( - c->port1( )->block( )->namePort( ).toStdString( ), - c->port2( )->block( )->namePort( ).toStdString( ), - c->port1( )->name( ).toStdString( ), - c->port2( )->name( ).toStdString( ) - ) - ) - delete c; - - } // fi - i = _items.end( ); - } - else - i++; - - } // elihw - - } // fi - */ } // ------------------------------------------------------------------------- diff --git a/lib/cpBaseQtApplication/Connection.cxx b/lib/cpBaseQtApplication/Connection.cxx index 81ac61d..4f48b3b 100644 --- a/lib/cpBaseQtApplication/Connection.cxx +++ b/lib/cpBaseQtApplication/Connection.cxx @@ -63,12 +63,8 @@ setPort2( InputPort* p ) { if( p != NULL ) { - if( p->connection( ) == NULL ) - { - p->setConnection( this ); - this->m_Port2 = p; - - } // fi + p->setConnection( this ); + this->m_Port2 = p; } // fi } diff --git a/lib/cpBaseQtApplication/Editor.cxx b/lib/cpBaseQtApplication/Editor.cxx index 0772ab9..b039f3f 100644 --- a/lib/cpBaseQtApplication/Editor.cxx +++ b/lib/cpBaseQtApplication/Editor.cxx @@ -302,36 +302,6 @@ dataProperties( const std::string& name, const std::string& port ) this->m_MainWindow->dataProperties( name, port ); } -/* TODO - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Editor:: -showOutputData( - const std::string& filter_name, const std::string& output_name - ) -{ - emit showFilterOutput( filter_name, output_name ); -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Editor:: -hideOutputData( - const std::string& filter_name, const std::string& output_name - ) -{ - emit hideFilterOutput( filter_name, output_name ); -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Editor:: -visualPropertiesOutputData( - const std::string& filter_name, const std::string& output_name - ) -{ - emit visualPropertiesFilterOutput( filter_name, output_name ); -} -*/ - // ------------------------------------------------------------------------- cpBaseQtApplication_Editor_Callback_CODE( ContextMenu ) { @@ -574,7 +544,7 @@ cpBaseQtApplication_Editor_Callback_CODE( MouseRelease ) { if( in->block( ) != out->block( ) && - !in->hasConnection( ) && + ( !in->hasConnection( ) || in->isMultiple( ) ) && !in->isConnected( out ) && !out->isExtended( ) ) diff --git a/lib/cpBaseQtApplication/Port.cxx b/lib/cpBaseQtApplication/Port.cxx index bdd9aea..e61bd28 100644 --- a/lib/cpBaseQtApplication/Port.cxx +++ b/lib/cpBaseQtApplication/Port.cxx @@ -126,9 +126,9 @@ isConnected( Port* other ) // ------------------------------------------------------------------------- cpBaseQtApplication::InputPort:: -InputPort( QGraphicsItem* parent, QGraphicsScene* scene ) +InputPort( QGraphicsItem* parent, bool multiple, QGraphicsScene* scene ) : Superclass( parent, scene ), - m_Connection( NULL ) + m_IsMultiple( multiple ) { } @@ -136,8 +136,7 @@ InputPort( QGraphicsItem* parent, QGraphicsScene* scene ) cpBaseQtApplication::InputPort:: ~InputPort( ) { - if( this->m_Connection != NULL ) - delete this->m_Connection; + this->m_Connection.clear( ); } // ------------------------------------------------------------------------- @@ -156,7 +155,7 @@ _updateLabels( ) void cpBaseQtApplication::InputPort:: setExtend( bool extend ) { - if( this->m_Connection == NULL ) + if( this->m_Connection.size( ) == 0 ) { this->m_IsExtended = extend; this->m_ExtendedLabel->setVisible( extend ); @@ -169,20 +168,19 @@ setExtend( bool extend ) bool cpBaseQtApplication::InputPort:: isConnected( Port* other ) { - if( this->m_Connection != NULL ) - return( - this->m_Connection->port1( ) == other && - this->m_Connection->port2( ) == this - ); - else - return( false ); + bool conn = false; + auto i = this->m_Connection.begin( ); + for( ; i != this->m_Connection.end( ); ++i ) + conn |= ( ( *i )->port1( ) == other && ( *i )->port2( ) == this ); + return( conn ); } // ------------------------------------------------------------------------- void cpBaseQtApplication::InputPort:: setConnection( Connection* c ) { - this->m_Connection = c; + if( this->m_IsMultiple || this->m_Connection.size( ) == 0 ) + this->m_Connection.push_back( c ); } // ------------------------------------------------------------------------- @@ -191,10 +189,14 @@ itemChange( GraphicsItemChange change, const QVariant& value ) { if( change == ItemScenePositionHasChanged ) { - if( this->m_Connection != NULL ) + for( + auto i = this->m_Connection.begin( ); + i != this->m_Connection.end( ); + ++i + ) { - this->m_Connection->updatePosFromPorts( ); - this->m_Connection->updatePath( ); + ( *i )->updatePosFromPorts( ); + ( *i )->updatePath( ); } // fi diff --git a/lib/cpBaseQtApplication/Port.h b/lib/cpBaseQtApplication/Port.h index 1f6bda1..45d1fe9 100644 --- a/lib/cpBaseQtApplication/Port.h +++ b/lib/cpBaseQtApplication/Port.h @@ -101,7 +101,11 @@ namespace cpBaseQtApplication enum { Type = Superclass::Type + 3 }; public: - InputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); + InputPort( + QGraphicsItem* parent, + bool multiple, + QGraphicsScene* scene = NULL + ); virtual ~InputPort( ); virtual void setExtend( bool extend ); @@ -111,19 +115,22 @@ namespace cpBaseQtApplication { return( this->Type ); } void setConnection( Connection* c ); - inline Connection* connection( ) - { return( this->m_Connection ); } - inline const Connection* connection( ) const - { return( this->m_Connection ); } + inline Connection* connection( unsigned int i ) + { return( this->m_Connection[ i ] ); } + inline const Connection* connection( unsigned int i ) const + { return( this->m_Connection[ i ] ); } inline bool hasConnection( ) const - { return( this->m_Connection != NULL ); } + { return( this->m_Connection.size( ) > 0 ); } + inline bool isMultiple( ) const + { return( this->m_IsMultiple ); } protected: QVariant itemChange( GraphicsItemChange change, const QVariant& value ); virtual void _updateLabels( ); protected: - Connection* m_Connection; + std::vector< Connection* > m_Connection; + bool m_IsMultiple; }; /** diff --git a/lib/cpPlugins/BaseObjects/Port.cxx b/lib/cpPlugins/BaseObjects/Port.cxx index 06b10ee..6236ae1 100644 --- a/lib/cpPlugins/BaseObjects/Port.cxx +++ b/lib/cpPlugins/BaseObjects/Port.cxx @@ -149,19 +149,25 @@ cpPlugins::BaseObjects::MultipleInputsPort:: void cpPlugins::BaseObjects::MultipleInputsPort:: Add( cpPlugins::BaseObjects::DataObject* o ) { - /* TODO - if( o == NULL ) - return; - auto otype = std::type_index( typeid( *o ) ); - if( this->m_Type == otype ) - this->m_Data.push_back( o ); - else - throw std::logic_error( - "cpPlugins::MultipleInputsPort: incompatible types \"" + - std::string( otype.name( ) ) + std::string( "\" and \"" ) + - std::string( this->m_Type.name( ) ) + std::string( "\"" ) - ); - */ + if( this->m_Sample.IsNull( ) ) + throw std::logic_error( + "cpPlugins::SingleDataPort: Port not yet configured" + ); + if( o != NULL ) + { + if( this->m_Sample->IsCompatible( o ) ) + { + this->m_Data.push_back( o ); + } + else + throw std::logic_error( + "cpPlugins::SingleDataPort: incompatible types \"" + + std::string( typeid( *o ).name( ) ) + std::string( "\" and \"" ) + + std::string( typeid( *( this->m_Sample.GetPointer( ) ) ).name( ) ) + + std::string( "\"" ) + ); + + } // fi } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/BaseObjects/ProcessObject.cxx b/lib/cpPlugins/BaseObjects/ProcessObject.cxx index ab1be4d..7f8533a 100644 --- a/lib/cpPlugins/BaseObjects/ProcessObject.cxx +++ b/lib/cpPlugins/BaseObjects/ProcessObject.cxx @@ -79,6 +79,17 @@ GetInputSize( const std::string& n ) const return( 0 ); } +// ------------------------------------------------------------------------- +bool cpPlugins::BaseObjects::ProcessObject:: +IsInputMultiple( const std::string& n ) const +{ + auto i = this->m_Inputs.find( n ); + if( i != this->m_Inputs.end( ) ) + return( dynamic_cast< MultipleInputsPort* >( i->second ) != NULL ); + else + return( false ); +} + // ------------------------------------------------------------------------- void cpPlugins::BaseObjects::ProcessObject:: AddInput( const std::string& n, cpPlugins::BaseObjects::DataObject* o ) diff --git a/lib/cpPlugins/BaseObjects/ProcessObject.h b/lib/cpPlugins/BaseObjects/ProcessObject.h index 8d7536c..18c9b2d 100644 --- a/lib/cpPlugins/BaseObjects/ProcessObject.h +++ b/lib/cpPlugins/BaseObjects/ProcessObject.h @@ -59,6 +59,7 @@ namespace cpPlugins unsigned int GetNumberOfInputs( ) const; unsigned int GetNumberOfOutputs( ) const; unsigned int GetInputSize( const std::string& n ) const; + bool IsInputMultiple( const std::string& n ) const; template< class _TType = DataObject > _TType* GetInput( const std::string& n, unsigned int i = 0 ); diff --git a/lib/cpPlugins/DataObjects/BoundingBox.cxx b/lib/cpPlugins/DataObjects/BoundingBox.cxx index c10b8a2..6ecf3f2 100644 --- a/lib/cpPlugins/DataObjects/BoundingBox.cxx +++ b/lib/cpPlugins/DataObjects/BoundingBox.cxx @@ -82,6 +82,7 @@ Blend( Self* other ) if( other->m_Points[ 1 ][ d ] > this->m_Points[ 1 ][ d ] ) this->m_Points[ 1 ][ d ] = other->m_Points[ 1 ][ d ]; this->Modified( ); + this->_UpdateVTK( ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/DataObjects/Image.d b/lib/cpPlugins/DataObjects/Image.d index 2682d2a..40ba788 100644 --- a/lib/cpPlugins/DataObjects/Image.d +++ b/lib/cpPlugins/DataObjects/Image.d @@ -6,6 +6,7 @@ VisualDims itk::ImageBase< #visual_dims# > IntPixels|d itk::Image< #all_ints#, d > RealPixels|d itk::Image< #real_types#, d > ScalarPixels|d itk::Image< #scalar_pixels#, d > +ComplexPixels|d itk::Image< std::complex< #real_types# >, d > ColorPixels|d itk::Image< itk::#color_pixels#< #scalar_pixels# >, d > VectorPixels|d itk::Image< itk::#vectors#< #real_types#, d >, d > DiffTensors3D itk::Image< itk::#diff_tensors#< #real_types# >, 3 > diff --git a/lib/cpPlugins/DataObjects/Mesh.cxx b/lib/cpPlugins/DataObjects/Mesh.cxx index c40bb02..4a95552 100644 --- a/lib/cpPlugins/DataObjects/Mesh.cxx +++ b/lib/cpPlugins/DataObjects/Mesh.cxx @@ -1,107 +1,114 @@ #include +#include + +#include +#include +#include +#include #include // ------------------------------------------------------------------------- void cpPlugins::DataObjects::Mesh:: SetITK( itk::LightObject* o ) { - /* TODO - this->Superclass::SetITK( o ); - bool s = false; - cpPlugins_Demangle_Meshes_Dims( o, _ITK_2_VTK ); - */ + this->Superclass::SetITK( o ); + cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 2, ); + cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 3, ); + { + this->m_VTK = NULL; + + } // fi + this->Modified( ); } // ------------------------------------------------------------------------- void cpPlugins::DataObjects::Mesh:: SetVTK( vtkObjectBase* o ) { - /* TODO - typedef itk::Mesh< double, 3 > _TMesh; - typedef _TMesh::CellType _TCell; - typedef _TCell::CellAutoPointer _TCellAutoPointer; - typedef itk::LineCell< _TCell > _TLine; - typedef itk::TriangleCell< _TCell > _TTriangle; - typedef itk::PolygonCell< _TCell > _TPolygon; - - vtkPolyData* mesh = dynamic_cast< vtkPolyData* >( o ); - if( mesh == NULL ) - { - this->m_ITK = NULL; - this->Modified( ); - return; - - } // fi - - if( this->m_VTK.GetPointer( ) != mesh ) - { - this->m_VTK = mesh; - - // Copy points - _TMesh::Pointer imesh = _TMesh::New( ); - double point[ 3 ]; - for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i ) - { - mesh->GetPoint( i, point ); - _TMesh::PointType ipoint; - ipoint[ 0 ] = point[ 0 ]; - ipoint[ 1 ] = point[ 1 ]; - ipoint[ 2 ] = point[ 2 ]; - imesh->SetPoint( i, ipoint ); - - } // rof - - // Copy cells - vtkCellArray* arrays[ 4 ]; - arrays[ 0 ] = mesh->GetLines( ); - arrays[ 1 ] = mesh->GetPolys( ); - arrays[ 2 ] = NULL; // TODO: mesh->GetStrips( ); - arrays[ 3 ] = mesh->GetVerts( ); - - for( unsigned int c = 0; c < 4; c++ ) - { - if( arrays[ c ] != NULL ) - { - vtkSmartPointer< vtkIdList > ids = - vtkSmartPointer< vtkIdList >::New( ); - arrays[ c ]->InitTraversal( ); - while( arrays[ c ]->GetNextCell( ids ) == 1 ) - { - long nPoints = ids->GetNumberOfIds( ); - _TCellAutoPointer icell; - if( nPoints == 2 ) - { - icell.TakeOwnership( new _TLine ); - icell->SetPointId( 0, ids->GetId( 0 ) ); - icell->SetPointId( 1, ids->GetId( 1 ) ); - } - else if( nPoints == 3 ) - { - icell.TakeOwnership( new _TTriangle ); - icell->SetPointId( 0, ids->GetId( 0 ) ); - icell->SetPointId( 1, ids->GetId( 1 ) ); - icell->SetPointId( 2, ids->GetId( 2 ) ); - } - else if( nPoints > 3 ) - { - _TPolygon* polygon = new _TPolygon( ); - for( long j = 0; j < nPoints; ++j ) - polygon->AddPointId( ids->GetId( j ) ); - icell.TakeOwnership( polygon ); - - } // fi - imesh->SetCell( imesh->GetNumberOfCells( ), icell ); - - } // elihw - - } // fi - - } // rof - this->m_ITK = imesh; - this->Modified( ); - - } // fi - */ + typedef itk::Mesh< double, 3 > _TMesh; + typedef _TMesh::CellType _TCell; + typedef _TCell::CellAutoPointer _TCellAutoPointer; + typedef itk::LineCell< _TCell > _TLine; + typedef itk::TriangleCell< _TCell > _TTriangle; + typedef itk::PolygonCell< _TCell > _TPolygon; + + vtkPolyData* mesh = dynamic_cast< vtkPolyData* >( o ); + if( mesh == NULL ) + { + this->m_ITK = NULL; + this->Modified( ); + return; + + } // fi + + if( this->m_VTK.GetPointer( ) != mesh ) + { + this->m_VTK = mesh; + + // Copy points + _TMesh::Pointer imesh = _TMesh::New( ); + double point[ 3 ]; + for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i ) + { + mesh->GetPoint( i, point ); + _TMesh::PointType ipoint; + ipoint[ 0 ] = point[ 0 ]; + ipoint[ 1 ] = point[ 1 ]; + ipoint[ 2 ] = point[ 2 ]; + imesh->SetPoint( i, ipoint ); + + } // rof + + // Copy cells + vtkCellArray* arrays[ 4 ]; + arrays[ 0 ] = mesh->GetLines( ); + arrays[ 1 ] = mesh->GetPolys( ); + arrays[ 2 ] = NULL; // TODO: mesh->GetStrips( ); + arrays[ 3 ] = mesh->GetVerts( ); + + for( unsigned int c = 0; c < 4; c++ ) + { + if( arrays[ c ] != NULL ) + { + vtkSmartPointer< vtkIdList > ids = + vtkSmartPointer< vtkIdList >::New( ); + arrays[ c ]->InitTraversal( ); + while( arrays[ c ]->GetNextCell( ids ) == 1 ) + { + long nPoints = ids->GetNumberOfIds( ); + _TCellAutoPointer icell; + if( nPoints == 2 ) + { + icell.TakeOwnership( new _TLine ); + icell->SetPointId( 0, ids->GetId( 0 ) ); + icell->SetPointId( 1, ids->GetId( 1 ) ); + } + else if( nPoints == 3 ) + { + icell.TakeOwnership( new _TTriangle ); + icell->SetPointId( 0, ids->GetId( 0 ) ); + icell->SetPointId( 1, ids->GetId( 1 ) ); + icell->SetPointId( 2, ids->GetId( 2 ) ); + } + else if( nPoints > 3 ) + { + _TPolygon* polygon = new _TPolygon( ); + for( long j = 0; j < nPoints; ++j ) + polygon->AddPointId( ids->GetId( j ) ); + icell.TakeOwnership( polygon ); + + } // fi + imesh->SetCell( imesh->GetNumberOfCells( ), icell ); + + } // elihw + + } // fi + + } // rof + this->m_ITK = imesh; + this->Modified( ); + + } // fi } // ------------------------------------------------------------------------- @@ -117,4 +124,59 @@ cpPlugins::DataObjects::Mesh:: { } +// ------------------------------------------------------------------------- +template< class _TMesh > +void cpPlugins::DataObjects::Mesh:: +_ITK_2_VTK( _TMesh* mesh ) +{ + long numPoints = mesh->GetNumberOfPoints( ); + if( numPoints == 0 ) + return; + + vtkSmartPointer< vtkPoints > vpoints = + vtkSmartPointer< vtkPoints >::New( ); + vpoints->SetNumberOfPoints( numPoints ); + auto points = mesh->GetPoints( ); + + // Copy points + vtkIdType VTKId = 0; + std::map< vtkIdType, long > IndexMap; + for( auto i = points->Begin( ); i != points->End( ); ++i, VTKId++ ) + { + IndexMap[ VTKId ] = i->Index( ); + if( _TMesh::PointDimension == 2 ) + vpoints->SetPoint( + VTKId, + i->Value( )[ 0 ], i->Value( )[ 1 ], 0 + ); + else if( _TMesh::PointDimension == 3 ) + vpoints->SetPoint( + VTKId, + i->Value( )[ 0 ], i->Value( )[ 1 ], i->Value( )[ 2 ] + ); + + } // rof + + // Copy cells + vtkSmartPointer< vtkCellArray > vcells = + vtkSmartPointer< vtkCellArray >::New( ); + auto cells = mesh->GetCells( ); + for( auto j = cells->Begin( ); j != cells->End( ); ++j ) + { + auto cell = j->Value( ); + vcells->InsertNextCell( cell->GetNumberOfPoints( ) ); + for( auto k = cell->PointIdsBegin( ); k != cell->PointIdsEnd( ); ++k ) + vcells->InsertCellPoint( IndexMap[ *k ] ); + + } // rof + + // Final assignations + vtkSmartPointer< vtkPolyData > vmesh = + vtkSmartPointer< vtkPolyData >::New( ); + vmesh->SetPoints( vpoints ); + vmesh->SetPolys( vcells ); + this->m_VTK = vmesh; + this->Modified( ); +} + // eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Mesh.d b/lib/cpPlugins/DataObjects/Mesh.d index 4713177..becc6b9 100644 --- a/lib/cpPlugins/DataObjects/Mesh.d +++ b/lib/cpPlugins/DataObjects/Mesh.d @@ -1,3 +1,3 @@ -Meshes itk::Mesh< #real_types#, #process_dims# > +Meshes|d itk::Mesh< #real_types#, d > ** eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Mesh.h b/lib/cpPlugins/DataObjects/Mesh.h index b932bdf..ce3f331 100644 --- a/lib/cpPlugins/DataObjects/Mesh.h +++ b/lib/cpPlugins/DataObjects/Mesh.h @@ -33,7 +33,7 @@ namespace cpPlugins virtual ~Mesh( ); template< class _TMesh > - inline void _ITK_2_VTK( _TMesh* mesh ); + inline void _ITK_2_VTK( _TMesh* mesh ); private: // Purposely not implemented @@ -45,8 +45,6 @@ namespace cpPlugins } // ecapseman -#include - #endif // __cpPlugins__DataObjects__Mesh__h__ // eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Mesh.hxx b/lib/cpPlugins/DataObjects/Mesh.hxx deleted file mode 100644 index f9cc1bc..0000000 --- a/lib/cpPlugins/DataObjects/Mesh.hxx +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef __cpPlugins__DataObjects__Mesh__hxx__ -#define __cpPlugins__DataObjects__Mesh__hxx__ - -// TODO: #include -#include -#include -#include -#include - -// ------------------------------------------------------------------------- -template< class _TMesh > -void cpPlugins::DataObjects::Mesh:: -_ITK_2_VTK( _TMesh* mesh ) -{ - long numPoints = mesh->GetNumberOfPoints( ); - if( numPoints == 0 ) - return; - - vtkSmartPointer< vtkPoints > vpoints = - vtkSmartPointer< vtkPoints >::New( ); - vpoints->SetNumberOfPoints( numPoints ); - auto points = mesh->GetPoints( ); - - // Copy points - vtkIdType VTKId = 0; - std::map< vtkIdType, long > IndexMap; - for( auto i = points->Begin( ); i != points->End( ); ++i, VTKId++ ) - { - IndexMap[ VTKId ] = i->Index( ); - if( _TMesh::PointDimension == 2 ) - vpoints->SetPoint( - VTKId, - i->Value( )[ 0 ], i->Value( )[ 1 ], 0 - ); - else if( _TMesh::PointDimension == 3 ) - vpoints->SetPoint( - VTKId, - i->Value( )[ 0 ], i->Value( )[ 1 ], i->Value( )[ 2 ] - ); - - } // rof - - // Copy cells - vtkSmartPointer< vtkCellArray > vcells = - vtkSmartPointer< vtkCellArray >::New( ); - auto cells = mesh->GetCells( ); - for( auto j = cells->Begin( ); j != cells->End( ); ++j ) - { - auto cell = j->Value( ); - vcells->InsertNextCell( cell->GetNumberOfPoints( ) ); - for( auto k = cell->PointIdsBegin( ); k != cell->PointIdsEnd( ); ++k ) - vcells->InsertCellPoint( IndexMap[ *k ] ); - - } // rof - - // Final assignations - vtkSmartPointer< vtkPolyData > vmesh = - vtkSmartPointer< vtkPolyData >::New( ); - vmesh->SetPoints( vpoints ); - vmesh->SetPolys( vcells ); - this->m_VTK = vmesh; - this->Modified( ); -} - -#endif // __cpPlugins__DataObjects__Mesh__hxx__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Workspace.cxx b/lib/cpPlugins/Interface/Workspace.cxx index 90c26d5..faef957 100644 --- a/lib/cpPlugins/Interface/Workspace.cxx +++ b/lib/cpPlugins/Interface/Workspace.cxx @@ -350,12 +350,17 @@ GetConnections( { for( auto i = ins.begin( ); i != ins.end( ); ++i ) { - auto od = orig->GetOutput( *o ); - auto id = dest->GetInput( *i ); - if( od != NULL && od == id ) - conns.push_back( - std::pair< std::string, std::string >( *o, *i ) - ); + unsigned int nInputs = dest->GetInputSize( *i ); + for( unsigned j = 0; j < nInputs; ++j ) + { + auto od = orig->GetOutput( *o ); + auto id = dest->GetInput( *i, j ); + if( od != NULL && od == id ) + conns.push_back( + std::pair< std::string, std::string >( *o, *i ) + ); + + } // rof } // rof diff --git a/lib/cpPlugins/Interface/WorkspaceIO.cxx b/lib/cpPlugins/Interface/WorkspaceIO.cxx index 029ade4..9a019eb 100644 --- a/lib/cpPlugins/Interface/WorkspaceIO.cxx +++ b/lib/cpPlugins/Interface/WorkspaceIO.cxx @@ -235,21 +235,26 @@ Save( const std::string& fname ) const auto od = orig->GetOutput( *oIt ); for( auto iIt = inputs.begin( ); iIt != inputs.end( ); ++iIt ) { - auto id = dest->GetInput( *iIt ); - if( od != NULL && od == id ) + unsigned int nInputs = dest->GetInputSize( *iIt ); + for( unsigned int k = 0; k < nInputs; ++k ) { - tinyxml2::XMLElement* e_conn = doc->NewElement( "Connection" ); - tinyxml2::XMLElement* e_orig = doc->NewElement( "Origin" ); - tinyxml2::XMLElement* e_dest = doc->NewElement( "Destination" ); - e_orig->SetAttribute( "Filter", orig->GetName( ) ); - e_orig->SetAttribute( "Name", oIt->c_str( ) ); - e_dest->SetAttribute( "Filter", dest->GetName( ) ); - e_dest->SetAttribute( "Name", iIt->c_str( ) ); - e_conn->LinkEndChild( e_orig ); - e_conn->LinkEndChild( e_dest ); - root->LinkEndChild( e_conn ); - - } // fi + auto id = dest->GetInput( *iIt, k ); + if( od != NULL && od == id ) + { + tinyxml2::XMLElement* e_conn = doc->NewElement( "Connection" ); + tinyxml2::XMLElement* e_orig = doc->NewElement( "Origin" ); + tinyxml2::XMLElement* e_dest = doc->NewElement( "Destination" ); + e_orig->SetAttribute( "Filter", orig->GetName( ) ); + e_orig->SetAttribute( "Name", oIt->c_str( ) ); + e_dest->SetAttribute( "Filter", dest->GetName( ) ); + e_dest->SetAttribute( "Name", iIt->c_str( ) ); + e_conn->LinkEndChild( e_orig ); + e_conn->LinkEndChild( e_dest ); + root->LinkEndChild( e_conn ); + + } // fi + + } // rof } // rof diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index b29bf7d..ac367ba 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -8,8 +8,8 @@ SET( GenericFilters #ImageArithmeticFilters #ImageBooleanFilters - #ImageDistanceMaps - ImageGenericFilters + ImageDistanceMaps + #ImageGenericFilters #ImageGradientFilters ImageMeshFilters ImageSources @@ -17,7 +17,7 @@ SET( IO MeshFilters MeshSources - Widgets + #Widgets ) #IF(ParabolicMorphology_LOADED) diff --git a/plugins/GenericFilters/JoinBoundingBoxes.cxx b/plugins/GenericFilters/JoinBoundingBoxes.cxx index 4385072..32b0a64 100644 --- a/plugins/GenericFilters/JoinBoundingBoxes.cxx +++ b/plugins/GenericFilters/JoinBoundingBoxes.cxx @@ -7,12 +7,7 @@ cpPluginsGenericFilters::JoinBoundingBoxes:: JoinBoundingBoxes( ) : Superclass( ) { - this->_ConfigureInput( "Input0", true, false ); - this->_ConfigureInput( "Input1", false, false ); - this->_ConfigureInput( "Input2", false, false ); - this->_ConfigureInput( "Input3", false, false ); - this->_ConfigureInput( "Input4", false, false ); - this->_ConfigureInput( "Input5", false, false ); + this->_ConfigureInput( "Inputs", true, true ); this->_ConfigureOutput< cpPlugins::DataObjects::BoundingBox >( "Output" ); } @@ -28,26 +23,20 @@ _GenerateData( ) { typedef cpPlugins::BaseObjects::DataObject _TDO; typedef cpPlugins::DataObjects::BoundingBox _TBB; - _TDO* dobjs[ 5 ]; - - auto do0 = dynamic_cast< _TDO* >( this->GetInput( "Input0" ) ); - dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInput( "Input1" ) ); - dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInput( "Input2" ) ); - dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInput( "Input3" ) ); - dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInput( "Input4" ) ); - dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInput( "Input5" ) ); - auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) ); - out->SetDataObject( do0 ); - for( unsigned int d = 0; d < 5; ++d ) + auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) ); + unsigned int nInputs = this->GetInputSize( "Inputs" ); + for( unsigned int i = 0; i < nInputs; ++i ) { - if( dobjs[ d ] != NULL ) + auto in = dynamic_cast< _TDO* >( this->GetInput( "Inputs", i ) ); + if( i > 0 ) { _TBB::Pointer bb = _TBB::New( ); - bb->SetDataObject( dobjs[ d ] ); + bb->SetDataObject( in ); out->Blend( bb ); - - } // fi + } + else + out->SetDataObject( in ); } // rof } diff --git a/plugins/GenericFilters/JoinBoundingBoxes.h b/plugins/GenericFilters/JoinBoundingBoxes.h index 6b29a67..24183f6 100644 --- a/plugins/GenericFilters/JoinBoundingBoxes.h +++ b/plugins/GenericFilters/JoinBoundingBoxes.h @@ -11,7 +11,7 @@ namespace cpPluginsGenericFilters class cpPluginsGenericFilters_EXPORT JoinBoundingBoxes : public cpPlugins::BaseObjects::ProcessObject { - cpPluginsObject( + cpPluginsObject( JoinBoundingBoxes, cpPlugins::BaseObjects::ProcessObject, GenericFilters diff --git a/plugins/IO/IO.i b/plugins/IO/IO.i index 5470572..10c6afd 100644 --- a/plugins/IO/IO.i +++ b/plugins/IO/IO.i @@ -4,6 +4,7 @@ define io=ImageFileReader;ImageSeriesReader;ImageFileWriter tinclude itk#io#:h|hxx +cinclude complex cinclude itk#color_pixels#.h cinclude itk#vectors#.h cinclude itk#diff_tensors#.h @@ -13,6 +14,7 @@ cinclude itkImageAlgorithm.hxx cinclude itkSimpleDataObjectDecorator.hxx instances itk::#io#< itk::Image< #scalar_pixels#, #process_dims# > > +instances itk::#io#< itk::Image< std::complex< #real_types# >, #process_dims# > > instances itk::#io#< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > > instances itk::#io#< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > > instances itk::#io#< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > > diff --git a/plugins/IO/ImageReader.cxx b/plugins/IO/ImageReader.cxx index f4639a1..a54a540 100644 --- a/plugins/IO/ImageReader.cxx +++ b/plugins/IO/ImageReader.cxx @@ -255,29 +255,71 @@ _GD0( itk::ImageIOBase* io ) } else if( pt == itk::ImageIOBase::COMPLEX ) { +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< std::complex< float >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double + if( ct == itk::ImageIOBase::DOUBLE ) success = this->_GD1< std::complex< double >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_double } else if( pt == itk::ImageIOBase::COVARIANTVECTOR ) { +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::CovariantVector< float, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::CovariantVector< double, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_double } else if( pt == itk::ImageIOBase::POINT ) { +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Point< float, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Point< double, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_double } else if( pt == itk::ImageIOBase::VECTOR ) { +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Vector< float, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Vector< double, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_double } else if( pt == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR ) { +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::SymmetricSecondRankTensor< float, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::SymmetricSecondRankTensor< double, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_double } else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D ) { if( _Dim == 3 ) { +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::DiffusionTensor3D< float >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::DiffusionTensor3D< double >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_double } else this->_Error( "DiffusionTensor3D dimension not supported." ); } else if( pt == itk::ImageIOBase::MATRIX ) { +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Matrix< float, _Dim, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double + if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Matrix< double, _Dim, _Dim >, _Dim >( io ); +#endif // cpPlugins_CONFIG_INTEGER_TYPES_double } else if( pt == itk::ImageIOBase::OFFSET ) { @@ -285,7 +327,7 @@ _GD0( itk::ImageIOBase* io ) } else if( pt == itk::ImageIOBase::FIXEDARRAY ) { - } + } // fi return( success ); } diff --git a/plugins/IO/ImageReader.h b/plugins/IO/ImageReader.h index 25d59d4..2f43f66 100644 --- a/plugins/IO/ImageReader.h +++ b/plugins/IO/ImageReader.h @@ -1,5 +1,5 @@ -#ifndef __CPPLUGINSIO__IMAGEREADER__H__ -#define __CPPLUGINSIO__IMAGEREADER__H__ +#ifndef __cpPluginsIO__ImageReader__h__ +#define __cpPluginsIO__ImageReader__h__ #include #include @@ -28,6 +28,6 @@ namespace cpPluginsIO } // ecapseman -#endif // __CPPLUGINS__IO__IMAGEREADER__H__ +#endif // __cpPluginsIO__ImageReader__h__ // eof - $RCSfile$ diff --git a/plugins/IO/ImageReaderQDialog.h b/plugins/IO/ImageReaderQDialog.h index 08a45d7..80f57e1 100644 --- a/plugins/IO/ImageReaderQDialog.h +++ b/plugins/IO/ImageReaderQDialog.h @@ -1,5 +1,5 @@ -#ifndef __CPPLUGINSIO__IMAGEREADERQDIALOG__H__ -#define __CPPLUGINSIO__IMAGEREADERQDIALOG__H__ +#ifndef __cpPluginsIO__ImageReaderQDialog__h__ +#define __cpPluginsIO__ImageReaderQDialog__h__ #include @@ -33,6 +33,6 @@ namespace cpPluginsIO #endif // cpPlugins_QT4 -#endif // __CPPLUGINS__IO__IMAGEREADERQDIALOG__H__ +#endif // __cpPluginsIO__ImageReaderQDialog__h__ // eof - $RCSfile$ diff --git a/plugins/IO/ImageWriter.cxx b/plugins/IO/ImageWriter.cxx index d6d8f87..94a822b 100644 --- a/plugins/IO/ImageWriter.cxx +++ b/plugins/IO/ImageWriter.cxx @@ -118,9 +118,9 @@ void cpPluginsIO::ImageWriter:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_Image_ProcessDims( o, _GD0, ); - cpPlugins_Demangle_Image_DiffTensors3D( o, _GD1, ); - this->_Error( "Invalid input image dimension." ); + cpPlugins_Demangle_Image_ProcessDims( o, _GD0, ) + cpPlugins_Demangle_Image_DiffTensors3D( o, _GD1, ) + this->_Error( "Invalid input image dimension." ); } // ------------------------------------------------------------------------- @@ -128,12 +128,11 @@ template< class _TImage > void cpPluginsIO::ImageWriter:: _GD0( _TImage* image ) { - cpPlugins_Demangle_Image_IntPixels( image, _GD1, _TImage::ImageDimension, ); - cpPlugins_Demangle_Image_RealPixels( image, _GD1, _TImage::ImageDimension, ); - cpPlugins_Demangle_Image_ScalarPixels( image, _GD1, _TImage::ImageDimension, ); - cpPlugins_Demangle_Image_ColorPixels( image, _GD1, _TImage::ImageDimension, ); - cpPlugins_Demangle_Image_VectorPixels( image, _GD1, _TImage::ImageDimension, ); - this->_Error( "Invalid input image pixel type." ); + cpPlugins_Demangle_Image_ScalarPixels( image, _GD1, _TImage::ImageDimension, ) + cpPlugins_Demangle_Image_ComplexPixels( image, _GD1, _TImage::ImageDimension, ) + cpPlugins_Demangle_Image_ColorPixels( image, _GD1, _TImage::ImageDimension, ) + cpPlugins_Demangle_Image_VectorPixels( image, _GD1, _TImage::ImageDimension, ) + this->_Error( "Invalid input image pixel type." ); } // ------------------------------------------------------------------------- diff --git a/plugins/IO/ImageWriter.h b/plugins/IO/ImageWriter.h index 364e399..f3a32a3 100644 --- a/plugins/IO/ImageWriter.h +++ b/plugins/IO/ImageWriter.h @@ -1,5 +1,5 @@ -#ifndef __CPPLUGINSIO__IMAGEWRITER__H__ -#define __CPPLUGINSIO__IMAGEWRITER__H__ +#ifndef __cpPluginsIO__ImageWriter__h__ +#define __cpPluginsIO__ImageWriter__h__ #include #include @@ -27,6 +27,6 @@ namespace cpPluginsIO } // ecapseman -#endif // __CPPLUGINS__IO__IMAGEWRITER__H__ +#endif // __cpPluginsIO__ImageWriter__h__ // eof - $RCSfile$ diff --git a/plugins/IO/ImageWriterQDialog.h b/plugins/IO/ImageWriterQDialog.h index 54e39de..c1f1400 100644 --- a/plugins/IO/ImageWriterQDialog.h +++ b/plugins/IO/ImageWriterQDialog.h @@ -1,5 +1,5 @@ -#ifndef __CPPLUGINSIO__IMAGEWRITERQDIALOG__H__ -#define __CPPLUGINSIO__IMAGEWRITERQDIALOG__H__ +#ifndef __cpPluginsIO__ImageWriterQDialog__h__ +#define __cpPluginsIO__ImageWriterQDialog__h__ #include @@ -33,6 +33,6 @@ namespace cpPluginsIO #endif // cpPlugins_QT4 -#endif // __CPPLUGINS__IO__IMAGEWRITERQDIALOG__H__ +#endif // __cpPluginsIO__ImageWriterQDialog__h__ // eof - $RCSfile$ diff --git a/plugins/IO/MeshWriter.cxx b/plugins/IO/MeshWriter.cxx index fac2dc9..986eebb 100644 --- a/plugins/IO/MeshWriter.cxx +++ b/plugins/IO/MeshWriter.cxx @@ -1,5 +1,7 @@ #include #include + +#include #include // ------------------------------------------------------------------------- @@ -7,7 +9,9 @@ cpPluginsIO::MeshWriter:: MeshWriter( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Mesh >( "Input", true, false ); + typedef cpPlugins::DataObjects::Mesh _TMesh; + + this->_ConfigureInput< _TMesh >( "Input", true, false ); this->m_Parameters.Clear( ); this->m_Parameters.ConfigureAsSaveFileName( "FileName" ); this->m_Parameters.SetAcceptedFileExtensions( @@ -33,6 +37,7 @@ _GenerateData( ) auto f = this->_CreateVTK< vtkPolyDataWriter >( ); f->SetFileName( this->m_Parameters.GetSaveFileName( "FileName" ).c_str( ) ); f->SetInputData( mesh ); + f->SetFileTypeToBinary( ); f->Update( ); } diff --git a/plugins/IO/MeshWriter.h b/plugins/IO/MeshWriter.h index ed8f461..8b8b59f 100644 --- a/plugins/IO/MeshWriter.h +++ b/plugins/IO/MeshWriter.h @@ -1,5 +1,5 @@ -#ifndef __CPPLUGINSIO__MESHWRITER__H__ -#define __CPPLUGINSIO__MESHWRITER__H__ +#ifndef __cpPluginsIO__MeshWriter__h__ +#define __cpPluginsIO__MeshWriter__h__ #include #include @@ -16,6 +16,6 @@ namespace cpPluginsIO } // ecapseman -#endif // __CPPLUGINS__IO__MESHWRITER__H__ +#endif // __cpPluginsIO__MeshWriter__h__ // eof - $RCSfile$ diff --git a/plugins/ImageDistanceMaps/ImageDistanceMaps.i b/plugins/ImageDistanceMaps/ImageDistanceMaps.i new file mode 100644 index 0000000..a29aaaa --- /dev/null +++ b/plugins/ImageDistanceMaps/ImageDistanceMaps.i @@ -0,0 +1,11 @@ +header #define ITK_MANUAL_INSTANTIATION + +define filters=SignedMaurerDistanceMapImageFilter +define iter=ImageRegionConstIterator;ImageRegionIterator + +tinclude itk#filters#:h|hxx +tinclude itk#iter#:h|h + +instances itk::#filters#< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #real_types#, #process_dims# > > + +** eof - $RCSfile$ diff --git a/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx b/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx index 4100194..ad2b183 100644 --- a/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx +++ b/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx @@ -1,20 +1,18 @@ -#include +#include #include +#include -#include #include -#include -#include -#include -#include // ------------------------------------------------------------------------- cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter:: SignedMaurerDistanceMapImageFilter( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false ); - this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" ); + typedef cpPlugins::DataObjects::Image _TImage; + + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TImage >( "Output" ); this->m_Parameters.ConfigureAsReal( "BackgroundValue" ); this->m_Parameters.ConfigureAsBool( "InsideIsPositive" ); @@ -22,15 +20,18 @@ SignedMaurerDistanceMapImageFilter( ) this->m_Parameters.ConfigureAsBool( "UseImageSpacing" ); std::vector< std::string > choices; +#ifdef cpPlugins_CONFIG_REAL_TYPES_float choices.push_back( "float" ); +#endif // cpPlugins_CONFIG_REAL_TYPES_float +#ifdef cpPlugins_CONFIG_REAL_TYPES_double choices.push_back( "double" ); +#endif // cpPlugins_CONFIG_REAL_TYPES_double this->m_Parameters.ConfigureAsChoices( "OutputResolution", choices ); this->m_Parameters.SetReal( "BackgroundValue", 0 ); this->m_Parameters.SetBool( "InsideIsPositive", true ); this->m_Parameters.SetBool( "SquaredDistance", false ); this->m_Parameters.SetBool( "UseImageSpacing", true ); - this->m_Parameters.SetSelectedChoice( "OutputResolution", "float" ); } // ------------------------------------------------------------------------- @@ -44,9 +45,8 @@ void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_ImageScalars( o, _GD0, 2 ); - else cpPlugins_Demangle_ImageScalars( o, _GD0, 3 ); - else this->_Error( "Invalid input image." ); + cpPlugins_Demangle_Image_ProcessDims( o, _GD0, ) + this->_Error( "Invalid input image dimension." ); } // ------------------------------------------------------------------------- @@ -54,21 +54,31 @@ template< class _TImage > void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter:: _GD0( _TImage* image ) { - typedef itk::Image< float, _TImage::ImageDimension > _TFDmap; - typedef itk::Image< double, _TImage::ImageDimension > _TDDmap; + cpPlugins_Demangle_Image_ScalarPixels( image, _GD1, _TImage::ImageDimension, ) + this->_Error( "Invalid input image pixel type." ); +} +// ------------------------------------------------------------------------- +template< class _TImage > +void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter:: +_GD1( _TImage* image ) +{ std::string out_res = this->m_Parameters.GetSelectedChoice( "OutputResolution" ); - if( out_res == "float" ) this->_GD1< _TImage, _TFDmap >( image ); - else if( out_res == "double" ) this->_GD1< _TImage, _TDDmap >( image ); - else this->_Error( "Output resolution not supported." ); +#ifdef cpPlugins_CONFIG_REAL_TYPES_float + if( out_res == "float" ) this->_GD2< _TImage, float >( image ); +#endif // cpPlugins_CONFIG_REAL_TYPES_float +#ifdef cpPlugins_CONFIG_REAL_TYPES_double + if( out_res == "double" ) this->_GD2< _TImage, double >( image ); +#endif // cpPlugins_CONFIG_REAL_TYPES_double } // ------------------------------------------------------------------------- -template< class _TImage, class _TDMap > +template< class _TImage, class _TScalar > void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter:: -_GD1( _TImage* image ) +_GD2( _TImage* image ) { + typedef itk::Image< _TScalar, _TImage::ImageDimension > _TDMap; typedef itk::SignedMaurerDistanceMapImageFilter< _TImage, _TDMap > _TFilter; diff --git a/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.h b/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.h index 1a89167..dabbacc 100644 --- a/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.h +++ b/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.h @@ -1,7 +1,7 @@ #ifndef __cpPluginsImageDistanceMaps__SignedMaurerDistanceMapImageFilter__h__ #define __cpPluginsImageDistanceMaps__SignedMaurerDistanceMapImageFilter__h__ -#include +#include #include namespace cpPluginsImageDistanceMaps @@ -19,10 +19,13 @@ namespace cpPluginsImageDistanceMaps protected: template< class _TImage > - inline void _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); - template< class _TImage, class _TDMap > - inline void _GD1( _TImage* image ); + template< class _TImage > + inline void _GD1( _TImage* image ); + + template< class _TImage, class _TScalar > + inline void _GD2( _TImage* image ); }; } // ecapseman diff --git a/plugins/ImageMeshFilters/MarchingCubes.cxx b/plugins/ImageMeshFilters/MarchingCubes.cxx index 8273be7..e1166f9 100644 --- a/plugins/ImageMeshFilters/MarchingCubes.cxx +++ b/plugins/ImageMeshFilters/MarchingCubes.cxx @@ -11,8 +11,11 @@ cpPluginsImageMeshFilters::MarchingCubes:: MarchingCubes( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false ); - this->_ConfigureOutput< cpPlugins::DataObjects::Mesh >( "Output" ); + typedef cpPlugins::DataObjects::Image _TImage; + typedef cpPlugins::DataObjects::Mesh _TMesh; + + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TMesh >( "Output" ); this->m_Parameters.ConfigureAsRealList( "Thresholds" ); } diff --git a/plugins/ImageMeshFilters/MarchingCubes.h b/plugins/ImageMeshFilters/MarchingCubes.h index 267c393..c742ca3 100644 --- a/plugins/ImageMeshFilters/MarchingCubes.h +++ b/plugins/ImageMeshFilters/MarchingCubes.h @@ -1,5 +1,5 @@ -#ifndef __CPPLUGINSIMAGEMESH__MARCHINGCUBES__H__ -#define __CPPLUGINSIMAGEMESH__MARCHINGCUBES__H__ +#ifndef __cpPluginsImageMeshFilters__MarchingCubes__h__ +#define __cpPluginsImageMeshFilters__MarchingCubes__h__ #include #include @@ -20,6 +20,6 @@ namespace cpPluginsImageMeshFilters } // ecapseman -#endif // __CPPLUGINSIMAGEMESH__MARCHINGCUBES__H__ +#endif // __cpPluginsImageMeshFilters__MarchingCubes__h__ // eof - $RCSfile$ diff --git a/plugins/ImageMeshFilters/RasterMeshFilter.h b/plugins/ImageMeshFilters/RasterMeshFilter.h index b233c1b..1cb276c 100644 --- a/plugins/ImageMeshFilters/RasterMeshFilter.h +++ b/plugins/ImageMeshFilters/RasterMeshFilter.h @@ -24,10 +24,10 @@ namespace cpPluginsImageMeshFilters protected: template< class _TMesh > - inline void _GD0_2D( _TMesh* mesh ); + inline void _GD0_2D( _TMesh* mesh ); template< class _TMesh > - inline void _GD0_3D( _TMesh* mesh ); + inline void _GD0_3D( _TMesh* mesh ); }; } // ecapseman diff --git a/plugins/ImageSources/RandomImageSource.cxx b/plugins/ImageSources/RandomImageSource.cxx index d726fed..0246a19 100644 --- a/plugins/ImageSources/RandomImageSource.cxx +++ b/plugins/ImageSources/RandomImageSource.cxx @@ -30,12 +30,12 @@ RandomImageSource( ) pixels.push_back( "long" ); pixels.push_back( "ulong" ); #endif // cpPlugins_CONFIG_INTEGER_TYPES_long -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float +#ifdef cpPlugins_CONFIG_REAL_TYPES_float pixels.push_back( "float" ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_float -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double +#endif // cpPlugins_CONFIG_REAL_TYPES_float +#ifdef cpPlugins_CONFIG_REAL_TYPES_double pixels.push_back( "double" ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_double +#endif // cpPlugins_CONFIG_REAL_TYPES_double this->m_Parameters.ConfigureAsChoices( "PixelType", pixels ); std::vector< std::string > dims; @@ -67,27 +67,27 @@ _GenerateData( ) bool success = false; auto pixel = this->m_Parameters.GetSelectedChoice( "PixelType" ); #ifdef cpPlugins_CONFIG_INTEGER_TYPES_char - if( pixel == "char" ) success = this->_GD0< char >( ); - if( pixel == "uchar" ) success = this->_GD0< unsigned char >( ); + if( pixel == "char" ) success = this->_GD0< char >( ); + if( pixel == "uchar" ) success = this->_GD0< unsigned char >( ); #endif // cpPlugins_CONFIG_INTEGER_TYPES_char #ifdef cpPlugins_CONFIG_INTEGER_TYPES_short - if( pixel == "short" ) success = this->_GD0< short >( ); + if( pixel == "short" ) success = this->_GD0< short >( ); if( pixel == "ushort" ) success = this->_GD0< unsigned short >( ); #endif // cpPlugins_CONFIG_INTEGER_TYPES_short #ifdef cpPlugins_CONFIG_INTEGER_TYPES_int - if( pixel == "int" ) success = this->_GD0< int >( ); - if( pixel == "uint" ) success = this->_GD0< unsigned int >( ); + if( pixel == "int" ) success = this->_GD0< int >( ); + if( pixel == "uint" ) success = this->_GD0< unsigned int >( ); #endif // cpPlugins_CONFIG_INTEGER_TYPES_int #ifdef cpPlugins_CONFIG_INTEGER_TYPES_long - if( pixel == "long" ) success = this->_GD0< long >( ); - if( pixel == "ulong" ) success = this->_GD0< unsigned long >( ); + if( pixel == "long" ) success = this->_GD0< long >( ); + if( pixel == "ulong" ) success = this->_GD0< unsigned long >( ); #endif // cpPlugins_CONFIG_INTEGER_TYPES_long -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float - if( pixel == "float" ) success = this->_GD0< float >( ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_float -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double +#ifdef cpPlugins_CONFIG_REAL_TYPES_float + if( pixel == "float" ) success = this->_GD0< float >( ); +#endif // cpPlugins_CONFIG_REAL_TYPES_float +#ifdef cpPlugins_CONFIG_REAL_TYPES_double if( pixel == "double" ) success = this->_GD0< double >( ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_double +#endif // cpPlugins_CONFIG_REAL_TYPES_double if( !success ) this->_Error( "Invalid pixel type." ); } diff --git a/plugins/MeshFilters/AppendMeshesFilter.cxx b/plugins/MeshFilters/AppendMeshesFilter.cxx index 0d640e8..16f1f80 100644 --- a/plugins/MeshFilters/AppendMeshesFilter.cxx +++ b/plugins/MeshFilters/AppendMeshesFilter.cxx @@ -10,12 +10,7 @@ AppendMeshesFilter( ) { typedef cpPlugins::DataObjects::Mesh _TMesh; - this->_ConfigureInput< _TMesh >( "Input0", true, false ); - this->_ConfigureInput< _TMesh >( "Input1", true, false ); - this->_ConfigureInput< _TMesh >( "Input2", false, false ); - this->_ConfigureInput< _TMesh >( "Input3", false, false ); - this->_ConfigureInput< _TMesh >( "Input4", false, false ); - this->_ConfigureInput< _TMesh >( "Input5", false, false ); + this->_ConfigureInput< _TMesh >( "Inputs", true, true ); this->_ConfigureOutput< _TMesh >( "Output" ); } @@ -29,25 +24,11 @@ cpPluginsMeshFilters::AppendMeshesFilter:: void cpPluginsMeshFilters::AppendMeshesFilter:: _GenerateData( ) { - auto m0 = this->GetInputData< vtkPolyData >( "Input0" ); - auto m1 = this->GetInputData< vtkPolyData >( "Input1" ); - auto m2 = this->GetInput( "Input2" ); - auto m3 = this->GetInput( "Input3" ); - auto m4 = this->GetInput( "Input4" ); - auto m5 = this->GetInput( "Input5" ); - - if( m0 == NULL || m1 == NULL ) - this->_Error( "Invalid inputs." ); - auto filter = this->_CreateVTK< vtkAppendPolyData >( ); - filter->AddInputData( m0 ); - filter->AddInputData( m1 ); - if( m2 != NULL ) filter->AddInputData( m2->GetVTK< vtkPolyData >( ) ); - if( m3 != NULL ) filter->AddInputData( m3->GetVTK< vtkPolyData >( ) ); - if( m4 != NULL ) filter->AddInputData( m4->GetVTK< vtkPolyData >( ) ); - if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) ); + unsigned int nInputs = this->GetInputSize( "Inputs" ); + for( unsigned int i = 0; i < nInputs; ++i ) + filter->AddInputData( this->GetInputData< vtkPolyData >( "Inputs", i ) ); filter->Update( ); - this->GetOutput( "Output" )->SetVTK( filter->GetOutput( ) ); }