]> Creatis software - cpPlugins.git/commitdiff
Garbage collector added
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 23 Dec 2014 11:10:09 +0000 (12:10 +0100)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 23 Dec 2014 11:10:09 +0000 (12:10 +0100)
57 files changed:
appli/ImageMPR/ImageMPR.cxx
appli/ImageMPR/ImageMPR.h
appli/examples/example_LoadPlugins.cxx
appli/examples/example_MPR.cxx
appli/examples/example_RGBImageToHSVChannels.cxx
appli/examples/example_ReadImageSeriesWriteImage.cxx
appli/examples/example_ReadQuadEdgeMesh.cxx
appli/examples/example_ReadWriteImage.cxx
appli/examples/example_RenderQuadEdgeMesh.cxx
doc/uml/cpPlugins_classes.dia
lib/cpPlugins/Interface/DataObject.cxx
lib/cpPlugins/Interface/DataObject.h
lib/cpPlugins/Interface/FilterObject.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/FilterObject.h
lib/cpPlugins/Interface/Image.cxx
lib/cpPlugins/Interface/Image.h
lib/cpPlugins/Interface/ImageSink.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/ImageSink.h [new file with mode: 0644]
lib/cpPlugins/Interface/ImageSource.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/ImageSource.h [new file with mode: 0644]
lib/cpPlugins/Interface/ImageToImageFilter.cxx
lib/cpPlugins/Interface/ImageToImageFilter.h
lib/cpPlugins/Interface/ImageToMeshFilter.cxx
lib/cpPlugins/Interface/ImageToMeshFilter.h
lib/cpPlugins/Interface/Instances_itkImage.cxx
lib/cpPlugins/Interface/Interface.cxx
lib/cpPlugins/Interface/Interface.h
lib/cpPlugins/Interface/Mesh.cxx
lib/cpPlugins/Interface/Mesh.h
lib/cpPlugins/Interface/MeshSink.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/MeshSink.h [new file with mode: 0644]
lib/cpPlugins/Interface/MeshSource.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/MeshSource.h [new file with mode: 0644]
lib/cpPlugins/Interface/MeshToImageFilter.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/MeshToImageFilter.h
lib/cpPlugins/Interface/MeshToMeshFilter.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/MeshToMeshFilter.h
lib/cpPlugins/Interface/Object.cxx
lib/cpPlugins/Interface/Object.h
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/cpPlugins/Interface/SinkObject.cxx
lib/cpPlugins/Interface/SinkObject.h
lib/cpPlugins/Interface/SourceObject.cxx
lib/cpPlugins/Interface/SourceObject.h
lib/cpPlugins/Plugins/ImageReader.cxx
lib/cpPlugins/Plugins/ImageReader.h
lib/cpPlugins/Plugins/ImageSeriesReader.cxx
lib/cpPlugins/Plugins/ImageSeriesReader.h
lib/cpPlugins/Plugins/ImageWriter.cxx
lib/cpPlugins/Plugins/ImageWriter.h
lib/cpPlugins/Plugins/MarchingCubes.cxx
lib/cpPlugins/Plugins/MarchingCubes.h
lib/cpPlugins/Plugins/MeshReader.cxx
lib/cpPlugins/Plugins/MeshReader.h
lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.cxx
lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h

index 26c8f349076c6e8c50a8047c2f7a4a200dc2d474..1d0570304d3c6a00f7cabebd074188f5e3cc51e8 100644 (file)
@@ -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( ) );
 }
 
index 69b883afeccdf9fe48b07fb4953b4500e5816755..c9bb20f31f71f214bc00d4933519e7c6f5c6f95f 100644 (file)
@@ -62,7 +62,7 @@ private:
   TStringMap m_BaseClasses;
 
   // Real data
-  TPluginImage* m_InputImage;
+  TPluginImage::Pointer m_InputImage;
 
   // Visualization stuff
   TMPR* m_MPR;
index 383c85b6cbf07b79d3049462af4d8785323abecc..4bc43d041b427914bbcc00ed2ac73b593316a357 100644 (file)
@@ -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 );
index 3f11a4fa091fde8c9c7193d971d7a36d88fc2f16..9a8865c2de7d66fdfcce854b75319b4947c2055b 100644 (file)
@@ -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 );
 }
 
index 7266800302c47aa44ebd84b1b82b587d26c3f1e3..9a2a46893fd33e684e628ef9f549e2a8337f4920 100644 (file)
@@ -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 );
 }
 
index cab163c43a0f1d05844919e940e77caf9279aded..e2216ff7c1a997bf007611006b47ec77985d4776 100644 (file)
@@ -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 );
 }
 
index 655acad6f10d1dd8519add128f1a101db38c4542..94b6d6c190c8e3ffc656a6d2005de1988143ae02 100644 (file)
@@ -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 );
 }
 
index e07761c07a0a8d93b21d2ddf6be5a913bfae2037..d1419d9ba8347c304d8dc4b3c80092fd6b1c9d15 100644 (file)
@@ -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 );
 }
 
index db1e1ab4d8a407cbb3e25f0760ffbe155187bfb7..9fcd519d47e24ee334efa3c212869450bf9fc98b 100644 (file)
@@ -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 );
 }
 
index 03310422a07f092b9c1496c2e74d6300ffe99be6..d5c06312e9c36e1ace50bf3e6689c114247c72c0 100644 (file)
Binary files a/doc/uml/cpPlugins_classes.dia and b/doc/uml/cpPlugins_classes.dia differ
index 310cbb3b8d91db6b3454fe5909759600e49decfb..21b5f1d416d4dbfe0046e11b5799c333ead3f54d 100644 (file)
@@ -1,42 +1,42 @@
 #include <cpPlugins/Interface/DataObject.h>
 
 // -------------------------------------------------------------------------
-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$
index 3f561a2a23e40c9ab1d464c161fe2390e9627140..c6a2129576e27fcb81cce76559092b06bef7ba34 100644 (file)
@@ -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 (file)
index 0000000..b7b5218
--- /dev/null
@@ -0,0 +1,30 @@
+#include <cpPlugins/Interface/FilterObject.h>
+
+// -------------------------------------------------------------------------
+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$
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9f526c48d5167761dec85d04f5c23c60325890cb 100644 (file)
@@ -0,0 +1,48 @@
+#ifndef __CPPLUGINS__INTERFACE__FILTEROBJECT__H__
+#define __CPPLUGINS__INTERFACE__FILTEROBJECT__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+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$
index 52792d3c4b56dc08dcdd9d6bd63c0a31d406354b..23cea6efeb9d4eac78d76080d94f4eede33c3224 100644 (file)
 
 // -------------------------------------------------------------------------
 #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( );
index f5454c4e6bb33c205da03f89eea03ab7ddfd4365..4ba14cbf558fc80964f610acf9b2b0df393f47ec 100644 (file)
@@ -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 (file)
index 0000000..e22c14b
--- /dev/null
@@ -0,0 +1,30 @@
+#include <cpPlugins/Interface/ImageSink.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..3895e21
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef __CPPLUGINS__INTERFACE__IMAGESINK__H__
+#define __CPPLUGINS__INTERFACE__IMAGESINK__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/SinkObject.h>
+
+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 (file)
index 0000000..b58afd9
--- /dev/null
@@ -0,0 +1,30 @@
+#include <cpPlugins/Interface/ImageSource.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..2e8b80c
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef __CPPLUGINS__INTERFACE__IMAGESOURCE__H__
+#define __CPPLUGINS__INTERFACE__IMAGESOURCE__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/SourceObject.h>
+
+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$
index 34fffdc8f7cd6b261eadf3207f5947fa610ee6de..962c7a0a2cab926c0c6dbb034e3feac2b7fd1523 100644 (file)
@@ -1,23 +1,30 @@
 #include <cpPlugins/Interface/ImageToImageFilter.h>
 
 // -------------------------------------------------------------------------
-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$
index 962ec27178cd1ae05527e4a223f324ecd1ac880a..d7ac57a14000f6013319191840cf2f30d9a48cfa 100644 (file)
@@ -2,7 +2,7 @@
 #define __CPPLUGINS__INTERFACE__IMAGETOIMAGEFILTER__H__
 
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/FilterObject.h>
 
 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
index e5be5665bba29050feffb20a8aa325b864dce4b7..b2a2a296c2c3bfc2d2384473857b581244e185b1 100644 (file)
@@ -1,23 +1,30 @@
 #include <cpPlugins/Interface/ImageToMeshFilter.h>
 
 // -------------------------------------------------------------------------
-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$
index dba914249facfa3d9818bf7e6f5aeb46809703e0..472f47a0ccb9e3bdcc5211a1a269fa71289b98ad 100644 (file)
@@ -2,7 +2,7 @@
 #define __CPPLUGINS__INTERFACE__IMAGETOMESHFILTER__H__
 
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/FilterObject.h>
 
 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
index cfa9b74930063b6faebb3f47694d5ec9f5d85a14..ba4d66e07f450dd16fe100f21bbcb271e03bf5e4 100644 (file)
@@ -3,67 +3,67 @@
 #include <itkImageToVTKImageFilter.h>
 
 // -------------------------------------------------------------------------
-#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$
index 332ace5db7ce76768bea1b1480fec2cd29d1c437..e4160c623869688f6cfe63bccf98208521651838 100644 (file)
@@ -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
 }
index 1bade44fa75acfabc223413089b195f0bdd5e297..585e2d5fd4b260824390559a4cc204fb6766825d 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Object.h>
+#include <cpPlugins/Interface/ProcessObject.h>
 
 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 );
index 8a184c92471917b24ec2747856b51fd0dfc8362d..9841f7e0c2bd3fd5cab159f4f08b1eae9e7d5230 100644 (file)
@@ -5,21 +5,6 @@
 #include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
 #include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
 
-// -------------------------------------------------------------------------
-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;
index 805b8a1d66b76d158b4b84fe5df002cb5bb66693..241da35309cac492dfea071d86be5fa226af0407 100644 (file)
@@ -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 (file)
index 0000000..dffacef
--- /dev/null
@@ -0,0 +1,30 @@
+#include <cpPlugins/Interface/MeshSink.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..b110cb3
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef __CPPLUGINS__INTERFACE__MESHSINK__H__
+#define __CPPLUGINS__INTERFACE__MESHSINK__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/SinkObject.h>
+
+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 (file)
index 0000000..c608147
--- /dev/null
@@ -0,0 +1,30 @@
+#include <cpPlugins/Interface/MeshSource.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..9c5c3d2
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef __CPPLUGINS__INTERFACE__MESHSOURCE__H__
+#define __CPPLUGINS__INTERFACE__MESHSOURCE__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/SourceObject.h>
+
+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 (file)
index 0000000..804a381
--- /dev/null
@@ -0,0 +1,30 @@
+#include <cpPlugins/Interface/MeshToImageFilter.h>
+
+// -------------------------------------------------------------------------
+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$
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b6447d2042cfa2d9ed9d436c354cd509bbf941d6 100644 (file)
@@ -0,0 +1,48 @@
+#ifndef __CPPLUGINS__INTERFACE__MESHTOIMAGEFILTER__H__
+#define __CPPLUGINS__INTERFACE__MESHTOIMAGEFILTER__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/FilterObject.h>
+
+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 (file)
index 0000000..4f5c76f
--- /dev/null
@@ -0,0 +1,30 @@
+#include <cpPlugins/Interface/MeshToMeshFilter.h>
+
+// -------------------------------------------------------------------------
+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$
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7121c0e7776b8467a648cda04b8adc3079d7907c 100644 (file)
@@ -0,0 +1,48 @@
+#ifndef __CPPLUGINS__INTERFACE__MESHTOMESHFILTER__H__
+#define __CPPLUGINS__INTERFACE__MESHTOMESHFILTER__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/FilterObject.h>
+
+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$
index c0418d3ce1f69ae4a6bd92d907f779750fecf365..3868b2c2c24d342006338530a35abae77e6b8616 100644 (file)
@@ -1,22 +1,30 @@
 #include <cpPlugins/Interface/Object.h>
 
 // -------------------------------------------------------------------------
-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" );
 }
 
 // -------------------------------------------------------------------------
index d4436f68db36a6619947081124fd61275e120a21..33cfdd7079cd61ab1e361369a3af305c271d3872 100644 (file)
@@ -3,8 +3,30 @@
 
 #include <string>
 #include <Pluma/Pluma.hpp>
+#include <itkObject.h>
+#include <itkObjectFactory.h>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 
+// -------------------------------------------------------------------------
+#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
 
index d1982b0690b42a57f72cc9094d8e14b7cbffa780..e05e7a818de734f54f3f257e8cfb296a319bf0ad 100644 (file)
@@ -1,25 +1,17 @@
 #include <cpPlugins/Interface/ProcessObject.h>
 
 // -------------------------------------------------------------------------
-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$
index a5404a890e91962279d07dbd61be11108815e6e2..f4c80ae21a7fcf712406b4adc88e3a2f23f47603 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <map>
 #include <string>
-#include <itkDataObject.h>
 #include <itkProcessObject.h>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Object.h>
@@ -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
index c0ff636137d1692f5b7a5d60629c0c5a7648d8d6..309a3d18e02060cca8bd0eea827fa96c6a7b81db 100644 (file)
@@ -1,5 +1,19 @@
 #include <cpPlugins/Interface/SinkObject.h>
 
+// -------------------------------------------------------------------------
+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$
index 7caf70ea38218921bfdef94fe0344d9120a1f385..52723d13d75dbb61163df3c11b269fac61c46b08 100644 (file)
@@ -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
index b4499dbbf16a9c6dc0363272362c6ce7f372d24c..9ad08785f15d183ae949105fa950714884797dbf 100644 (file)
@@ -1,5 +1,19 @@
 #include <cpPlugins/Interface/SourceObject.h>
 
+// -------------------------------------------------------------------------
+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$
index 22914b9904bbe7237d13c4aaa67f409608e11611..0c036ce68947de9106e2dcc2d2b8981f06fc76f8 100644 (file)
@@ -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
index df0f1e6cf2a7a9e15d93483e82cce468882b88a3..0aa4bfc233f7ae56f0f57c259ec86ed8cd9cd711 100644 (file)
@@ -7,6 +7,13 @@
 #include <itkImage.h>
 #include <itkRGBPixel.h>
 
+// -------------------------------------------------------------------------
+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 );
index 39d243b4ae8a7aa1fc816d0f5dcda4a099b2e490..2c73d70ddaae32af73b48c100a43b072c46b82ee 100644 (file)
@@ -2,7 +2,7 @@
 #define __CPPLUGINS__PLUGINS__IMAGEREADER__H__
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/SourceObject.h>
+#include <cpPlugins/Interface/ImageSource.h>
 #include <itkProcessObject.h>
 
 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
 
index 416352a87161fa0530018d7ea5af31a41aba54df..d6fbfa6487919be026847a3591ff28c97e1ea3ab 100644 (file)
 #include <itkImage.h>
 #include <itkRGBPixel.h>
 
+// -------------------------------------------------------------------------
+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( );
index 6ddf039dbd19f3e4ec6e3a4b5df6fd544a4f3322..9bd9bc2c5c806552c2a5e81345c1fae3c2e9dfbb 100644 (file)
@@ -2,7 +2,7 @@
 #define __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/SourceObject.h>
+#include <cpPlugins/Interface/ImageSource.h>
 #include <itkProcessObject.h>
 
 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
 
index 41fdb301f0f67dc4375ef714d805e5794ab38bdf..aea4a21e7d42914c01d9f7d33d5cf05abf8eae98 100644 (file)
     )                                                                   \
     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 );
index 57f15db0e36d8d022e0fde1a9d76b209765f0084..1dcd98f5dbaf9534c2634a3160aca1b8cb10d95a 100644 (file)
@@ -2,7 +2,7 @@
 #define __CPPLUGINS__PLUGINS__IMAGEWRITER__H__
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/SinkObject.h>
+#include <cpPlugins/Interface/ImageSink.h>
 #include <itkProcessObject.h>
 
 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
 
index 32040333bd7737760253e0facb5eded80ed9d81e..12aad40157c72f728ad7c128b6c818f4398ed823 100644 (file)
@@ -8,6 +8,13 @@
 #include <itkImage.h>
 #include <itkRGBPixel.h>
 
+// -------------------------------------------------------------------------
+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( )
index c691f8fffdcd93d7f6faee5b24a61d4900b818c0..cf616b0df858da91ada5fb8b7cd4e22a838c1061 100644 (file)
@@ -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
 
index 322e49c350fec9432404770150280b33b569d360..b219899fa930cb525f21dd8a2486bf78e3ecee56 100644 (file)
@@ -4,6 +4,13 @@
 #include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
 #include <cpPlugins/Extensions/IO/MeshReader.h>
 
+// -------------------------------------------------------------------------
+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 );
index 968c4ac5ae536c10291f4f719780aa54308f7487..bfd94264acab27dc6b5450dae41a61cbf843519b 100644 (file)
@@ -2,7 +2,7 @@
 #define __CPPLUGINS__PLUGINS__MESHREADER__H__
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/SourceObject.h>
+#include <cpPlugins/Interface/MeshSource.h>
 #include <itkProcessObject.h>
 
 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
 
index 8d5403455b95d72e3766daa58cd0b2965a608412..339a818f8fc358cc941332f5199e4297f8515684 100644 (file)
@@ -7,17 +7,25 @@
 #include <itkRGBPixel.h>
 
 // -------------------------------------------------------------------------
-#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 ) ) );
index bbe124a63e98a1c290d3e4b6cc1614a25a8217a2..d9fe353a84ec9e1f9a08621d762988ce4d5bce06 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
 #include <cpPlugins/Interface/ImageToImageFilter.h>
-#include <itkProcessObject.h>
 
 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
       );