From cb833d2fface96e020fe91584d2206860a8174ee Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Tue, 23 Dec 2014 12:10:09 +0100 Subject: [PATCH] Garbage collector added --- appli/ImageMPR/ImageMPR.cxx | 12 +-- appli/ImageMPR/ImageMPR.h | 2 +- appli/examples/example_LoadPlugins.cxx | 2 +- appli/examples/example_MPR.cxx | 12 +-- .../example_RGBImageToHSVChannels.cxx | 34 ++----- .../example_ReadImageSeriesWriteImage.cxx | 22 ++-- appli/examples/example_ReadQuadEdgeMesh.cxx | 12 +-- appli/examples/example_ReadWriteImage.cxx | 25 ++--- appli/examples/example_RenderQuadEdgeMesh.cxx | 12 +-- doc/uml/cpPlugins_classes.dia | Bin 4306 -> 5632 bytes lib/cpPlugins/Interface/DataObject.cxx | 55 ++++++---- lib/cpPlugins/Interface/DataObject.h | 36 ++++--- lib/cpPlugins/Interface/FilterObject.cxx | 30 ++++++ lib/cpPlugins/Interface/FilterObject.h | 48 +++++++++ lib/cpPlugins/Interface/Image.cxx | 94 +++++++++--------- lib/cpPlugins/Interface/Image.h | 25 +++-- lib/cpPlugins/Interface/ImageSink.cxx | 30 ++++++ lib/cpPlugins/Interface/ImageSink.h | 48 +++++++++ lib/cpPlugins/Interface/ImageSource.cxx | 30 ++++++ lib/cpPlugins/Interface/ImageSource.h | 48 +++++++++ .../Interface/ImageToImageFilter.cxx | 21 ++-- lib/cpPlugins/Interface/ImageToImageFilter.h | 22 +++- lib/cpPlugins/Interface/ImageToMeshFilter.cxx | 21 ++-- lib/cpPlugins/Interface/ImageToMeshFilter.h | 22 +++- .../Interface/Instances_itkImage.cxx | 90 ++++++++--------- lib/cpPlugins/Interface/Interface.cxx | 18 +++- lib/cpPlugins/Interface/Interface.h | 6 +- lib/cpPlugins/Interface/Mesh.cxx | 40 ++++---- lib/cpPlugins/Interface/Mesh.h | 21 +++- lib/cpPlugins/Interface/MeshSink.cxx | 30 ++++++ lib/cpPlugins/Interface/MeshSink.h | 48 +++++++++ lib/cpPlugins/Interface/MeshSource.cxx | 30 ++++++ lib/cpPlugins/Interface/MeshSource.h | 48 +++++++++ lib/cpPlugins/Interface/MeshToImageFilter.cxx | 30 ++++++ lib/cpPlugins/Interface/MeshToImageFilter.h | 48 +++++++++ lib/cpPlugins/Interface/MeshToMeshFilter.cxx | 30 ++++++ lib/cpPlugins/Interface/MeshToMeshFilter.h | 48 +++++++++ lib/cpPlugins/Interface/Object.cxx | 20 ++-- lib/cpPlugins/Interface/Object.h | 44 +++++++- lib/cpPlugins/Interface/ProcessObject.cxx | 79 +++++++-------- lib/cpPlugins/Interface/ProcessObject.h | 38 +++---- lib/cpPlugins/Interface/SinkObject.cxx | 21 ++-- lib/cpPlugins/Interface/SinkObject.h | 18 +++- lib/cpPlugins/Interface/SourceObject.cxx | 21 ++-- lib/cpPlugins/Interface/SourceObject.h | 18 +++- lib/cpPlugins/Plugins/ImageReader.cxx | 21 ++-- lib/cpPlugins/Plugins/ImageReader.h | 29 ++++-- lib/cpPlugins/Plugins/ImageSeriesReader.cxx | 21 ++-- lib/cpPlugins/Plugins/ImageSeriesReader.h | 28 ++++-- lib/cpPlugins/Plugins/ImageWriter.cxx | 25 ++--- lib/cpPlugins/Plugins/ImageWriter.h | 29 ++++-- lib/cpPlugins/Plugins/MarchingCubes.cxx | 14 +-- lib/cpPlugins/Plugins/MarchingCubes.h | 23 +++-- lib/cpPlugins/Plugins/MeshReader.cxx | 21 ++-- lib/cpPlugins/Plugins/MeshReader.h | 29 ++++-- .../Plugins/RGBImageToHSVChannelsFilter.cxx | 54 +++++----- .../Plugins/RGBImageToHSVChannelsFilter.h | 22 ++-- 57 files changed, 1232 insertions(+), 493 deletions(-) create mode 100644 lib/cpPlugins/Interface/FilterObject.cxx create mode 100644 lib/cpPlugins/Interface/ImageSink.cxx create mode 100644 lib/cpPlugins/Interface/ImageSink.h create mode 100644 lib/cpPlugins/Interface/ImageSource.cxx create mode 100644 lib/cpPlugins/Interface/ImageSource.h create mode 100644 lib/cpPlugins/Interface/MeshSink.cxx create mode 100644 lib/cpPlugins/Interface/MeshSink.h create mode 100644 lib/cpPlugins/Interface/MeshSource.cxx create mode 100644 lib/cpPlugins/Interface/MeshSource.h create mode 100644 lib/cpPlugins/Interface/MeshToImageFilter.cxx create mode 100644 lib/cpPlugins/Interface/MeshToMeshFilter.cxx diff --git a/appli/ImageMPR/ImageMPR.cxx b/appli/ImageMPR/ImageMPR.cxx index 26c8f34..1d05703 100644 --- a/appli/ImageMPR/ImageMPR.cxx +++ b/appli/ImageMPR/ImageMPR.cxx @@ -46,7 +46,6 @@ ImageMPR:: // Delete objects delete this->m_UI; delete this->m_MPR; - if( this->m_InputImage != NULL ) delete this->m_InputImage; } // ------------------------------------------------------------------------- @@ -99,17 +98,15 @@ _triggered_actionOpenInputImage( ) if( !( dialog.exec( ) ) ) return; - if( this->m_InputImage != NULL ) - delete this->m_InputImage; this->m_InputImage = NULL; unsigned int nFiles = dialog.selectedFiles( ).size( ); if( nFiles == 1 ) { std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( ); - TPlugin* reader = - dynamic_cast< TPlugin* >( - this->m_Plugins.CreateObject( this->m_BaseClasses[ "ImageReader" ] ) + TPlugin::Pointer reader = + this->m_Plugins.CreateProcessObject( + this->m_BaseClasses[ "ImageReader" ] ); TParameters reader_params = reader->GetDefaultParameters( ); @@ -132,7 +129,6 @@ _triggered_actionOpenInputImage( ) tr( "Error reading single image" ), tr( err.c_str( ) ) ); - delete reader; } else if( nFiles > 1 ) { @@ -154,7 +150,7 @@ _triggered_actionOpenInputImage( ) } // fi - if( this->m_InputImage != NULL ) + if( this->m_InputImage.IsNotNull( ) ) this->m_MPR->SetImage( this->m_InputImage->GetVTKImageData( ) ); } diff --git a/appli/ImageMPR/ImageMPR.h b/appli/ImageMPR/ImageMPR.h index 69b883a..c9bb20f 100644 --- a/appli/ImageMPR/ImageMPR.h +++ b/appli/ImageMPR/ImageMPR.h @@ -62,7 +62,7 @@ private: TStringMap m_BaseClasses; // Real data - TPluginImage* m_InputImage; + TPluginImage::Pointer m_InputImage; // Visualization stuff TMPR* m_MPR; diff --git a/appli/examples/example_LoadPlugins.cxx b/appli/examples/example_LoadPlugins.cxx index 383c85b..4bc43d0 100644 --- a/appli/examples/example_LoadPlugins.cxx +++ b/appli/examples/example_LoadPlugins.cxx @@ -25,7 +25,7 @@ int main( int argc, char* argv[] ) TClasses::const_iterator cIt = plugins.GetClasses( ).begin( ); TClasses::const_iterator end_cIt = plugins.GetClasses( ).end( ); for( ; cIt != end_cIt; ++cIt ) - std::cout << "\t:= " << cIt->first << std::endl; + std::cout << " := " << cIt->first << std::endl; std::cout << "---------------------------------------------" << std::endl; return( 0 ); diff --git a/appli/examples/example_MPR.cxx b/appli/examples/example_MPR.cxx index 3f11a4f..9a8865c 100644 --- a/appli/examples/example_MPR.cxx +++ b/appli/examples/example_MPR.cxx @@ -41,13 +41,10 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; typedef TProcessObject::TParameters TParameters; - cpPlugins::Interface::ProcessObject* reader; + cpPlugins::Interface::ProcessObject::Pointer reader; - reader = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::ImageReader" ) - ); - if( reader == NULL ) + reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" ); + if( reader.IsNull( ) ) { std::cerr << "No suitable reader found in plugins." << std::endl; return( 1 ); @@ -119,9 +116,6 @@ int main( int argc, char* argv[] ) window->Render( ); interactor->Start( ); - // Free memory - delete reader; - return( 0 ); } diff --git a/appli/examples/example_RGBImageToHSVChannels.cxx b/appli/examples/example_RGBImageToHSVChannels.cxx index 7266800..9a2a468 100644 --- a/appli/examples/example_RGBImageToHSVChannels.cxx +++ b/appli/examples/example_RGBImageToHSVChannels.cxx @@ -18,12 +18,9 @@ void SaveImage( TInterface& plugins, const std::string& fname, TDataObject* image ) { - cpPlugins::Interface::ProcessObject* writer; - writer = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::ImageWriter" ) - ); - if( writer == NULL ) + TProcessObject::Pointer writer; + writer = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageWriter" ); + if( writer.IsNull( ) ) { std::cerr << "No suitable writer found in plugins." << std::endl; return; @@ -38,7 +35,6 @@ void SaveImage( std::string msg = writer->Update( ); if( msg != "" ) std::cerr << "ERROR: " << msg << std::endl; - delete writer; } // ------------------------------------------------------------------------- @@ -69,24 +65,18 @@ int main( int argc, char* argv[] ) plugins.Load( plugins_file ); // Create objects - cpPlugins::Interface::ProcessObject* reader; - cpPlugins::Interface::ProcessObject* filter; - - reader = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::ImageReader" ) - ); - if( reader == NULL ) + TProcessObject::Pointer reader; + TProcessObject::Pointer filter; + + reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" ); + if( reader.IsNull( ) ) { std::cerr << "No suitable reader found in plugins." << std::endl; return( 1 ); } // fi - filter = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::RGBImageToHSVChannelsFilter" ) - ); - if( filter == NULL ) + filter = plugins.CreateProcessObject( "cpPlugins::Plugins::RGBImageToHSVChannelsFilter" ); + if( filter.IsNull( ) ) { std::cerr << "No suitable filter found in plugins." << std::endl; return( 1 ); @@ -109,10 +99,6 @@ int main( int argc, char* argv[] ) SaveImage( plugins, output_saturation_image_file, filter->GetOutput( 1 ) ); SaveImage( plugins, output_value_image_file, filter->GetOutput( 2 ) ); - // Free memory - delete filter; - delete reader; - return( 0 ); } diff --git a/appli/examples/example_ReadImageSeriesWriteImage.cxx b/appli/examples/example_ReadImageSeriesWriteImage.cxx index cab163c..e2216ff 100644 --- a/appli/examples/example_ReadImageSeriesWriteImage.cxx +++ b/appli/examples/example_ReadImageSeriesWriteImage.cxx @@ -38,26 +38,20 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; typedef TProcessObject::TParameters TParameters; - cpPlugins::Interface::ProcessObject* reader; - cpPlugins::Interface::ProcessObject* writer; + cpPlugins::Interface::ProcessObject::Pointer reader; + cpPlugins::Interface::ProcessObject::Pointer writer; reader = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::ImageSeriesReader" ) - ); - if( reader == NULL ) + plugins.CreateProcessObject( "cpPlugins::Plugins::ImageSeriesReader" ); + if( reader.IsNull( ) ) { std::cerr << "No suitable reader found in plugins." << std::endl; return( 1 ); } // fi - writer = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::ImageWriter" ) - ); - if( writer == NULL ) + writer = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageWriter" ); + if( writer.IsNull( ) ) { - delete reader; std::cerr << "No suitable writer found in plugins." << std::endl; return( 1 ); @@ -84,10 +78,6 @@ int main( int argc, char* argv[] ) if( msg != "" ) std::cerr << "ERROR: " << msg << std::endl; - // Free memory - delete writer; - delete reader; - return( 0 ); } diff --git a/appli/examples/example_ReadQuadEdgeMesh.cxx b/appli/examples/example_ReadQuadEdgeMesh.cxx index 655acad..94b6d6c 100644 --- a/appli/examples/example_ReadQuadEdgeMesh.cxx +++ b/appli/examples/example_ReadQuadEdgeMesh.cxx @@ -32,13 +32,10 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; typedef TProcessObject::TParameters TParameters; - cpPlugins::Interface::ProcessObject* reader; + cpPlugins::Interface::ProcessObject::Pointer reader; - reader = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::MeshReader" ) - ); - if( reader == NULL ) + reader = plugins.CreateProcessObject( "cpPlugins::Plugins::MeshReader" ); + if( reader.IsNull( ) ) { std::cerr << "No suitable reader found in plugins." << std::endl; return( 1 ); @@ -58,9 +55,6 @@ int main( int argc, char* argv[] ) if( msg != "" ) std::cerr << "ERROR: " << msg << std::endl; - // Free memory - delete reader; - return( 0 ); } diff --git a/appli/examples/example_ReadWriteImage.cxx b/appli/examples/example_ReadWriteImage.cxx index e07761c..d1419d9 100644 --- a/appli/examples/example_ReadWriteImage.cxx +++ b/appli/examples/example_ReadWriteImage.cxx @@ -34,26 +34,19 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; typedef TProcessObject::TParameters TParameters; - cpPlugins::Interface::ProcessObject* reader; - cpPlugins::Interface::ProcessObject* writer; - - reader = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::ImageReader" ) - ); - if( reader == NULL ) + cpPlugins::Interface::ProcessObject::Pointer reader; + cpPlugins::Interface::ProcessObject::Pointer writer; + + reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" ); + if( reader.IsNull( ) ) { std::cerr << "No suitable reader found in plugins." << std::endl; return( 1 ); } // fi - writer = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::ImageWriter" ) - ); - if( writer == NULL ) + writer = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageWriter" ); + if( writer.IsNull( ) ) { - delete reader; std::cerr << "No suitable writer found in plugins." << std::endl; return( 1 ); @@ -80,10 +73,6 @@ int main( int argc, char* argv[] ) if( msg != "" ) std::cerr << "ERROR: " << msg << std::endl; - // Free memory - delete writer; - delete reader; - return( 0 ); } diff --git a/appli/examples/example_RenderQuadEdgeMesh.cxx b/appli/examples/example_RenderQuadEdgeMesh.cxx index db1e1ab..9fcd519 100644 --- a/appli/examples/example_RenderQuadEdgeMesh.cxx +++ b/appli/examples/example_RenderQuadEdgeMesh.cxx @@ -41,13 +41,10 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; typedef TProcessObject::TParameters TParameters; - cpPlugins::Interface::ProcessObject* reader; + cpPlugins::Interface::ProcessObject::Pointer reader; - reader = - dynamic_cast< TProcessObject* >( - plugins.CreateObject( "cpPlugins::Plugins::MeshReader" ) - ); - if( reader == NULL ) + reader = plugins.CreateProcessObject( "cpPlugins::Plugins::MeshReader" ); + if( reader.IsNull( ) ) { std::cerr << "No suitable reader found in plugins." << std::endl; return( 1 ); @@ -99,9 +96,6 @@ int main( int argc, char* argv[] ) window->Render( ); interactor->Start( ); - // Free memory - delete reader; - return( 0 ); } diff --git a/doc/uml/cpPlugins_classes.dia b/doc/uml/cpPlugins_classes.dia index 03310422a07f092b9c1496c2e74d6300ffe99be6..d5c06312e9c36e1ace50bf3e6689c114247c72c0 100644 GIT binary patch literal 5632 zcmZvfWmFVe*T)HU2xVv#q(Qn%aA1%Q=}rZuyQHL~y95*vX$EvarDr6hLwclP=pMRc zn3;EZ?{i(xdft0J?DPMfb@o~RPkZmfoJfTCdl3+#-dp+1sbt3-obVYAEKo0~gh{D9 z*9puR_~as$W%yvGT%>wQU0e6N$dmvlW`!Q?-6G=}pIL*2aa6-9HiZ3R&FzdYsf`SE1OELrO7qw?P zC7_XvG0{{Z`!R8>r*uNkQ}tJqN6+6Hsek{ML*0XY7^q@oV{ zef103d&kPmSM+v`{jSJVR9=4-`(2SFk-2-K;x>iR<-ic{R=8f{{(}YBAj~g^KjuVy zu$H_3!YXClmr}JhYYJr1bB5vX8S7fK?af^uOUUCGnV{MXqtc=^qW^q#wBhvVqQ7M* zV|Nv}pRL@l*UCBdYvFJt8|LD7iq1~KN|41n1^6Fza+vcAG6Ps%UZz`yHC=N~?^iA~ z%&?nL%&kHIXDW6)QQi zpM?`s-tx2R%?yyaUoqnv);Ag;M*1|mYftLzvGwgQvA_@4MNF;xD{JS1LjFCwjKL0j zbrRlJpuyF>2lTxFfbM31*)(ByB|LHPRq|$=cJ@oP(R>{=LVMNBdSeuQIo20CCD#Zi zOKC|R*{NNBRnVQ-?Rk=@yj!jRXg0;0j}O`$6!68!6>%Q$DWxPq>)5}p6=}ZP>|rME z(Iyd{v(+OP)p=x9S5d-1L-V+0wIX4Lo9_m!(_jHZ0`1&0`q%0JQ&GLb9f3^8mm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CwIh7A3^=EXuDS zB?d1g>5~qccZBpt)9c>Nw)4dd%$0S~gn;0&+GD$qo@(-K5&OOCHco3+S(d)lP|x%S zbtz{x=;^e76p>jOY6E#-Zz&!tq?_bvbjxL0r01jBP`k7yVFslavSCECtH-~Z2TOl8 Q*Im // ------------------------------------------------------------------------- -cpPlugins::Interface::DataObject:: -DataObject( ) - : Superclass( ), - m_Source( NULL ) +std::string cpPlugins::Interface::DataObject:: +GetClassName( ) const { + return( "cpPlugins::Interface::DataObject" ); } // ------------------------------------------------------------------------- -cpPlugins::Interface::DataObject:: -~DataObject( ) +std::string cpPlugins::Interface::DataObject:: +GetClassType( ) const { + return( "DataObject" ); } // ------------------------------------------------------------------------- -std::string cpPlugins::Interface::DataObject:: -GetClassName( ) const +itk::DataObject* cpPlugins::Interface::DataObject:: +GetRealDataObject( ) const { - return( "cpPlugins::Interface::DataObject" ); + return( this->m_RealDataObject ); } // ------------------------------------------------------------------------- -itk::DataObject* cpPlugins::Interface::DataObject:: -GetDataObject( ) const +void cpPlugins::Interface::DataObject:: +SetRealDataObject( itk::DataObject* dobj ) { - return( this->m_DataObject ); + this->m_RealDataObject = dobj; } // ------------------------------------------------------------------------- -void cpPlugins::Interface::DataObject:: -SetDataObject( itk::DataObject* dobj ) +cpPlugins::Interface::Object* cpPlugins::Interface::DataObject:: +GetSource( ) { - this->m_DataObject = dobj; + return( this->m_Source ); } // ------------------------------------------------------------------------- -cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject:: +const cpPlugins::Interface::Object* cpPlugins::Interface::DataObject:: GetSource( ) const { return( this->m_Source ); @@ -44,7 +44,7 @@ GetSource( ) const // ------------------------------------------------------------------------- void cpPlugins::Interface::DataObject:: -SetSource( cpPlugins::Interface::ProcessObject* src ) +SetSource( cpPlugins::Interface::Object* src ) { this->m_Source = src; } @@ -53,12 +53,27 @@ SetSource( cpPlugins::Interface::ProcessObject* src ) void cpPlugins::Interface::DataObject:: DisconnectPipeline( ) { - if( this->m_DataObject.IsNotNull( ) ) + if( this->m_RealDataObject.IsNotNull( ) ) { - this->m_DataObject->DisconnectPipeline( ); - this->m_Source = NULL; + this->m_RealDataObject->DisconnectPipeline( ); + if( this->m_Source.IsNotNull( ) ) + this->m_Source->Delete( ); + this->Register( ); } // fi } +// ------------------------------------------------------------------------- +cpPlugins::Interface::DataObject:: +DataObject( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::DataObject:: +~DataObject( ) +{ +} + // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/DataObject.h b/lib/cpPlugins/Interface/DataObject.h index 3f561a2..c6a2129 100644 --- a/lib/cpPlugins/Interface/DataObject.h +++ b/lib/cpPlugins/Interface/DataObject.h @@ -11,34 +11,46 @@ namespace cpPlugins { namespace Interface { - class ProcessObject; - /** */ class cpPlugins_Interface_EXPORT DataObject : public Object { public: - typedef DataObject Self; - typedef Object Superclass; + typedef DataObject Self; + typedef Object Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; public: - DataObject( ); - virtual ~DataObject( ); + itkNewMacro( Self ); + itkTypeMacro( DataObject, Object ); + public: virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; - itk::DataObject* GetDataObject( ) const; - virtual void SetDataObject( itk::DataObject* dobj ); + itk::DataObject* GetRealDataObject( ) const; + virtual void SetRealDataObject( itk::DataObject* dobj ); - ProcessObject* GetSource( ) const; - void SetSource( ProcessObject* src ); + Object* GetSource( ); + const Object* GetSource( ) const; + void SetSource( Object* src ); void DisconnectPipeline( ); protected: - itk::DataObject::Pointer m_DataObject; - ProcessObject* m_Source; + DataObject( ); + virtual ~DataObject( ); + + private: + // Purposely not implemented + DataObject( const Self& ); + Self& operator=( const Self& ); + + protected: + itk::DataObject::Pointer m_RealDataObject; + Object::Pointer m_Source; }; } // ecapseman diff --git a/lib/cpPlugins/Interface/FilterObject.cxx b/lib/cpPlugins/Interface/FilterObject.cxx new file mode 100644 index 0000000..b7b5218 --- /dev/null +++ b/lib/cpPlugins/Interface/FilterObject.cxx @@ -0,0 +1,30 @@ +#include + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::FilterObject:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::FilterObject" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::FilterObject:: +GetClassType( ) const +{ + return( "FilterObject" ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::FilterObject:: +FilterObject( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::FilterObject:: +~FilterObject( ) +{ +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/FilterObject.h b/lib/cpPlugins/Interface/FilterObject.h index e69de29..9f526c4 100644 --- a/lib/cpPlugins/Interface/FilterObject.h +++ b/lib/cpPlugins/Interface/FilterObject.h @@ -0,0 +1,48 @@ +#ifndef __CPPLUGINS__INTERFACE__FILTEROBJECT__H__ +#define __CPPLUGINS__INTERFACE__FILTEROBJECT__H__ + +#include +#include + +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT FilterObject + : public ProcessObject + { + public: + typedef FilterObject Self; + typedef ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef Superclass::TParameter TParameter; + typedef Superclass::TParameters TParameters; + + public: + itkTypeMacro( FilterObject, ProcessObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: + FilterObject( ); + virtual ~FilterObject( ); + + private: + // Purposely not implemented + FilterObject( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__FILTEROBJECT__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Image.cxx b/lib/cpPlugins/Interface/Image.cxx index 52792d3..23cea6e 100644 --- a/lib/cpPlugins/Interface/Image.cxx +++ b/lib/cpPlugins/Interface/Image.cxx @@ -17,25 +17,9 @@ // ------------------------------------------------------------------------- #define cpPlugins_Image_RGB( p, d, o, f ) \ - if( \ - dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \ - ) \ + if( dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL ) \ this->f< itk::RGBPixel< p >, d >( ) -// ------------------------------------------------------------------------- -cpPlugins::Interface::Image:: -Image( ) - : Superclass( ), - m_VTKImageData( NULL ) -{ -} - -// ------------------------------------------------------------------------- -cpPlugins::Interface::Image:: -~Image( ) -{ -} - // ------------------------------------------------------------------------- std::string cpPlugins::Interface::Image:: GetClassName( ) const @@ -45,13 +29,13 @@ GetClassName( ) const // ------------------------------------------------------------------------- void cpPlugins::Interface::Image:: -SetDataObject( itk::DataObject* dobj ) +SetRealDataObject( itk::DataObject* dobj ) { - this->Superclass::SetDataObject( dobj ); - - // WARNING: Only 2 and 3 dimensions at this moment - cpPlugins_Image_Dimension( 2, dobj, _ConnectToVTK_0 ); - else cpPlugins_Image_Dimension( 3, dobj, _ConnectToVTK_0 ); + this->Superclass::SetRealDataObject( dobj ); + + // NOTE: Only 2 and 3 dimensions at this moment to connect with VTK + cpPlugins_Image_Dimension( 2, dobj, _VTK_0 ); + else cpPlugins_Image_Dimension( 3, dobj, _VTK_0 ); } // ------------------------------------------------------------------------- @@ -70,45 +54,59 @@ UpdateVTKImageData( ) this->m_VTKImageData->Modified( ); } +// ------------------------------------------------------------------------- +cpPlugins::Interface::Image:: +Image( ) + : Superclass( ), + m_VTKImageData( NULL ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::Image:: +~Image( ) +{ +} + // ------------------------------------------------------------------------- template< unsigned int D > void cpPlugins::Interface::Image:: -_ConnectToVTK_0( ) +_VTK_0( ) { - itk::DataObject* dobj = this->Superclass::GetDataObject( ); - - cpPlugins_Image_Pixel( char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( unsigned char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( unsigned short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( unsigned int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( unsigned long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( float, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_Pixel( double, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( unsigned char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( unsigned short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( unsigned int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( unsigned long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( float, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Image_RGB( double, D, dobj, _ConnectToVTK_1 ); + itk::DataObject* dobj = this->Superclass::GetRealDataObject( ); + + cpPlugins_Image_Pixel( char, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( short, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( int, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( long, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( unsigned char, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( unsigned short, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( unsigned int, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( unsigned long, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( float, D, dobj, _VTK_1 ); + else cpPlugins_Image_Pixel( double, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( char, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( short, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( int, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( long, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( unsigned char, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( unsigned short, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( unsigned int, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( unsigned long, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( float, D, dobj, _VTK_1 ); + else cpPlugins_Image_RGB( double, D, dobj, _VTK_1 ); } // ------------------------------------------------------------------------- template< class P, unsigned int D > void cpPlugins::Interface::Image:: -_ConnectToVTK_1( ) +_VTK_1( ) { typedef itk::Image< P, D > _TImage; typedef itk::ImageToVTKImageFilter< _TImage > _TFilter; _TImage* img = - dynamic_cast< _TImage* >( this->Superclass::GetDataObject( ) ); + dynamic_cast< _TImage* >( this->Superclass::GetRealDataObject( ) ); typename _TFilter::Pointer filter = _TFilter::New( ); filter->SetInput( img ); filter->Update( ); diff --git a/lib/cpPlugins/Interface/Image.h b/lib/cpPlugins/Interface/Image.h index f5454c4..4ba14cb 100644 --- a/lib/cpPlugins/Interface/Image.h +++ b/lib/cpPlugins/Interface/Image.h @@ -19,25 +19,36 @@ namespace cpPlugins : public DataObject { public: - typedef Image Self; - typedef DataObject Superclass; + typedef Image Self; + typedef DataObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; public: - Image( ); - virtual ~Image( ); + itkNewMacro( Self ); + itkTypeMacro( Image, DataObject ); + public: virtual std::string GetClassName( ) const; - virtual void SetDataObject( itk::DataObject* dobj ); + virtual void SetRealDataObject( itk::DataObject* dobj ); vtkImageData* GetVTKImageData( ) const; void UpdateVTKImageData( ); protected: + Image( ); + virtual ~Image( ); + template< unsigned int D > - void _ConnectToVTK_0( ); + void _VTK_0( ); template< class P, unsigned int D > - void _ConnectToVTK_1( ); + void _VTK_1( ); + + private: + // Purposely not implemented + Image( const Self& ); + Self& operator=( const Self& ); protected: itk::ProcessObject::Pointer m_Image2VTKImageData; diff --git a/lib/cpPlugins/Interface/ImageSink.cxx b/lib/cpPlugins/Interface/ImageSink.cxx new file mode 100644 index 0000000..e22c14b --- /dev/null +++ b/lib/cpPlugins/Interface/ImageSink.cxx @@ -0,0 +1,30 @@ +#include + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::ImageSink:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::ImageSink" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::ImageSink:: +GetClassType( ) const +{ + return( "ImageSink" ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::ImageSink:: +ImageSink( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::ImageSink:: +~ImageSink( ) +{ +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ImageSink.h b/lib/cpPlugins/Interface/ImageSink.h new file mode 100644 index 0000000..3895e21 --- /dev/null +++ b/lib/cpPlugins/Interface/ImageSink.h @@ -0,0 +1,48 @@ +#ifndef __CPPLUGINS__INTERFACE__IMAGESINK__H__ +#define __CPPLUGINS__INTERFACE__IMAGESINK__H__ + +#include +#include + +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT ImageSink + : public SinkObject + { + public: + typedef ImageSink Self; + typedef SinkObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef Superclass::TParameter TParameter; + typedef Superclass::TParameters TParameters; + + public: + itkTypeMacro( ImageSink, SinkObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: + ImageSink( ); + virtual ~ImageSink( ); + + private: + // Purposely not implemented + ImageSink( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__IMAGESINK__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ImageSource.cxx b/lib/cpPlugins/Interface/ImageSource.cxx new file mode 100644 index 0000000..b58afd9 --- /dev/null +++ b/lib/cpPlugins/Interface/ImageSource.cxx @@ -0,0 +1,30 @@ +#include + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::ImageSource:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::ImageSource" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::ImageSource:: +GetClassType( ) const +{ + return( "ImageSource" ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::ImageSource:: +ImageSource( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::ImageSource:: +~ImageSource( ) +{ +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ImageSource.h b/lib/cpPlugins/Interface/ImageSource.h new file mode 100644 index 0000000..2e8b80c --- /dev/null +++ b/lib/cpPlugins/Interface/ImageSource.h @@ -0,0 +1,48 @@ +#ifndef __CPPLUGINS__INTERFACE__IMAGESOURCE__H__ +#define __CPPLUGINS__INTERFACE__IMAGESOURCE__H__ + +#include +#include + +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT ImageSource + : public SourceObject + { + public: + typedef ImageSource Self; + typedef SourceObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef Superclass::TParameter TParameter; + typedef Superclass::TParameters TParameters; + + public: + itkTypeMacro( ImageSource, SourceObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: + ImageSource( ); + virtual ~ImageSource( ); + + private: + // Purposely not implemented + ImageSource( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__IMAGESOURCE__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ImageToImageFilter.cxx b/lib/cpPlugins/Interface/ImageToImageFilter.cxx index 34fffdc..962c7a0 100644 --- a/lib/cpPlugins/Interface/ImageToImageFilter.cxx +++ b/lib/cpPlugins/Interface/ImageToImageFilter.cxx @@ -1,23 +1,30 @@ #include // ------------------------------------------------------------------------- -cpPlugins::Interface::ImageToImageFilter:: -ImageToImageFilter( ) - : Superclass( ) +std::string cpPlugins::Interface::ImageToImageFilter:: +GetClassName( ) const { + return( "cpPlugins::Interface::ImageToImageFilter" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::ImageToImageFilter:: +GetClassType( ) const +{ + return( "ImageToImageFilter" ); } // ------------------------------------------------------------------------- cpPlugins::Interface::ImageToImageFilter:: -~ImageToImageFilter( ) +ImageToImageFilter( ) + : Superclass( ) { } // ------------------------------------------------------------------------- -std::string cpPlugins::Interface::ImageToImageFilter:: -GetClassName( ) const +cpPlugins::Interface::ImageToImageFilter:: +~ImageToImageFilter( ) { - return( "cpPlugins::Interface::ImageToImageFilter" ); } // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ImageToImageFilter.h b/lib/cpPlugins/Interface/ImageToImageFilter.h index 962ec27..d7ac57a 100644 --- a/lib/cpPlugins/Interface/ImageToImageFilter.h +++ b/lib/cpPlugins/Interface/ImageToImageFilter.h @@ -2,7 +2,7 @@ #define __CPPLUGINS__INTERFACE__IMAGETOIMAGEFILTER__H__ #include -#include +#include namespace cpPlugins { @@ -11,20 +11,32 @@ namespace cpPlugins /** */ class cpPlugins_Interface_EXPORT ImageToImageFilter - : public ProcessObject + : public FilterObject { public: - typedef ImageToImageFilter Self; - typedef ProcessObject Superclass; + typedef ImageToImageFilter Self; + typedef FilterObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: + itkTypeMacro( ImageToImageFilter, FilterObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: ImageToImageFilter( ); virtual ~ImageToImageFilter( ); - virtual std::string GetClassName( ) const; + private: + // Purposely not implemented + ImageToImageFilter( const Self& ); + Self& operator=( const Self& ); }; } // ecapseman diff --git a/lib/cpPlugins/Interface/ImageToMeshFilter.cxx b/lib/cpPlugins/Interface/ImageToMeshFilter.cxx index e5be566..b2a2a29 100644 --- a/lib/cpPlugins/Interface/ImageToMeshFilter.cxx +++ b/lib/cpPlugins/Interface/ImageToMeshFilter.cxx @@ -1,23 +1,30 @@ #include // ------------------------------------------------------------------------- -cpPlugins::Interface::ImageToMeshFilter:: -ImageToMeshFilter( ) - : Superclass( ) +std::string cpPlugins::Interface::ImageToMeshFilter:: +GetClassName( ) const { + return( "cpPlugins::Interface::ImageToMeshFilter" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::ImageToMeshFilter:: +GetClassType( ) const +{ + return( "ImageToMeshFilter" ); } // ------------------------------------------------------------------------- cpPlugins::Interface::ImageToMeshFilter:: -~ImageToMeshFilter( ) +ImageToMeshFilter( ) + : Superclass( ) { } // ------------------------------------------------------------------------- -std::string cpPlugins::Interface::ImageToMeshFilter:: -GetClassName( ) const +cpPlugins::Interface::ImageToMeshFilter:: +~ImageToMeshFilter( ) { - return( "cpPlugins::Interface::ImageToMeshFilter" ); } // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ImageToMeshFilter.h b/lib/cpPlugins/Interface/ImageToMeshFilter.h index dba9142..472f47a 100644 --- a/lib/cpPlugins/Interface/ImageToMeshFilter.h +++ b/lib/cpPlugins/Interface/ImageToMeshFilter.h @@ -2,7 +2,7 @@ #define __CPPLUGINS__INTERFACE__IMAGETOMESHFILTER__H__ #include -#include +#include namespace cpPlugins { @@ -11,20 +11,32 @@ namespace cpPlugins /** */ class cpPlugins_Interface_EXPORT ImageToMeshFilter - : public ProcessObject + : public FilterObject { public: - typedef ImageToMeshFilter Self; - typedef ProcessObject Superclass; + typedef ImageToMeshFilter Self; + typedef FilterObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: + itkTypeMacro( ImageToMeshFilter, FilterObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: ImageToMeshFilter( ); virtual ~ImageToMeshFilter( ); - virtual std::string GetClassName( ) const; + private: + // Purposely not implemented + ImageToMeshFilter( const Self& ); + Self& operator=( const Self& ); }; } // ecapseman diff --git a/lib/cpPlugins/Interface/Instances_itkImage.cxx b/lib/cpPlugins/Interface/Instances_itkImage.cxx index cfa9b74..ba4d66e 100644 --- a/lib/cpPlugins/Interface/Instances_itkImage.cxx +++ b/lib/cpPlugins/Interface/Instances_itkImage.cxx @@ -3,67 +3,67 @@ #include // ------------------------------------------------------------------------- -#define cpPlugins_Interface_Instance_itkImage( t, d ) \ +#define cpPlugins_Instance_itkImage( t, d ) \ template class itk::Image< t, d >; \ template class itk::Image< itk::RGBPixel< t >, d > // ------------------------------------------------------------------------- -#define cpPlugins_Interface_Instance_itkImage2vtkImage( t, d ) \ +#define cpPlugins_Instance_itkImage2vtkImage( t, d ) \ template class itk::ImageToVTKImageFilter< itk::Image< t, d > >; \ template class \ itk::ImageToVTKImageFilter< itk::Image< itk::RGBPixel< t >, d > > // ------------------------------------------------------------------------- -#define cpPlugins_Interface_Instance_All_itkImage( t, d ) \ - cpPlugins_Interface_Instance_itkImage( t, d ); \ - cpPlugins_Interface_Instance_itkImage2vtkImage( t, d ) +#define cpPlugins_Instance_All_itkImage( t, d ) \ + cpPlugins_Instance_itkImage( t, d ); \ + cpPlugins_Instance_itkImage2vtkImage( t, d ) // ------------------------------------------------------------------------- // Images without vtk conversion -cpPlugins_Interface_Instance_itkImage( char, 1 ); -cpPlugins_Interface_Instance_itkImage( short, 1 ); -cpPlugins_Interface_Instance_itkImage( int, 1 ); -cpPlugins_Interface_Instance_itkImage( long, 1 ); -cpPlugins_Interface_Instance_itkImage( unsigned char, 1 ); -cpPlugins_Interface_Instance_itkImage( unsigned short, 1 ); -cpPlugins_Interface_Instance_itkImage( unsigned int, 1 ); -cpPlugins_Interface_Instance_itkImage( unsigned long, 1 ); -cpPlugins_Interface_Instance_itkImage( float, 1 ); -cpPlugins_Interface_Instance_itkImage( double, 1 ); +cpPlugins_Instance_itkImage( char, 1 ); +cpPlugins_Instance_itkImage( short, 1 ); +cpPlugins_Instance_itkImage( int, 1 ); +cpPlugins_Instance_itkImage( long, 1 ); +cpPlugins_Instance_itkImage( unsigned char, 1 ); +cpPlugins_Instance_itkImage( unsigned short, 1 ); +cpPlugins_Instance_itkImage( unsigned int, 1 ); +cpPlugins_Instance_itkImage( unsigned long, 1 ); +cpPlugins_Instance_itkImage( float, 1 ); +cpPlugins_Instance_itkImage( double, 1 ); -cpPlugins_Interface_Instance_itkImage( char, 4 ); -cpPlugins_Interface_Instance_itkImage( short, 4 ); -cpPlugins_Interface_Instance_itkImage( int, 4 ); -cpPlugins_Interface_Instance_itkImage( long, 4 ); -cpPlugins_Interface_Instance_itkImage( unsigned char, 4 ); -cpPlugins_Interface_Instance_itkImage( unsigned short, 4 ); -cpPlugins_Interface_Instance_itkImage( unsigned int, 4 ); -cpPlugins_Interface_Instance_itkImage( unsigned long, 4 ); -cpPlugins_Interface_Instance_itkImage( float, 4 ); -cpPlugins_Interface_Instance_itkImage( double, 4 ); +cpPlugins_Instance_itkImage( char, 4 ); +cpPlugins_Instance_itkImage( short, 4 ); +cpPlugins_Instance_itkImage( int, 4 ); +cpPlugins_Instance_itkImage( long, 4 ); +cpPlugins_Instance_itkImage( unsigned char, 4 ); +cpPlugins_Instance_itkImage( unsigned short, 4 ); +cpPlugins_Instance_itkImage( unsigned int, 4 ); +cpPlugins_Instance_itkImage( unsigned long, 4 ); +cpPlugins_Instance_itkImage( float, 4 ); +cpPlugins_Instance_itkImage( double, 4 ); // ------------------------------------------------------------------------- // Images with vtk conversion -cpPlugins_Interface_Instance_All_itkImage( char, 2 ); -cpPlugins_Interface_Instance_All_itkImage( short, 2 ); -cpPlugins_Interface_Instance_All_itkImage( int, 2 ); -cpPlugins_Interface_Instance_All_itkImage( long, 2 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned char, 2 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned short, 2 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned int, 2 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned long, 2 ); -cpPlugins_Interface_Instance_All_itkImage( float, 2 ); -cpPlugins_Interface_Instance_All_itkImage( double, 2 ); +cpPlugins_Instance_All_itkImage( char, 2 ); +cpPlugins_Instance_All_itkImage( short, 2 ); +cpPlugins_Instance_All_itkImage( int, 2 ); +cpPlugins_Instance_All_itkImage( long, 2 ); +cpPlugins_Instance_All_itkImage( unsigned char, 2 ); +cpPlugins_Instance_All_itkImage( unsigned short, 2 ); +cpPlugins_Instance_All_itkImage( unsigned int, 2 ); +cpPlugins_Instance_All_itkImage( unsigned long, 2 ); +cpPlugins_Instance_All_itkImage( float, 2 ); +cpPlugins_Instance_All_itkImage( double, 2 ); -cpPlugins_Interface_Instance_All_itkImage( char, 3 ); -cpPlugins_Interface_Instance_All_itkImage( short, 3 ); -cpPlugins_Interface_Instance_All_itkImage( int, 3 ); -cpPlugins_Interface_Instance_All_itkImage( long, 3 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned char, 3 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned short, 3 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned int, 3 ); -cpPlugins_Interface_Instance_All_itkImage( unsigned long, 3 ); -cpPlugins_Interface_Instance_All_itkImage( float, 3 ); -cpPlugins_Interface_Instance_All_itkImage( double, 3 ); +cpPlugins_Instance_All_itkImage( char, 3 ); +cpPlugins_Instance_All_itkImage( short, 3 ); +cpPlugins_Instance_All_itkImage( int, 3 ); +cpPlugins_Instance_All_itkImage( long, 3 ); +cpPlugins_Instance_All_itkImage( unsigned char, 3 ); +cpPlugins_Instance_All_itkImage( unsigned short, 3 ); +cpPlugins_Instance_All_itkImage( unsigned int, 3 ); +cpPlugins_Instance_All_itkImage( unsigned long, 3 ); +cpPlugins_Instance_All_itkImage( float, 3 ); +cpPlugins_Instance_All_itkImage( double, 3 ); // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Interface.cxx b/lib/cpPlugins/Interface/Interface.cxx index 332ace5..e4160c6 100644 --- a/lib/cpPlugins/Interface/Interface.cxx +++ b/lib/cpPlugins/Interface/Interface.cxx @@ -31,7 +31,7 @@ GetClasses( ) const } // ------------------------------------------------------------------------- -cpPlugins::Interface::Object* cpPlugins::Interface::Interface:: +cpPlugins::Interface::Object::Pointer cpPlugins::Interface::Interface:: CreateObject( const std::string& name ) const { TClassesIterator cIt = this->m_Classes.find( name ); @@ -40,12 +40,23 @@ CreateObject( const std::string& name ) const ObjectProvider* provider = dynamic_cast< ObjectProvider* >( this->m_Providers[ cIt->second ] ); if( provider != NULL ) - return( dynamic_cast< Object* >( provider->create( ) ) ); + return( provider->create( ) ); } // fi return( NULL ); } +// ------------------------------------------------------------------------- +cpPlugins::Interface::ProcessObject::Pointer +cpPlugins::Interface::Interface:: +CreateProcessObject( const std::string& name ) const +{ + cpPlugins::Interface::Object::Pointer o = this->CreateObject( name ); + cpPlugins::Interface::ProcessObject::Pointer p = + dynamic_cast< cpPlugins::Interface::ProcessObject* >( o.GetPointer( ) ); + return( p ); +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface::Interface:: Load( const std::string& path ) @@ -134,9 +145,8 @@ _LoadClasses( ) // Get reader provider for( unsigned int i = 0; i < this->m_Providers.size( ); ++i ) { - Object* dummy = this->m_Providers[ i ]->create( ); + Object::Pointer dummy = this->m_Providers[ i ]->create( ); this->m_Classes[ dummy->GetClassName( ) ] = i; - delete dummy; } // rof } diff --git a/lib/cpPlugins/Interface/Interface.h b/lib/cpPlugins/Interface/Interface.h index 1bade44..585e2d5 100644 --- a/lib/cpPlugins/Interface/Interface.h +++ b/lib/cpPlugins/Interface/Interface.h @@ -8,6 +8,7 @@ #include #include +#include namespace cpPlugins { @@ -31,7 +32,10 @@ namespace cpPlugins /// Plugin access TClasses& GetClasses( ); const TClasses& GetClasses( ) const; - Object* CreateObject( const std::string& name ) const; + Object::Pointer CreateObject( const std::string& name ) const; + ProcessObject::Pointer CreateProcessObject( + const std::string& name + ) const; /// Interface to PLUMA bool Load( const std::string& path ); diff --git a/lib/cpPlugins/Interface/Mesh.cxx b/lib/cpPlugins/Interface/Mesh.cxx index 8a184c9..9841f7e 100644 --- a/lib/cpPlugins/Interface/Mesh.cxx +++ b/lib/cpPlugins/Interface/Mesh.cxx @@ -5,21 +5,6 @@ #include #include -// ------------------------------------------------------------------------- -cpPlugins::Interface::Mesh:: -Mesh( ) - : Superclass( ), - m_Mapper( NULL ) -{ -} - -// ------------------------------------------------------------------------- -cpPlugins::Interface::Mesh:: -~Mesh( ) -{ - if( this->m_Mapper != NULL ) this->m_Mapper->Delete( ); -} - // ------------------------------------------------------------------------- std::string cpPlugins::Interface::Mesh:: GetClassName( ) const @@ -29,11 +14,11 @@ GetClassName( ) const // ------------------------------------------------------------------------- void cpPlugins::Interface::Mesh:: -SetDataObject( itk::DataObject* dobj ) +SetRealDataObject( itk::DataObject* dobj ) { - this->Superclass::SetDataObject( dobj ); - - // WARNING: Only 2 and 3 dimensions at this moment + this->Superclass::SetRealDataObject( dobj ); + + // NOTE: Only 2 and 3 dimensions at this moment using namespace cpPlugins::Extensions; typedef DataStructures::QuadEdgeMesh< float, 2 > _TF2; typedef DataStructures::QuadEdgeMesh< double, 2 > _TD2; @@ -53,6 +38,21 @@ GetVTKMapper( ) const return( this->m_Mapper ); } +// ------------------------------------------------------------------------- +cpPlugins::Interface::Mesh:: +Mesh( ) + : Superclass( ), + m_Mapper( NULL ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::Mesh:: +~Mesh( ) +{ + if( this->m_Mapper != NULL ) this->m_Mapper->Delete( ); +} + // ------------------------------------------------------------------------- template< class M > void cpPlugins::Interface::Mesh:: @@ -63,7 +63,7 @@ _Map( ) _TMapper; if( this->m_Mapper != NULL ) this->m_Mapper->Delete( ); - M* mesh = dynamic_cast< M* >( this->Superclass::GetDataObject( ) ); + M* mesh = dynamic_cast< M* >( this->Superclass::GetRealDataObject( ) ); _TMapper* mapper = _TMapper::New( ); mapper->SetInputData( mesh ); this->m_Mapper = mapper; diff --git a/lib/cpPlugins/Interface/Mesh.h b/lib/cpPlugins/Interface/Mesh.h index 805b8a1..241da35 100644 --- a/lib/cpPlugins/Interface/Mesh.h +++ b/lib/cpPlugins/Interface/Mesh.h @@ -19,22 +19,33 @@ namespace cpPlugins : public DataObject { public: - typedef Mesh Self; - typedef DataObject Superclass; + typedef Mesh Self; + typedef DataObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; public: - Mesh( ); - virtual ~Mesh( ); + itkNewMacro( Self ); + itkTypeMacro( Mesh, DataObject ); + public: virtual std::string GetClassName( ) const; - virtual void SetDataObject( itk::DataObject* dobj ); + virtual void SetRealDataObject( itk::DataObject* dobj ); vtkMapper* GetVTKMapper( ) const; protected: + Mesh( ); + virtual ~Mesh( ); + template< class M > void _Map( ); + private: + // Purposely not implemented + Mesh( const Self& ); + Self& operator=( const Self& ); + protected: /* itk::ProcessObject::Pointer m_Mesh2VTKMeshData; diff --git a/lib/cpPlugins/Interface/MeshSink.cxx b/lib/cpPlugins/Interface/MeshSink.cxx new file mode 100644 index 0000000..dffacef --- /dev/null +++ b/lib/cpPlugins/Interface/MeshSink.cxx @@ -0,0 +1,30 @@ +#include + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshSink:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::MeshSink" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshSink:: +GetClassType( ) const +{ + return( "MeshSink" ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshSink:: +MeshSink( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshSink:: +~MeshSink( ) +{ +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/MeshSink.h b/lib/cpPlugins/Interface/MeshSink.h new file mode 100644 index 0000000..b110cb3 --- /dev/null +++ b/lib/cpPlugins/Interface/MeshSink.h @@ -0,0 +1,48 @@ +#ifndef __CPPLUGINS__INTERFACE__MESHSINK__H__ +#define __CPPLUGINS__INTERFACE__MESHSINK__H__ + +#include +#include + +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT MeshSink + : public SinkObject + { + public: + typedef MeshSink Self; + typedef SinkObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef Superclass::TParameter TParameter; + typedef Superclass::TParameters TParameters; + + public: + itkTypeMacro( MeshSink, SinkObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: + MeshSink( ); + virtual ~MeshSink( ); + + private: + // Purposely not implemented + MeshSink( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__MESHSINK__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/MeshSource.cxx b/lib/cpPlugins/Interface/MeshSource.cxx new file mode 100644 index 0000000..c608147 --- /dev/null +++ b/lib/cpPlugins/Interface/MeshSource.cxx @@ -0,0 +1,30 @@ +#include + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshSource:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::MeshSource" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshSource:: +GetClassType( ) const +{ + return( "MeshSource" ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshSource:: +MeshSource( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshSource:: +~MeshSource( ) +{ +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/MeshSource.h b/lib/cpPlugins/Interface/MeshSource.h new file mode 100644 index 0000000..9c5c3d2 --- /dev/null +++ b/lib/cpPlugins/Interface/MeshSource.h @@ -0,0 +1,48 @@ +#ifndef __CPPLUGINS__INTERFACE__MESHSOURCE__H__ +#define __CPPLUGINS__INTERFACE__MESHSOURCE__H__ + +#include +#include + +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT MeshSource + : public SourceObject + { + public: + typedef MeshSource Self; + typedef SourceObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef Superclass::TParameter TParameter; + typedef Superclass::TParameters TParameters; + + public: + itkTypeMacro( MeshSource, SourceObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: + MeshSource( ); + virtual ~MeshSource( ); + + private: + // Purposely not implemented + MeshSource( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__MESHSOURCE__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/MeshToImageFilter.cxx b/lib/cpPlugins/Interface/MeshToImageFilter.cxx new file mode 100644 index 0000000..804a381 --- /dev/null +++ b/lib/cpPlugins/Interface/MeshToImageFilter.cxx @@ -0,0 +1,30 @@ +#include + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshToImageFilter:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::MeshToImageFilter" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshToImageFilter:: +GetClassType( ) const +{ + return( "MeshToImageFilter" ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshToImageFilter:: +MeshToImageFilter( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshToImageFilter:: +~MeshToImageFilter( ) +{ +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/MeshToImageFilter.h b/lib/cpPlugins/Interface/MeshToImageFilter.h index e69de29..b6447d2 100644 --- a/lib/cpPlugins/Interface/MeshToImageFilter.h +++ b/lib/cpPlugins/Interface/MeshToImageFilter.h @@ -0,0 +1,48 @@ +#ifndef __CPPLUGINS__INTERFACE__MESHTOIMAGEFILTER__H__ +#define __CPPLUGINS__INTERFACE__MESHTOIMAGEFILTER__H__ + +#include +#include + +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT MeshToImageFilter + : public FilterObject + { + public: + typedef MeshToImageFilter Self; + typedef FilterObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef Superclass::TParameter TParameter; + typedef Superclass::TParameters TParameters; + + public: + itkTypeMacro( MeshToImageFilter, FilterObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: + MeshToImageFilter( ); + virtual ~MeshToImageFilter( ); + + private: + // Purposely not implemented + MeshToImageFilter( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__MESHTOIMAGEFILTER__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/MeshToMeshFilter.cxx b/lib/cpPlugins/Interface/MeshToMeshFilter.cxx new file mode 100644 index 0000000..4f5c76f --- /dev/null +++ b/lib/cpPlugins/Interface/MeshToMeshFilter.cxx @@ -0,0 +1,30 @@ +#include + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshToMeshFilter:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::MeshToMeshFilter" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::MeshToMeshFilter:: +GetClassType( ) const +{ + return( "MeshToMeshFilter" ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshToMeshFilter:: +MeshToMeshFilter( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::MeshToMeshFilter:: +~MeshToMeshFilter( ) +{ +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/MeshToMeshFilter.h b/lib/cpPlugins/Interface/MeshToMeshFilter.h index e69de29..7121c0e 100644 --- a/lib/cpPlugins/Interface/MeshToMeshFilter.h +++ b/lib/cpPlugins/Interface/MeshToMeshFilter.h @@ -0,0 +1,48 @@ +#ifndef __CPPLUGINS__INTERFACE__MESHTOMESHFILTER__H__ +#define __CPPLUGINS__INTERFACE__MESHTOMESHFILTER__H__ + +#include +#include + +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT MeshToMeshFilter + : public FilterObject + { + public: + typedef MeshToMeshFilter Self; + typedef FilterObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef Superclass::TParameter TParameter; + typedef Superclass::TParameters TParameters; + + public: + itkTypeMacro( MeshToMeshFilter, FilterObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: + MeshToMeshFilter( ); + virtual ~MeshToMeshFilter( ); + + private: + // Purposely not implemented + MeshToMeshFilter( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__MESHTOMESHFILTER__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Object.cxx b/lib/cpPlugins/Interface/Object.cxx index c0418d3..3868b2c 100644 --- a/lib/cpPlugins/Interface/Object.cxx +++ b/lib/cpPlugins/Interface/Object.cxx @@ -1,22 +1,30 @@ #include // ------------------------------------------------------------------------- -cpPlugins::Interface::Object:: -Object( ) +std::string cpPlugins::Interface::Object:: +GetClassName( ) const { + return( "cpPlugins::Interface::Object" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::Object:: +GetClassType( ) const +{ + return( "Object" ); } // ------------------------------------------------------------------------- cpPlugins::Interface::Object:: -~Object( ) +Object( ) + : Superclass( ) { } // ------------------------------------------------------------------------- -std::string cpPlugins::Interface::Object:: -GetClassName( ) const +cpPlugins::Interface::Object:: +~Object( ) { - return( "cpPlugins::Interface::Object" ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Interface/Object.h b/lib/cpPlugins/Interface/Object.h index d4436f6..33cfdd7 100644 --- a/lib/cpPlugins/Interface/Object.h +++ b/lib/cpPlugins/Interface/Object.h @@ -3,8 +3,30 @@ #include #include +#include +#include #include +// ------------------------------------------------------------------------- +#define PLUMA_PROVIDER_HEADER_CPPLUGINS( TYPE ) \ + PLUMA_PROVIDER_HEADER_BEGIN( TYPE ) \ + virtual TYPE::Pointer create( ) const = 0; \ + PLUMA_PROVIDER_HEADER_END + +// ------------------------------------------------------------------------- +#define PLUMA_INHERIT_PROVIDER_CPPLUGINS( TYPE, SUPER ) \ + class TYPE##Provider \ + : public SUPER##Provider \ + { \ + public: \ + SUPER::Pointer create( ) const \ + { \ + TYPE::Pointer a = TYPE::New( ); \ + SUPER::Pointer b = a.GetPointer( ); \ + return( b ); \ + } \ + }; + namespace cpPlugins { namespace Interface @@ -12,16 +34,34 @@ namespace cpPlugins /** */ class cpPlugins_Interface_EXPORT Object + : public itk::Object { public: + typedef Object Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( Object, itkObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: Object( ); virtual ~Object( ); - virtual std::string GetClassName( ) const; + private: + // Purposely not implemented + Object( const Self& ); + Self& operator=( const Self& ); }; // TODO: doc - PLUMA_PROVIDER_HEADER( Object ); + PLUMA_PROVIDER_HEADER_CPPLUGINS( Object ); } // ecapseman diff --git a/lib/cpPlugins/Interface/ProcessObject.cxx b/lib/cpPlugins/Interface/ProcessObject.cxx index d1982b0..e05e7a8 100644 --- a/lib/cpPlugins/Interface/ProcessObject.cxx +++ b/lib/cpPlugins/Interface/ProcessObject.cxx @@ -1,25 +1,17 @@ #include // ------------------------------------------------------------------------- -cpPlugins::Interface::ProcessObject:: -ProcessObject( ) - : Superclass( ), - m_OutputsDisconnected( false ) -{ -} - -// ------------------------------------------------------------------------- -cpPlugins::Interface::ProcessObject:: -~ProcessObject( ) +std::string cpPlugins::Interface::ProcessObject:: +GetClassName( ) const { - this->_DeleteOutputs( ); + return( "cpPlugins::Interface::ProcessObject" ); } // ------------------------------------------------------------------------- std::string cpPlugins::Interface::ProcessObject:: -GetClassName( ) const +GetClassType( ) const { - return( "cpPlugins::Interface::ProcessObject" ); + return( "ProcessObject" ); } // ------------------------------------------------------------------------- @@ -35,6 +27,7 @@ void cpPlugins::Interface::ProcessObject:: SetParameters( const TParameters& params ) { this->m_Parameters = params; + this->Modified( ); } // ------------------------------------------------------------------------- @@ -56,27 +49,29 @@ void cpPlugins::Interface::ProcessObject:: SetNumberOfInputs( unsigned int n ) { this->m_Inputs.clear( ); - this->m_Inputs.resize( n, NULL ); + this->m_Inputs.resize( n ); + this->Modified( ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: SetNumberOfOutputs( unsigned int n ) { - this->_DeleteOutputs( ); this->m_Outputs.clear( ); - this->m_Outputs.resize( n, NULL ); - this->m_OutputsDisconnected = false; + this->m_Outputs.resize( n ); + this->Modified( ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: -SetInput( - unsigned int idx, const cpPlugins::Interface::DataObject* dobj - ) +SetInput( unsigned int idx, cpPlugins::Interface::DataObject* dobj ) { if( idx < this->m_Inputs.size( ) ) + { this->m_Inputs[ idx ] = dobj; + this->Modified( ); + + } // fi } // ------------------------------------------------------------------------- @@ -93,22 +88,20 @@ GetOutput( unsigned int idx ) std::string cpPlugins::Interface::ProcessObject:: Update( ) { - // Force upstream updates std::string r = ""; + + // Force upstream updates for( unsigned int i = 0; i < this->m_Inputs.size( ) && r == ""; ++i ) { - if( this->m_Inputs[ i ]->GetSource( ) != NULL ) - r = this->m_Inputs[ i ]->GetSource( )->Update( ); + Self* src = dynamic_cast< Self* >( this->m_Inputs[ i ]->GetSource( ) ); + if( src != NULL ) + r = src->Update( ); } // rof // Current update if( r == "" ) - { r = this->_GenerateData( ); - this->m_OutputsDisconnected = false; - - } // fi // Return error description, if any return( r ); @@ -118,18 +111,30 @@ Update( ) void cpPlugins::Interface::ProcessObject:: DisconnectOutputs( ) { - this->m_OutputsDisconnected = true; for( unsigned int idx = 0; idx < this->m_Outputs.size( ); ++idx ) - if( this->m_Outputs[ idx ] != NULL ) + if( this->m_Outputs[ idx ].IsNotNull( ) ) this->m_Outputs[ idx ]->DisconnectPipeline( ); } +// ------------------------------------------------------------------------- +cpPlugins::Interface::ProcessObject:: +ProcessObject( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface::ProcessObject:: +~ProcessObject( ) +{ +} + // ------------------------------------------------------------------------- itk::DataObject* cpPlugins::Interface::ProcessObject:: _GetInput( unsigned int idx ) { if( idx < this->m_Inputs.size( ) ) - return( this->m_Inputs[ idx ]->GetDataObject( ) ); + return( this->m_Inputs[ idx ]->GetRealDataObject( ) ); else return( NULL ); } @@ -139,18 +144,8 @@ void cpPlugins::Interface::ProcessObject:: _SetOutput( unsigned int idx, itk::DataObject* dobj ) { if( idx < this->m_Outputs.size( ) ) - if( this->m_Outputs[ idx ] != NULL ) - this->m_Outputs[ idx ]->SetDataObject( dobj ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::Interface::ProcessObject:: -_DeleteOutputs( ) -{ - if( !( this->m_OutputsDisconnected ) ) - for( unsigned int idx = 0; idx < this->m_Outputs.size( ); ++idx ) - if( this->m_Outputs[ idx ] != NULL ) - delete this->m_Outputs[ idx ]; + if( this->m_Outputs[ idx ].IsNotNull( ) ) + this->m_Outputs[ idx ]->SetRealDataObject( dobj ); } // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index a5404a8..f4c80ae 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -13,25 +12,26 @@ namespace cpPlugins { namespace Interface { - class DataObject; - /** */ class cpPlugins_Interface_EXPORT ProcessObject : public Object { public: - typedef ProcessObject Self; - typedef Object Superclass; + typedef ProcessObject Self; + typedef Object Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef std::pair< std::string, std::string > TParameter; typedef std::map< std::string, TParameter > TParameters; public: - ProcessObject( ); - virtual ~ProcessObject( ); + itkTypeMacro( ProcessObject, Object ); + public: virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; virtual const TParameters& GetDefaultParameters( ) const; virtual void SetParameters( const TParameters& params ); @@ -41,40 +41,42 @@ namespace cpPlugins virtual void SetNumberOfInputs( unsigned int n ); virtual void SetNumberOfOutputs( unsigned int n ); - virtual void SetInput( unsigned int idx, const DataObject* dobj ); + virtual void SetInput( unsigned int idx, DataObject* dobj ); virtual DataObject* GetOutput( unsigned int idx ); virtual std::string Update( ); virtual void DisconnectOutputs( ); protected: + ProcessObject( ); + virtual ~ProcessObject( ); + virtual itk::DataObject* _GetInput( unsigned int idx ); virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj ); - virtual void _DeleteOutputs( ); template< class O > void _MakeOutput( unsigned int idx ) { if( idx >= this->m_Outputs.size( ) ) return; - - if( !( this->m_OutputsDisconnected ) ) - if( this->m_Outputs[ idx ] != NULL ) - delete this->m_Outputs[ idx ]; - - this->m_Outputs[ idx ] = new O( ); + this->m_Outputs[ idx ] = O::New( ); this->m_Outputs[ idx ]->SetSource( this ); } virtual std::string _GenerateData( ) = 0; + private: + // Purposely not implemented + ProcessObject( const Self& ); + Self& operator=( const Self& ); + protected: + itk::ProcessObject::Pointer m_RealProcessObject; TParameters m_DefaultParameters; TParameters m_Parameters; - std::vector< const DataObject* > m_Inputs; - std::vector< DataObject* > m_Outputs; - bool m_OutputsDisconnected; + std::vector< DataObject::Pointer > m_Inputs; + std::vector< DataObject::Pointer > m_Outputs; }; } // ecapseman diff --git a/lib/cpPlugins/Interface/SinkObject.cxx b/lib/cpPlugins/Interface/SinkObject.cxx index c0ff636..309a3d1 100644 --- a/lib/cpPlugins/Interface/SinkObject.cxx +++ b/lib/cpPlugins/Interface/SinkObject.cxx @@ -1,5 +1,19 @@ #include +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::SinkObject:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::SinkObject" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::SinkObject:: +GetClassType( ) const +{ + return( "SinkObject" ); +} + // ------------------------------------------------------------------------- cpPlugins::Interface::SinkObject:: SinkObject( ) @@ -14,11 +28,4 @@ cpPlugins::Interface::SinkObject:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Interface::SinkObject:: -GetClassName( ) const -{ - return( "cpPlugins::Interface::SinkObject" ); -} - // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/SinkObject.h b/lib/cpPlugins/Interface/SinkObject.h index 7caf70e..52723d1 100644 --- a/lib/cpPlugins/Interface/SinkObject.h +++ b/lib/cpPlugins/Interface/SinkObject.h @@ -14,17 +14,29 @@ namespace cpPlugins : public ProcessObject { public: - typedef SinkObject Self; - typedef ProcessObject Superclass; + typedef SinkObject Self; + typedef ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: + itkTypeMacro( SinkObject, ProcessObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: SinkObject( ); virtual ~SinkObject( ); - virtual std::string GetClassName( ) const; + private: + // Purposely not implemented + SinkObject( const Self& ); + Self& operator=( const Self& ); }; } // ecapseman diff --git a/lib/cpPlugins/Interface/SourceObject.cxx b/lib/cpPlugins/Interface/SourceObject.cxx index b4499db..9ad0878 100644 --- a/lib/cpPlugins/Interface/SourceObject.cxx +++ b/lib/cpPlugins/Interface/SourceObject.cxx @@ -1,5 +1,19 @@ #include +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::SourceObject:: +GetClassName( ) const +{ + return( "cpPlugins::Interface::SourceObject" ); +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::SourceObject:: +GetClassType( ) const +{ + return( "SourceObject" ); +} + // ------------------------------------------------------------------------- cpPlugins::Interface::SourceObject:: SourceObject( ) @@ -14,11 +28,4 @@ cpPlugins::Interface::SourceObject:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Interface::SourceObject:: -GetClassName( ) const -{ - return( "cpPlugins::Interface::SourceObject" ); -} - // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/SourceObject.h b/lib/cpPlugins/Interface/SourceObject.h index 22914b9..0c036ce 100644 --- a/lib/cpPlugins/Interface/SourceObject.h +++ b/lib/cpPlugins/Interface/SourceObject.h @@ -14,17 +14,29 @@ namespace cpPlugins : public ProcessObject { public: - typedef SourceObject Self; - typedef ProcessObject Superclass; + typedef SourceObject Self; + typedef ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: + itkTypeMacro( SourceObject, ProcessObject ); + + public: + virtual std::string GetClassName( ) const; + virtual std::string GetClassType( ) const; + + protected: SourceObject( ); virtual ~SourceObject( ); - virtual std::string GetClassName( ) const; + private: + // Purposely not implemented + SourceObject( const Self& ); + Self& operator=( const Self& ); }; } // ecapseman diff --git a/lib/cpPlugins/Plugins/ImageReader.cxx b/lib/cpPlugins/Plugins/ImageReader.cxx index df0f1e6..0aa4bfc 100644 --- a/lib/cpPlugins/Plugins/ImageReader.cxx +++ b/lib/cpPlugins/Plugins/ImageReader.cxx @@ -7,6 +7,13 @@ #include #include +// ------------------------------------------------------------------------- +std::string cpPlugins::Plugins::ImageReader:: +GetClassName( ) const +{ + return( "cpPlugins::Plugins::ImageReader" ); +} + // ------------------------------------------------------------------------- cpPlugins::Plugins::ImageReader:: ImageReader( ) @@ -28,13 +35,6 @@ cpPlugins::Plugins::ImageReader:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Plugins::ImageReader:: -GetClassName( ) const -{ - return( "cpPlugins::Plugins::ImageReader" ); -} - // ------------------------------------------------------------------------- std::string cpPlugins::Plugins::ImageReader:: _GenerateData( ) @@ -136,11 +136,12 @@ _GD1( ) typedef itk::ImageFileReader< _TImage > _TReader; _TReader* reader = - dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) ); + dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); if( reader == NULL ) { - this->m_Reader = _TReader::New( ); - reader = dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) ); + this->m_RealProcessObject = _TReader::New( ); + reader = + dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); } // fi reader->SetFileName( fIt->second.second ); diff --git a/lib/cpPlugins/Plugins/ImageReader.h b/lib/cpPlugins/Plugins/ImageReader.h index 39d243b..2c73d70 100644 --- a/lib/cpPlugins/Plugins/ImageReader.h +++ b/lib/cpPlugins/Plugins/ImageReader.h @@ -2,7 +2,7 @@ #define __CPPLUGINS__PLUGINS__IMAGEREADER__H__ #include -#include +#include #include namespace cpPlugins @@ -12,22 +12,28 @@ namespace cpPlugins /** */ class cpPlugins_EXPORT ImageReader - : public cpPlugins::Interface::SourceObject + : public cpPlugins::Interface::ImageSource { public: - typedef ImageReader Self; - typedef cpPlugins::Interface::SourceObject Superclass; + typedef ImageReader Self; + typedef cpPlugins::Interface::ImageSource Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: - ImageReader( ); - virtual ~ImageReader( ); + itkNewMacro( Self ); + itkTypeMacro( ImageReader, cpPluginsInterfaceImageSource ); + public: virtual std::string GetClassName( ) const; protected: + ImageReader( ); + virtual ~ImageReader( ); + virtual std::string _GenerateData( ); template< unsigned int D > @@ -36,12 +42,17 @@ namespace cpPlugins template< class P, unsigned int D > std::string _GD1( ); - protected: - itk::ProcessObject::Pointer m_Reader; + private: + // Purposely not implemented + ImageReader( const Self& ); + Self& operator=( const Self& ); }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER( ImageReader, cpPlugins::Interface::Object ); + PLUMA_INHERIT_PROVIDER_CPPLUGINS( + ImageReader, + cpPlugins::Interface::Object + ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/ImageSeriesReader.cxx b/lib/cpPlugins/Plugins/ImageSeriesReader.cxx index 416352a..d6fbfa6 100644 --- a/lib/cpPlugins/Plugins/ImageSeriesReader.cxx +++ b/lib/cpPlugins/Plugins/ImageSeriesReader.cxx @@ -10,6 +10,13 @@ #include #include +// ------------------------------------------------------------------------- +std::string cpPlugins::Plugins::ImageSeriesReader:: +GetClassName( ) const +{ + return( "cpPlugins::Plugins::ImageSeriesReader" ); +} + // ------------------------------------------------------------------------- cpPlugins::Plugins::ImageSeriesReader:: ImageSeriesReader( ) @@ -31,13 +38,6 @@ cpPlugins::Plugins::ImageSeriesReader:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Plugins::ImageSeriesReader:: -GetClassName( ) const -{ - return( "cpPlugins::Plugins::ImageSeriesReader" ); -} - // ------------------------------------------------------------------------- std::string cpPlugins::Plugins::ImageSeriesReader:: _GenerateData( ) @@ -144,11 +144,12 @@ _GD1( ) typedef itk::ImageSeriesReader< _TImage > _TReader; _TReader* reader = - dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) ); + dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); if( reader == NULL ) { - this->m_Reader = _TReader::New( ); - reader = dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) ); + this->m_RealProcessObject = _TReader::New( ); + reader = + dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); } // fi std::set< std::string >::const_iterator fnIt = filenames.begin( ); diff --git a/lib/cpPlugins/Plugins/ImageSeriesReader.h b/lib/cpPlugins/Plugins/ImageSeriesReader.h index 6ddf039..9bd9bc2 100644 --- a/lib/cpPlugins/Plugins/ImageSeriesReader.h +++ b/lib/cpPlugins/Plugins/ImageSeriesReader.h @@ -2,7 +2,7 @@ #define __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__ #include -#include +#include #include namespace cpPlugins @@ -12,22 +12,27 @@ namespace cpPlugins /** */ class cpPlugins_EXPORT ImageSeriesReader - : public cpPlugins::Interface::SourceObject + : public cpPlugins::Interface::ImageSource { public: - typedef ImageSeriesReader Self; - typedef cpPlugins::Interface::SourceObject Superclass; + typedef ImageSeriesReader Self; + typedef cpPlugins::Interface::ImageSource Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: - ImageSeriesReader( ); - virtual ~ImageSeriesReader( ); + itkNewMacro( Self ); + itkTypeMacro( ImageSeriesReader, cpPluginsInterfaceImageSource ); + public: virtual std::string GetClassName( ) const; protected: + ImageSeriesReader( ); + virtual ~ImageSeriesReader( ); virtual std::string _GenerateData( ); @@ -37,12 +42,17 @@ namespace cpPlugins template< class P, unsigned int D > std::string _GD1( ); - protected: - itk::ProcessObject::Pointer m_Reader; + private: + // Purposely not implemented + ImageSeriesReader( const Self& ); + Self& operator=( const Self& ); }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER( ImageSeriesReader, cpPlugins::Interface::Object ); + PLUMA_INHERIT_PROVIDER_CPPLUGINS( + ImageSeriesReader, + cpPlugins::Interface::Object + ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/ImageWriter.cxx b/lib/cpPlugins/Plugins/ImageWriter.cxx index 41fdb30..aea4a21 100644 --- a/lib/cpPlugins/Plugins/ImageWriter.cxx +++ b/lib/cpPlugins/Plugins/ImageWriter.cxx @@ -23,6 +23,13 @@ ) \ r = this->f< itk::RGBPixel< p >, d >( ) +// ------------------------------------------------------------------------- +std::string cpPlugins::Plugins::ImageWriter:: +GetClassName( ) const +{ + return( "cpPlugins::Plugins::ImageWriter" ); +} + // ------------------------------------------------------------------------- cpPlugins::Plugins::ImageWriter:: ImageWriter( ) @@ -40,13 +47,6 @@ cpPlugins::Plugins::ImageWriter:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Plugins::ImageWriter:: -GetClassName( ) const -{ - return( "cpPlugins::Plugins::ImageWriter" ); -} - // ------------------------------------------------------------------------- std::string cpPlugins::Plugins::ImageWriter:: _GenerateData( ) @@ -99,7 +99,7 @@ std::string cpPlugins::Plugins::ImageWriter:: _GD1( ) { typedef itk::Image< P, D > _TImage; - typedef itk::ImageFileWriter< _TImage > _TImageWriter; + typedef itk::ImageFileWriter< _TImage > _TWriter; TParameters::const_iterator fIt; @@ -108,12 +108,13 @@ _GD1( ) if( fIt == this->m_Parameters.end( ) ) fIt = this->m_DefaultParameters.find( "FileName" ); - _TImageWriter* writer = - dynamic_cast< _TImageWriter* >( this->m_Writer.GetPointer( ) ); + _TWriter* writer = + dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) ); if( writer == NULL ) { - this->m_Writer = _TImageWriter::New( ); - writer = dynamic_cast< _TImageWriter* >( this->m_Writer.GetPointer( ) ); + this->m_RealProcessObject = _TWriter::New( ); + writer = + dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) ); } // fi writer->SetFileName( fIt->second.second ); diff --git a/lib/cpPlugins/Plugins/ImageWriter.h b/lib/cpPlugins/Plugins/ImageWriter.h index 57f15db..1dcd98f 100644 --- a/lib/cpPlugins/Plugins/ImageWriter.h +++ b/lib/cpPlugins/Plugins/ImageWriter.h @@ -2,7 +2,7 @@ #define __CPPLUGINS__PLUGINS__IMAGEWRITER__H__ #include -#include +#include #include namespace cpPlugins @@ -12,22 +12,28 @@ namespace cpPlugins /** */ class cpPlugins_EXPORT ImageWriter - : public cpPlugins::Interface::SinkObject + : public cpPlugins::Interface::ImageSink { public: - typedef ImageWriter Self; - typedef cpPlugins::Interface::SinkObject Superclass; + typedef ImageWriter Self; + typedef cpPlugins::Interface::ImageSink Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: - ImageWriter( ); - virtual ~ImageWriter( ); + itkNewMacro( Self ); + itkTypeMacro( ImageWriter, cpPluginsInterfaceImageSink ); + public: virtual std::string GetClassName( ) const; protected: + ImageWriter( ); + virtual ~ImageWriter( ); + virtual std::string _GenerateData( ); template< unsigned int D > @@ -36,12 +42,17 @@ namespace cpPlugins template< class P, unsigned int D > std::string _GD1( ); - protected: - itk::ProcessObject::Pointer m_Writer; + private: + // Purposely not implemented + ImageWriter( const Self& ); + Self& operator=( const Self& ); }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER( ImageWriter, cpPlugins::Interface::Object ); + PLUMA_INHERIT_PROVIDER_CPPLUGINS( + ImageWriter, + cpPlugins::Interface::Object + ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/MarchingCubes.cxx b/lib/cpPlugins/Plugins/MarchingCubes.cxx index 3204033..12aad40 100644 --- a/lib/cpPlugins/Plugins/MarchingCubes.cxx +++ b/lib/cpPlugins/Plugins/MarchingCubes.cxx @@ -8,6 +8,13 @@ #include #include +// ------------------------------------------------------------------------- +std::string cpPlugins::Plugins::MarchingCubes:: +GetClassName( ) const +{ + return( "cpPlugins::Plugins::MarchingCubes" ); +} + // ------------------------------------------------------------------------- cpPlugins::Plugins::MarchingCubes:: MarchingCubes( ) @@ -32,13 +39,6 @@ cpPlugins::Plugins::MarchingCubes:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Plugins::MarchingCubes:: -GetClassName( ) const -{ - return( "cpPlugins::Plugins::MarchingCubes" ); -} - // ------------------------------------------------------------------------- std::string cpPlugins::Plugins::MarchingCubes:: _GenerateData( ) diff --git a/lib/cpPlugins/Plugins/MarchingCubes.h b/lib/cpPlugins/Plugins/MarchingCubes.h index c691f8f..cf616b0 100644 --- a/lib/cpPlugins/Plugins/MarchingCubes.h +++ b/lib/cpPlugins/Plugins/MarchingCubes.h @@ -17,17 +17,23 @@ namespace cpPlugins public: typedef MarchingCubes Self; typedef cpPlugins::Interface::ImageToMeshFilter Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: - MarchingCubes( ); - virtual ~MarchingCubes( ); + itkNewMacro( Self ); + itkTypeMacro( MarchingCubes, cpPluginsInterfaceImageToMeshFilter ); + public: virtual std::string GetClassName( ) const; protected: + MarchingCubes( ); + virtual ~MarchingCubes( ); + virtual std::string _GenerateData( ); template< unsigned int D > @@ -36,14 +42,17 @@ namespace cpPlugins template< class P, unsigned int D > std::string _GD1( ); - protected: - /* - itk::ProcessObject::Pointer m_Reader; - */ + private: + // Purposely not implemented + MarchingCubes( const Self& ); + Self& operator=( const Self& ); }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER( MarchingCubes, cpPlugins::Interface::Object ); + PLUMA_INHERIT_PROVIDER_CPPLUGINS( + MarchingCubes, + cpPlugins::Interface::Object + ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/MeshReader.cxx b/lib/cpPlugins/Plugins/MeshReader.cxx index 322e49c..b219899 100644 --- a/lib/cpPlugins/Plugins/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/MeshReader.cxx @@ -4,6 +4,13 @@ #include #include +// ------------------------------------------------------------------------- +std::string cpPlugins::Plugins::MeshReader:: +GetClassName( ) const +{ + return( "cpPlugins::Plugins::MeshReader" ); +} + // ------------------------------------------------------------------------- cpPlugins::Plugins::MeshReader:: MeshReader( ) @@ -24,13 +31,6 @@ cpPlugins::Plugins::MeshReader:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Plugins::MeshReader:: -GetClassName( ) const -{ - return( "cpPlugins::Plugins::MeshReader" ); -} - // ------------------------------------------------------------------------- std::string cpPlugins::Plugins::MeshReader:: _GenerateData( ) @@ -85,11 +85,12 @@ _GD1( ) typedef IO::MeshReader< _TMesh > _TReader; _TReader* reader = - dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) ); + dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); if( reader == NULL ) { - this->m_Reader = _TReader::New( ); - reader = dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) ); + this->m_RealProcessObject = _TReader::New( ); + reader = + dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); } // fi reader->SetFileName( fIt->second.second ); diff --git a/lib/cpPlugins/Plugins/MeshReader.h b/lib/cpPlugins/Plugins/MeshReader.h index 968c4ac..bfd9426 100644 --- a/lib/cpPlugins/Plugins/MeshReader.h +++ b/lib/cpPlugins/Plugins/MeshReader.h @@ -2,7 +2,7 @@ #define __CPPLUGINS__PLUGINS__MESHREADER__H__ #include -#include +#include #include namespace cpPlugins @@ -12,22 +12,28 @@ namespace cpPlugins /** */ class cpPlugins_EXPORT MeshReader - : public cpPlugins::Interface::SourceObject + : public cpPlugins::Interface::MeshSource { public: - typedef MeshReader Self; - typedef cpPlugins::Interface::SourceObject Superclass; + typedef MeshReader Self; + typedef cpPlugins::Interface::MeshSource Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: - MeshReader( ); - virtual ~MeshReader( ); + itkNewMacro( Self ); + itkTypeMacro( MeshReader, cpPluginsInterfaceMeshSource ); + public: virtual std::string GetClassName( ) const; protected: + MeshReader( ); + virtual ~MeshReader( ); + virtual std::string _GenerateData( ); template< unsigned int D > @@ -36,12 +42,17 @@ namespace cpPlugins template< class P, unsigned int D > std::string _GD1( ); - protected: - itk::ProcessObject::Pointer m_Reader; + private: + // Purposely not implemented + MeshReader( const Self& ); + Self& operator=( const Self& ); }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER( MeshReader, cpPlugins::Interface::Object ); + PLUMA_INHERIT_PROVIDER_CPPLUGINS( + MeshReader, + cpPlugins::Interface::Object + ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.cxx b/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.cxx index 8d54034..339a818 100644 --- a/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.cxx +++ b/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.cxx @@ -7,17 +7,25 @@ #include // ------------------------------------------------------------------------- -#define cpPlugins_RGBImageToHSVChannelsFilter_Dimension( r, d, o, f ) \ +#define cpPlugins_RGB2HSV_Dimension( r, d, o, f ) \ if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL ) \ r = this->f< d >( ) // ------------------------------------------------------------------------- -#define cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, p, d, o, f ) \ +#define cpPlugins_RGB2HSV_RGB( r, p, d, o, f ) \ if( \ dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \ ) \ r = this->f< p, d >( ) + +// ------------------------------------------------------------------------- +std::string cpPlugins::Plugins::RGBImageToHSVChannelsFilter:: +GetClassName( ) const +{ + return( "cpPlugins::Plugins::RGBImageToHSVChannelsFilter" ); +} + // ------------------------------------------------------------------------- cpPlugins::Plugins::RGBImageToHSVChannelsFilter:: RGBImageToHSVChannelsFilter( ) @@ -38,13 +46,6 @@ cpPlugins::Plugins::RGBImageToHSVChannelsFilter:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Plugins::RGBImageToHSVChannelsFilter:: -GetClassName( ) const -{ - return( "cpPlugins::Plugins::RGBImageToHSVChannelsFilter" ); -} - // ------------------------------------------------------------------------- std::string cpPlugins::Plugins::RGBImageToHSVChannelsFilter:: _GenerateData( ) @@ -52,10 +53,10 @@ _GenerateData( ) itk::DataObject* o = this->_GetInput( 0 ); std::string r = "cpPlugins::Plugins::RGBImageToHSVChannelsFilter: itk::Image dimension not supported."; - cpPlugins_RGBImageToHSVChannelsFilter_Dimension( r, 1, o, _GD0 ); - else cpPlugins_RGBImageToHSVChannelsFilter_Dimension( r, 2, o, _GD0 ); - else cpPlugins_RGBImageToHSVChannelsFilter_Dimension( r, 3, o, _GD0 ); - else cpPlugins_RGBImageToHSVChannelsFilter_Dimension( r, 4, o, _GD0 ); + cpPlugins_RGB2HSV_Dimension( r, 1, o, _GD0 ); + else cpPlugins_RGB2HSV_Dimension( r, 2, o, _GD0 ); + else cpPlugins_RGB2HSV_Dimension( r, 3, o, _GD0 ); + else cpPlugins_RGB2HSV_Dimension( r, 4, o, _GD0 ); return( r ); } @@ -68,16 +69,16 @@ _GD0( ) dynamic_cast< itk::ImageBase< D >* >( this->_GetInput( 0 ) ); std::string r = "cpPlugins::Plugins::RGBImageToHSVChannelsFilter: itk::Image pixel type not supported"; - cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, char, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, short, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, int, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, long, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, unsigned char, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, unsigned short, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, unsigned int, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, unsigned long, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, float, D, i, _GD1 ); - else cpPlugins_RGBImageToHSVChannelsFilter_RGB( r, double, D, i, _GD1 ); + cpPlugins_RGB2HSV_RGB( r, char, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, short, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, int, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, long, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, unsigned char, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, unsigned short, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, unsigned int, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, unsigned long, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, float, D, i, _GD1 ); + else cpPlugins_RGB2HSV_RGB( r, double, D, i, _GD1 ); return( r ); } @@ -93,11 +94,12 @@ _GD1( ) // Filter creation _TFilter* filter = - dynamic_cast< _TFilter* >( this->m_Filter.GetPointer( ) ); + dynamic_cast< _TFilter* >( this->m_RealProcessObject.GetPointer( ) ); if( filter == NULL ) { - this->m_Filter = _TFilter::New( ); - filter = dynamic_cast< _TFilter* >( this->m_Filter.GetPointer( ) ); + this->m_RealProcessObject = _TFilter::New( ); + filter = + dynamic_cast< _TFilter* >( this->m_RealProcessObject.GetPointer( ) ); } // fi filter->SetInput( dynamic_cast< _TImage* >( this->_GetInput( 0 ) ) ); diff --git a/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h b/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h index bbe124a..d9fe353 100644 --- a/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h +++ b/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h @@ -3,7 +3,6 @@ #include #include -#include namespace cpPlugins { @@ -17,17 +16,26 @@ namespace cpPlugins public: typedef RGBImageToHSVChannelsFilter Self; typedef cpPlugins::Interface::ImageToImageFilter Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::TParameter TParameter; typedef Superclass::TParameters TParameters; public: - RGBImageToHSVChannelsFilter( ); - virtual ~RGBImageToHSVChannelsFilter( ); + itkNewMacro( Self ); + itkTypeMacro( + RGBImageToHSVChannelsFilter, + cpPluginsInterfaceImageToImageFilter + ); + public: virtual std::string GetClassName( ) const; protected: + RGBImageToHSVChannelsFilter( ); + virtual ~RGBImageToHSVChannelsFilter( ); + virtual std::string _GenerateData( ); template< unsigned int D > @@ -36,12 +44,14 @@ namespace cpPlugins template< class P, unsigned int D > std::string _GD1( ); - protected: - itk::ProcessObject::Pointer m_Filter; + private: + // Purposely not implemented + RGBImageToHSVChannelsFilter( const Self& ); + Self& operator=( const Self& ); }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER( + PLUMA_INHERIT_PROVIDER_CPPLUGINS( RGBImageToHSVChannelsFilter, cpPlugins::Interface::Object ); -- 2.47.1