From 1b600247da314fe62d007ca8a0ce24d0006931f4 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Wed, 27 Jan 2016 19:40:10 -0500 Subject: [PATCH] ... --- .../cpPipelineEditor/App_cpPipelineEditor.cxx | 2 +- lib/cpPipelineEditor/Editor.cxx | 2 - lib/cpPlugins/Interface/Object.cxx | 24 +++++++++ lib/cpPlugins/Interface/Object.h | 3 ++ lib/cpPlugins/Interface/ProcessObject.cxx | 33 +++++++++--- lib/cpPlugins/Interface/ProcessObject.h | 30 ++++++++--- lib/cpPlugins/Interface/ProcessObject.hxx | 27 ++++++---- lib/cpPlugins/Interface/Workspace.cxx | 18 +++---- lib/cpPlugins/Interface/Workspace.h | 8 ++- .../BasicFilters/BinaryErodeImageFilter.cxx | 6 +-- .../BinaryThresholdImageFilter.cxx | 6 +-- lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx | 10 ++-- .../BasicFilters/ExtractSliceImageFilter.cxx | 6 +-- .../BasicFilters/InputDataReproducer.cxx | 33 ++++++++++++ .../BasicFilters/InputDataReproducer.h | 51 +++++++++++++++++++ .../Plugins/BasicFilters/MacheteFilter.cxx | 24 ++++----- .../BasicFilters/MacheteImageFilter.cxx | 6 +-- .../Plugins/BasicFilters/MarchingCubes.cxx | 6 +-- .../BasicFilters/MedianImageFilter.cxx | 6 +-- .../BasicFilters/OtsuThresholdImageFilter.cxx | 6 +-- .../RGBImageToOtherChannelsFilter.cxx | 6 +-- .../SignedMaurerDistanceMapImageFilter.cxx | 6 +-- .../Plugins/BasicFilters/SphereMeshSource.cxx | 3 +- lib/cpPlugins/Plugins/IO/ImageReader.cxx | 3 +- lib/cpPlugins/Plugins/IO/ImageWriter.cxx | 6 +-- lib/cpPlugins/Plugins/IO/MeshReader.cxx | 3 +- lib/cpPlugins/Plugins/IO/MeshWriter.cxx | 3 +- lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx | 8 +-- 28 files changed, 236 insertions(+), 109 deletions(-) create mode 100644 lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx create mode 100644 lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.h diff --git a/appli/cpPipelineEditor/App_cpPipelineEditor.cxx b/appli/cpPipelineEditor/App_cpPipelineEditor.cxx index 6af4723..6227c17 100644 --- a/appli/cpPipelineEditor/App_cpPipelineEditor.cxx +++ b/appli/cpPipelineEditor/App_cpPipelineEditor.cxx @@ -308,7 +308,7 @@ _ShowFilterOutput( auto filter = this->m_Workspace->GetFilter( filter_name ); if( filter != NULL ) { - auto output = filter->GetOutput< _TDataObject >( output_name ); + auto output = filter->GetOutputData< _TDataObject >( output_name ); if( output != NULL ) { std::string data_name = output_name + "@" + filter_name; diff --git a/lib/cpPipelineEditor/Editor.cxx b/lib/cpPipelineEditor/Editor.cxx index 736fecc..7dc6251 100644 --- a/lib/cpPipelineEditor/Editor.cxx +++ b/lib/cpPipelineEditor/Editor.cxx @@ -132,7 +132,6 @@ bool cpPipelineEditor::Editor:: deleteFilter( const std::string& name ) { std::cout << name << std::endl; -#error delete filter return( false ); } @@ -148,7 +147,6 @@ deleteConnection( << des << " " << in << " " << out << std::endl; -#error delete connection return( false ); } diff --git a/lib/cpPlugins/Interface/Object.cxx b/lib/cpPlugins/Interface/Object.cxx index 61da5c1..3e25916 100644 --- a/lib/cpPlugins/Interface/Object.cxx +++ b/lib/cpPlugins/Interface/Object.cxx @@ -22,6 +22,30 @@ SetViewCoords( float x, float y ) this->SetViewY( y ); } +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Object:: +SetITK( itk::LightObject* o ) +{ + if( this->m_ITKObject.GetPointer( ) != o ) + { + this->m_ITKObject = o; + this->Modified( ); + + } // fi +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Object:: +SetVTK( vtkObjectBase* o ) +{ + if( this->m_VTKObject.GetPointer( ) != o ) + { + this->m_VTKObject = o; + this->Modified( ); + + } // fi +} + // ------------------------------------------------------------------------- cpPlugins::Interface::Object:: Object( ) diff --git a/lib/cpPlugins/Interface/Object.h b/lib/cpPlugins/Interface/Object.h index 92de13c..dd7d9b6 100644 --- a/lib/cpPlugins/Interface/Object.h +++ b/lib/cpPlugins/Interface/Object.h @@ -43,6 +43,9 @@ namespace cpPlugins virtual void Modified( ) const; void SetViewCoords( float x, float y ); + void SetITK( itk::LightObject* o ); + void SetVTK( vtkObjectBase* o ); + template< class T > inline T* GetITK( ); diff --git a/lib/cpPlugins/Interface/ProcessObject.cxx b/lib/cpPlugins/Interface/ProcessObject.cxx index c710a8f..5434319 100644 --- a/lib/cpPlugins/Interface/ProcessObject.cxx +++ b/lib/cpPlugins/Interface/ProcessObject.cxx @@ -46,7 +46,9 @@ GetNumberOfOutputs( ) const // ------------------------------------------------------------------------- bool cpPlugins::Interface::ProcessObject:: -SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj ) +SetInput( + const std::string& id, cpPlugins::Interface::DataObject::Pointer* dobj + ) { _TDataContainer::iterator i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) @@ -69,9 +71,9 @@ Update( ) _TDataContainer::iterator i = this->m_Inputs.begin( ); for( ; i != this->m_Inputs.end( ) && r == ""; ++i ) { - if( i->second.IsNotNull( ) ) + if( i->second->IsNotNull( ) ) { - Self* src = dynamic_cast< Self* >( i->second->GetSource( ) ); + Self* src = dynamic_cast< Self* >( ( *( i->second ) )->GetSource( ) ); if( src != NULL ) r = src->Update( ); } @@ -94,8 +96,8 @@ DisconnectOutputs( ) { _TDataContainer::iterator i = this->m_Outputs.begin( ); for( ; i != this->m_Outputs.end( ); ++i ) - if( i->second.IsNotNull( ) ) - i->second->DisconnectPipeline( ); + if( i->second->IsNotNull( ) ) + ( *( i->second ) )->DisconnectPipeline( ); } // ------------------------------------------------------------------------- @@ -184,14 +186,31 @@ cpPlugins::Interface::ProcessObject:: if( this->m_ParametersDialog != NULL ) delete this->m_ParametersDialog; #endif // cpPlugins_Interface_QT4 + + /* + auto iIt = this->m_Inputs.begin( ); + for( ; iIt != this->m_Inputs.end( ); ++iIt ) + delete iIt->second; + this->m_Inputs.clear( ); + */ + + auto oIt = this->m_Outputs.begin( ); + for( ; oIt != this->m_Outputs.end( ); ++oIt ) + delete oIt->second; + this->m_Outputs.clear( ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: _AddInput( const std::string& name ) { - this->m_Inputs[ name ] = NULL; - this->Modified( ); + auto i = this->m_Inputs.find( name ); + if( i == this->m_Inputs.end( ) ) + { + this->m_Inputs[ name ] = NULL; + this->Modified( ); + + } // fi } // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index b9deb92..ec6cb2a 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -61,7 +61,7 @@ namespace cpPlugins unsigned int GetNumberOfInputs( ) const; unsigned int GetNumberOfOutputs( ) const; - virtual bool SetInput( const std::string& id, DataObject* dobj ); + virtual bool SetInput( const std::string& id, DataObject::Pointer* dobj ); virtual std::string Update( ); virtual void DisconnectOutputs( ); @@ -76,16 +76,34 @@ namespace cpPlugins virtual bool ExecConfigurationDialog( QWidget* parent ); template< class T > - inline T* GetInput( const std::string& id ); + inline T* GetInputData( const std::string& id ); template< class T > - inline const T* GetInput( const std::string& id ) const; + inline const T* GetInputData( const std::string& id ) const; template< class T > - inline T* GetOutput( const std::string& id ); + inline T* GetOutputData( const std::string& id ); template< class T > - inline const T* GetOutput( const std::string& id ) const; + inline const T* GetOutputData( const std::string& id ) const; + + DataObject::Pointer* GetOutputPort( const std::string& id ) + { + auto i = this->m_Outputs.find( id ); + if( i != this->m_Outputs.end( ) ) + return( i->second ); + else + return( NULL ); + } + + const DataObject::Pointer* GetOutputPort( const std::string& id ) const + { + auto i = this->m_Outputs.find( id ); + if( i != this->m_Outputs.end( ) ) + return( i->second ); + else + return( NULL ); + } protected: ProcessObject( ); @@ -117,7 +135,7 @@ namespace cpPlugins SimpleMPRWidget* m_MPRViewer; bool m_Interactive; - typedef std::map< std::string, DataObject::Pointer > _TDataContainer; + typedef std::map< std::string, DataObject::Pointer* > _TDataContainer; _TDataContainer m_Inputs; _TDataContainer m_Outputs; }; diff --git a/lib/cpPlugins/Interface/ProcessObject.hxx b/lib/cpPlugins/Interface/ProcessObject.hxx index 33b4a20..a3362fc 100644 --- a/lib/cpPlugins/Interface/ProcessObject.hxx +++ b/lib/cpPlugins/Interface/ProcessObject.hxx @@ -4,11 +4,11 @@ // ------------------------------------------------------------------------- template< class T > T* cpPlugins::Interface::ProcessObject:: -GetInput( const std::string& id ) +GetInputData( const std::string& id ) { _TDataContainer::iterator i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) - return( dynamic_cast< T* >( i->second.GetPointer( ) ) ); + return( dynamic_cast< T* >( i->second->GetPointer( ) ) ); else return( NULL ); } @@ -16,11 +16,11 @@ GetInput( const std::string& id ) // ------------------------------------------------------------------------- template< class T > const T* cpPlugins::Interface::ProcessObject:: -GetInput( const std::string& id ) const +GetInputData( const std::string& id ) const { _TDataContainer::const_iterator i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) - return( dynamic_cast< const T* >( i->second.GetPointer( ) ) ); + return( dynamic_cast< const T* >( i->second->GetPointer( ) ) ); else return( NULL ); } @@ -28,11 +28,11 @@ GetInput( const std::string& id ) const // ------------------------------------------------------------------------- template< class T > T* cpPlugins::Interface::ProcessObject:: -GetOutput( const std::string& id ) +GetOutputData( const std::string& id ) { _TDataContainer::iterator i = this->m_Outputs.find( id ); if( i != this->m_Outputs.end( ) ) - return( dynamic_cast< T* >( i->second.GetPointer( ) ) ); + return( dynamic_cast< T* >( i->second->GetPointer( ) ) ); else return( NULL ); } @@ -40,11 +40,11 @@ GetOutput( const std::string& id ) // ------------------------------------------------------------------------- template< class T > const T* cpPlugins::Interface::ProcessObject:: -GetOutput( const std::string& id ) const +GetOutputData( const std::string& id ) const { _TDataContainer::const_iterator i = this->m_Outputs.find( id ); if( i != this->m_Outputs.end( ) ) - return( dynamic_cast< const T* >( i->second.GetPointer( ) ) ); + return( dynamic_cast< const T* >( i->second->GetPointer( ) ) ); else return( NULL ); } @@ -54,8 +54,15 @@ template< class O > void cpPlugins::Interface::ProcessObject:: _AddOutput( const std::string& id ) { - this->m_Outputs[ id ] = O::New( ); - this->m_Outputs[ id ]->SetSource( this ); + auto oIt = this->m_Outputs.find( id ); + if( oIt == this->m_Outputs.end( ) ) + { + this->m_Outputs[ id ] = new DataObject::Pointer( ); + oIt = this->m_Outputs.find( id ); + + } // fi + *( oIt->second ) = O::New( ); + ( *( oIt->second ) )->SetSource( this ); this->Modified( ); } diff --git a/lib/cpPlugins/Interface/Workspace.cxx b/lib/cpPlugins/Interface/Workspace.cxx index ab1891a..b37c2ca 100644 --- a/lib/cpPlugins/Interface/Workspace.cxx +++ b/lib/cpPlugins/Interface/Workspace.cxx @@ -106,11 +106,12 @@ HasFilter( const std::string& name ) const } // ------------------------------------------------------------------------- -bool cpPlugins::Interface::Workspace:: +cpPlugins::Interface::Workspace:: +TFilter* cpPlugins::Interface::Workspace:: CreateFilter( const std::string& filter, const std::string& name ) { if( this->m_Plugins == NULL ) - return( false ); + return( NULL ); // Get or create new filter from name if( !( this->m_Graph->HasVertexIndex( name ) ) ) @@ -124,13 +125,12 @@ CreateFilter( const std::string& filter, const std::string& name ) TObject::Pointer o = f.GetPointer( ); this->m_Graph->SetVertex( name, o ); - return( true ); - } - else - return( false ); + + } // fi + return( f.GetPointer( ) ); } else - return( true ); + return( this->GetFilter( name ) ); } // ------------------------------------------------------------------------- @@ -211,7 +211,7 @@ Connect( return( false ); // Real connection - dest->SetInput( input_name, orig->GetOutput< TData >( output_name ) ); + dest->SetInput( input_name, orig->GetOutputPort( output_name ) ); this->m_Graph->AddEdge( orig_filter, dest_filter, TConnection( output_name, input_name ) @@ -221,7 +221,7 @@ Connect( // ------------------------------------------------------------------------- bool cpPlugins::Interface::Workspace:: -Connect( TData* input_object, const std::string& input_name ) +Connect( TData::Pointer* input_object, const std::string& input_name ) { auto port = this->m_ExposedInputPorts.find( input_name ); if( port != this->m_ExposedInputPorts.end( ) ) diff --git a/lib/cpPlugins/Interface/Workspace.h b/lib/cpPlugins/Interface/Workspace.h index ec55470..b4c4641 100644 --- a/lib/cpPlugins/Interface/Workspace.h +++ b/lib/cpPlugins/Interface/Workspace.h @@ -70,7 +70,9 @@ namespace cpPlugins TFilter* GetFilter( const std::string& name ); const TFilter* GetFilter( const std::string& name ) const; bool HasFilter( const std::string& name ) const; - bool CreateFilter( const std::string& filter, const std::string& name ); + TFilter* CreateFilter( + const std::string& filter, const std::string& name + ); bool RenameFilter( const std::string& old_name, const std::string& new_name ); @@ -90,7 +92,9 @@ namespace cpPlugins const std::string& orig_filter, const std::string& dest_filter, const std::string& output_name, const std::string& input_name ); - bool Connect( TData* input_object, const std::string& exposed_port ); + bool Connect( + TData::Pointer* input_object, const std::string& exposed_port + ); void RemoveConnection( const std::string& dest_filter, const std::string& input_name ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx index fb9d6ea..1bab79d 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx @@ -27,8 +27,7 @@ cpPlugins::BasicFilters::BinaryErodeImageFilter:: std::string cpPlugins::BasicFilters::BinaryErodeImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "BinaryErodeImageFilter: No input image." ); @@ -79,8 +78,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx index 1956112..5f159ce 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx @@ -32,8 +32,7 @@ cpPlugins::BasicFilters::BinaryThresholdImageFilter:: std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "BinaryThresholdImageFilter: No input image." ); @@ -85,8 +84,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx b/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx index 3d3104f..fcb0269 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx @@ -29,10 +29,9 @@ std::string cpPlugins::BasicFilters::Cutter:: _GenerateData( ) { // Get inputs - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( "InputMesh" ); - cpPlugins::Interface::ImplicitFunction* function = - this->GetInput< cpPlugins::Interface::ImplicitFunction >( + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "InputMesh" ); + auto function = + this->GetInputData< cpPlugins::Interface::ImplicitFunction >( "InputFunction" ); if( function == NULL ) @@ -47,8 +46,7 @@ _GenerateData( ) cutter->Update( ); // Execute filter - cpPlugins::Interface::Mesh* out = - this->GetOutput< cpPlugins::Interface::Mesh >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" ); out->SetVTK( cutter->GetOutput( ) ); return( "" ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx index 3f566e5..de00779 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx @@ -28,8 +28,7 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter:: std::string cpPlugins::BasicFilters::ExtractSliceImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "ExtractSliceImageFilter: No input image." ); @@ -80,8 +79,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx new file mode 100644 index 0000000..78d5da4 --- /dev/null +++ b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx @@ -0,0 +1,33 @@ +#include "InputDataReproducer.h" + +// ------------------------------------------------------------------------- +cpPlugins::BasicFilters::InputDataReproducer:: +InputDataReproducer( ) + : Superclass( ) +{ + this->_AddInput( "Input" ); + this->_AddOutput< cpPlugins::Interface::DataObject >( "Output" ); + this->m_Parameters->Clear( ); +} + +// ------------------------------------------------------------------------- +cpPlugins::BasicFilters::InputDataReproducer:: +~InputDataReproducer( ) +{ +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::BasicFilters::InputDataReproducer:: +_GenerateData( ) +{ + auto i = this->m_Inputs.find( "Input" ); + auto o = this->m_Outputs.find( "Output" ); + if( i == this->m_Inputs.end( ) || o == this->m_Outputs.end( ) ) + return( "InputDataReproducer: No input/output ports." ); + + // Connect output + *( o->second ) = *( i->second ); + return( "" ); +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.h b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.h new file mode 100644 index 0000000..870266f --- /dev/null +++ b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.h @@ -0,0 +1,51 @@ +#ifndef __CPPLUGINS__PLUGINS__INPUTDATAREPRODUCER__H__ +#define __CPPLUGINS__PLUGINS__INPUTDATAREPRODUCER__H__ + +#include +#include + +namespace cpPlugins +{ + namespace BasicFilters + { + /** + */ + class cpPluginsBasicFilters_EXPORT InputDataReproducer + : public cpPlugins::Interface::ProcessObject + { + public: + typedef InputDataReproducer Self; + typedef cpPlugins::Interface::ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( + InputDataReproducer, + cpPluginsInterfaceProcessObject + ); + cpPlugins_Id_Macro( + cpPlugins::BasicFilters::InputDataReproducer, + PortObjects + ); + + protected: + InputDataReproducer( ); + virtual ~InputDataReproducer( ); + + virtual std::string _GenerateData( ); + + private: + // Purposely not implemented + InputDataReproducer( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__PLUGINS__INPUTDATAREPRODUCER__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx index 71b3af4..4dfcd5a 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx @@ -130,8 +130,7 @@ ExecConfigurationDialog( QWidget* parent ) // Get bounding box double bbox[ 6 ]; - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); bool input_found = false; if( image != NULL ) { @@ -139,8 +138,7 @@ ExecConfigurationDialog( QWidget* parent ) input_found = true; } // fi - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( "Input" ); + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" ); if( mesh != NULL ) { mesh->GetVTK< vtkPolyData >( )->GetBounds( bbox ); @@ -218,12 +216,10 @@ cpPlugins::BasicFilters::MacheteFilter:: std::string cpPlugins::BasicFilters::MacheteFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image != NULL ) return( this->_FromImage( image ) ); - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( "Input" ); + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" ); if( mesh == NULL ) return( this->_FromMesh( mesh ) ); return( "MacheteFilter: No valid input." ); @@ -290,23 +286,23 @@ _RealImage( itk::DataObject* dobj ) filter->Update( ); // Get output names - auto pos_name = this->GetOutput< _TObj >( "PositiveOutput" )->GetName( ); - auto neg_name = this->GetOutput< _TObj >( "NegativeOutput" )->GetName( ); + auto pos_name = this->GetOutputData< _TObj >( "PositiveOutput" )->GetName( ); + auto neg_name = this->GetOutputData< _TObj >( "NegativeOutput" )->GetName( ); // Connect outputs (and correct their types and names) - _TImage* pos_out = this->GetOutput< _TImage >( "PositiveOutput" ); + _TImage* pos_out = this->GetOutputData< _TImage >( "PositiveOutput" ); if( pos_out == NULL ) { this->_AddOutput< _TImage >( "PositiveOutput" ); - pos_out = this->GetOutput< _TImage >( "PositiveOutput" ); + pos_out = this->GetOutputData< _TImage >( "PositiveOutput" ); pos_out->SetName( pos_name ); } // fi - _TImage* neg_out = this->GetOutput< _TImage >( "NegativeOutput" ); + _TImage* neg_out = this->GetOutputData< _TImage >( "NegativeOutput" ); if( neg_out == NULL ) { this->_AddOutput< _TImage >( "NegativeOutput" ); - neg_out = this->GetOutput< _TImage >( "NegativeOutput" ); + neg_out = this->GetOutputData< _TImage >( "NegativeOutput" ); neg_out->SetName( neg_name ); } // fi diff --git a/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx index 980ba8d..a488ba9 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx @@ -38,8 +38,7 @@ cpPlugins::BasicFilters::MacheteImageFilter:: std::string cpPlugins::BasicFilters::MacheteImageFilter:: _GenerateData() { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >("Input"); + auto image = this->GetInputData< cpPlugins::Interface::Image >("Input"); if (image == NULL) return("MacheteImageFilter: No input image."); @@ -90,8 +89,7 @@ _RealGD(itk::DataObject* image) filter->Update(); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >("Output"); + auto out = this->GetOutputData< cpPlugins::Interface::Image >("Output"); if (out != NULL) { out->SetITK< O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx b/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx index ce6aa32..95ede25 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx @@ -28,8 +28,7 @@ std::string cpPlugins::BasicFilters::MarchingCubes:: _GenerateData( ) { // Get input - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "MarchingCubes: Input data is not a valid image." ); vtkImageData* vtk_image = image->GetVTK< vtkImageData >( ); @@ -62,8 +61,7 @@ _GenerateData( ) return( "MarchingCubes: Input data does not have a valid dimension." ); // Execute filter - cpPlugins::Interface::Mesh* out = - this->GetOutput< cpPlugins::Interface::Mesh >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" ); out->SetVTK( pd ); return( "" ); } diff --git a/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx index a74714c..02eed73 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx @@ -25,8 +25,7 @@ cpPlugins::BasicFilters::MedianImageFilter:: std::string cpPlugins::BasicFilters::MedianImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "MedianImageFilter: No input image." ); @@ -70,8 +69,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx index dd2bd1c..3a3f12c 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx @@ -30,8 +30,7 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter:: std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "OtsuThresholdImageFilter: No input image." ); @@ -78,8 +77,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx index 433c0fa..f06cda8 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx @@ -32,8 +32,7 @@ cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter:: std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "RGBImageToOtherChannelsFilter: No input image." ); @@ -86,8 +85,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< _O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.cxx index 1478555..1487e38 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.cxx @@ -38,8 +38,7 @@ cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter:: std::string cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "SignedMaurerDistanceMapImageFilter: No input image." ); @@ -98,8 +97,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx b/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx index cad8eb8..f989635 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx @@ -50,8 +50,7 @@ _GenerateData( ) src->Update( ); // Execute filter - cpPlugins::Interface::Mesh* out = - this->GetOutput< cpPlugins::Interface::Mesh >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" ); out->SetVTK( src->GetOutput( ) ); return( "" ); } diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.cxx b/lib/cpPlugins/Plugins/IO/ImageReader.cxx index d2d619c..c093e21 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageReader.cxx @@ -360,8 +360,7 @@ template< class I > std::string cpPlugins::IO::ImageReader:: _RealGD( const TStringList& names ) { - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out == NULL ) return( "ImageReader: No output object properly created." ); diff --git a/lib/cpPlugins/Plugins/IO/ImageWriter.cxx b/lib/cpPlugins/Plugins/IO/ImageWriter.cxx index 5b2f89b..a06f2d2 100644 --- a/lib/cpPlugins/Plugins/IO/ImageWriter.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageWriter.cxx @@ -77,8 +77,7 @@ template< unsigned int D > std::string cpPlugins::IO::ImageWriter:: _GD0_Image( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "ImageWriter: No input image." ); @@ -95,8 +94,7 @@ template< unsigned int D > std::string cpPlugins::IO::ImageWriter:: _GD0_VectorImage( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "ImageWriter: No input image." ); diff --git a/lib/cpPlugins/Plugins/IO/MeshReader.cxx b/lib/cpPlugins/Plugins/IO/MeshReader.cxx index 27d8f55..d1410e8 100644 --- a/lib/cpPlugins/Plugins/IO/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshReader.cxx @@ -103,8 +103,7 @@ _GD1( ) pdr->SetFileName( fname.c_str( ) ); pdr->Update( ); - cpPlugins::Interface::Mesh* out = - this->GetOutput< cpPlugins::Interface::Mesh >( "Output" ); + auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" ); if( out != NULL ) out->SetVTK( pdr->GetOutput( ) ); else diff --git a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx index feb05ad..37b936c 100644 --- a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx @@ -64,8 +64,7 @@ cpPlugins::IO::MeshWriter:: std::string cpPlugins::IO::MeshWriter:: _GenerateData( ) { - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( "Input" ); + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" ); if( mesh == NULL ) return( "MeshWriter: No input mesh." ); vtkPolyData* i = mesh->GetVTK< vtkPolyData >( ); diff --git a/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx b/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx index 8dbaf9f..c5c8383 100644 --- a/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx +++ b/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx @@ -33,8 +33,8 @@ _GenerateData( ) typedef itk::ImageBase< 2 > _2DImage; typedef itk::ImageBase< 3 > _3DImage; - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "ReferenceImage" ); + auto image = + this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" ); if( image == NULL ) return( "SeedWidget: No input image." ); @@ -60,8 +60,8 @@ _GD0( itk::DataObject* image ) typedef cpExtensions::Interaction::ImageInteractorStyle _S; I* base_image = dynamic_cast< I* >( image ); - cpPlugins::Interface::PointList* out = - this->GetOutput< cpPlugins::Interface::PointList >( "Output" ); + auto out = + this->GetOutputData< cpPlugins::Interface::PointList >( "Output" ); double aux_pnt[ 3 ]; unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3; -- 2.47.1