]> Creatis software - cpPlugins.git/commitdiff
Major refactoring: API-HCI bug corrected.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 15 Sep 2015 17:26:06 +0000 (19:26 +0200)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 15 Sep 2015 17:26:06 +0000 (19:26 +0200)
65 files changed:
appli/ImageMPR/ImageMPR.cxx
appli/ImageMPR/ImageMPR.h
appli/examples/CMakeLists.txt
appli/examples/example_MarchingCubes.cxx [new file with mode: 0644]
appli/examples/example_ReadWriteImage.cxx
lib/cpPlugins/Interface/DataObject.cxx
lib/cpPlugins/Interface/DataObject.h
lib/cpPlugins/Interface/FilterObject.cxx
lib/cpPlugins/Interface/FilterObject.h
lib/cpPlugins/Interface/Image.cxx
lib/cpPlugins/Interface/Image.h
lib/cpPlugins/Interface/ImageSink.cxx
lib/cpPlugins/Interface/ImageSink.h
lib/cpPlugins/Interface/ImageSource.cxx
lib/cpPlugins/Interface/ImageSource.h
lib/cpPlugins/Interface/ImageToImageFilter.cxx
lib/cpPlugins/Interface/ImageToImageFilter.h
lib/cpPlugins/Interface/ImageToMeshFilter.cxx
lib/cpPlugins/Interface/ImageToMeshFilter.h
lib/cpPlugins/Interface/ImageToPolyLineParametricPathFilter.cxx [deleted file]
lib/cpPlugins/Interface/ImageToPolyLineParametricPathFilter.h [deleted file]
lib/cpPlugins/Interface/Instances_itkImage.cxx
lib/cpPlugins/Interface/Instances_itkMesh.cxx
lib/cpPlugins/Interface/Instances_itkPolyLineParametricPath.cxx [deleted file]
lib/cpPlugins/Interface/Interface.h
lib/cpPlugins/Interface/Mesh.cxx
lib/cpPlugins/Interface/Mesh.h
lib/cpPlugins/Interface/MeshSink.cxx
lib/cpPlugins/Interface/MeshSink.h
lib/cpPlugins/Interface/MeshSource.cxx
lib/cpPlugins/Interface/MeshSource.h
lib/cpPlugins/Interface/MeshToImageFilter.cxx
lib/cpPlugins/Interface/MeshToImageFilter.h
lib/cpPlugins/Interface/MeshToMeshFilter.cxx
lib/cpPlugins/Interface/MeshToMeshFilter.h
lib/cpPlugins/Interface/Object.cxx
lib/cpPlugins/Interface/Object.h
lib/cpPlugins/Interface/PolyData.cxx [deleted file]
lib/cpPlugins/Interface/PolyData.h [deleted file]
lib/cpPlugins/Interface/PolyDataSource.cxx [deleted file]
lib/cpPlugins/Interface/PolyDataSource.h [deleted file]
lib/cpPlugins/Interface/PolyLineParametricPath.cxx [deleted file]
lib/cpPlugins/Interface/PolyLineParametricPath.h [deleted file]
lib/cpPlugins/Interface/PolyLineParametricPathSource.cxx [deleted file]
lib/cpPlugins/Interface/PolyLineParametricPathSource.h [deleted file]
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/CMakeLists.txt
lib/cpPlugins/Plugins/Host.cxx
lib/cpPlugins/Plugins/ImageReader.cxx
lib/cpPlugins/Plugins/ImageReader.h
lib/cpPlugins/Plugins/ImageSeriesReader.cxx [deleted file]
lib/cpPlugins/Plugins/ImageSeriesReader.h [deleted file]
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/MeshWriter.cxx [new file with mode: 0644]
lib/cpPlugins/Plugins/MeshWriter.h [new file with mode: 0644]

index 71b8e9d765096f9248858b28392ac50575af6198..931ff3ae7579e1a42bab0ed58e5cf3df80a44d0d 100644 (file)
@@ -8,9 +8,11 @@
 #include <QMessageBox>
 
 #ifdef _WIN32
+#  define PLUGIN_PREFIX ""
 #  define PLUGIN_EXT "dll"
 #  define PLUGIN_REGEX "Plugins file (*.dll);;All files (*)"
 #else
+#  define PLUGIN_PREFIX "lib"
 #  define PLUGIN_EXT "so"
 #  define PLUGIN_REGEX "Plugins file (*.so);;All files (*)"
 #endif // _WIN32
@@ -46,7 +48,11 @@ ImageMPR::ImageMPR( QWidget* parent )
     );
 
   // Start: load all disponible plugins
-  this->_triggered_actionOpenPlugins( );
+  this->_LoadPlugins(
+    std::string( PLUGIN_PREFIX ) +
+    std::string( "cpPlugins." ) +
+    std::string( PLUGIN_EXT )
+    );
 }
 
 // -------------------------------------------------------------------------
@@ -61,6 +67,22 @@ ImageMPR::
   delete this->m_MPR;
 }
 
+// -------------------------------------------------------------------------
+bool ImageMPR::
+_LoadPlugins( const std::string& filename )
+{
+  this->m_Plugins.UnloadAll( );
+  if( !( this->m_Plugins.Load( filename ) ) )
+  {
+    this->m_Plugins.UnloadAll( );
+    return( false );
+
+  } // fi
+  this->m_BaseClasses[ "ImageReader" ] = "cpPlugins::ImageReader";
+  this->m_BaseClasses[ "MeshReader" ] = "cpPlugins::MeshReader";
+  return( true );
+}
+
 // -------------------------------------------------------------------------
 void ImageMPR::
 _triggered_actionOpenPlugins( )
@@ -75,23 +97,12 @@ _triggered_actionOpenPlugins( )
     return;
   
   std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
-  this->m_Plugins.UnloadAll( );
-  if( !( this->m_Plugins.Load( fname ) ) )
-  {
+  if( !( _LoadPlugins( fname ) ) )
     QMessageBox::critical(
       this,
       tr( "Ignoring plugin" ),
       tr( fname.c_str( ) )
       );
-    this->m_Plugins.UnloadAll( );
-    return;
-
-  } // fi
-
-  this->m_BaseClasses[ "ImageReader" ] =
-    "cpPlugins::Plugins::ImageReader";
-  this->m_BaseClasses[ "PolyDataReader" ] =
-    "cpPlugins::Plugins::PolyDataReader";
 }
 
 // -------------------------------------------------------------------------
@@ -112,7 +123,7 @@ _triggered_actionOpenInputImage( )
   this->m_InputImage = NULL;
 
   // Get a reader from plugins
-  TPlugin::Pointer reader =
+  TPluginFilter::Pointer reader =
     this->m_Plugins.CreateProcessObject(
       this->m_BaseClasses[ "ImageReader" ]
       );
@@ -125,11 +136,6 @@ _triggered_actionOpenInputImage( )
   QStringList::const_iterator qIt = q_fnames.begin( );
   for( ; qIt != q_fnames.end( ); ++qIt )
     reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
-
-  // Other parameters
-  reader_params.SetValueAsString( "PixelType", "short" );
-  reader_params.SetValueAsUint( "ImageDimension", 3 );
-  reader_params.SetValueAsUint( "IsColorImage", 0 );
   reader->SetParameters( reader_params );
 
   // Execute and get error message, if any
@@ -167,12 +173,12 @@ _triggered_actionOpenInputPolyData( )
   
   std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
 
-  this->m_InputPolyData = NULL;
+  this->m_InputMesh = NULL;
 
   // Get a reader from plugins
-  TPlugin::Pointer reader =
+  TPluginFilter::Pointer reader =
     this->m_Plugins.CreateProcessObject(
-      this->m_BaseClasses[ "PolyDataReader" ]
+      this->m_BaseClasses[ "MeshReader" ]
       );
 
   // Configure plugin
@@ -186,13 +192,16 @@ _triggered_actionOpenInputPolyData( )
   // Assign fresh image, if any
   if( err == "" )
   {
-    this->m_InputPolyData =
-      dynamic_cast< TPluginPolyData* >( reader->GetOutput( 0 ) );
+    this->m_InputMesh =
+      dynamic_cast< TPluginMesh* >( reader->GetOutput( 0 ) );
     reader->DisconnectOutputs( );
-    if( this->m_InputPolyData.IsNotNull( ) )
+    if( this->m_InputMesh.IsNotNull( ) )
     {
-      this->m_InputPolyData->GetActor( )->GetProperty( )->SetColor( 1, 0, 1 );
-      this->m_MPR->Add3DActor( this->m_InputPolyData->GetActor( ) );
+      this->m_InputMeshMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+      this->m_InputMeshMapper->SetInputData( this->m_InputMesh->GetVTKPolyData( ) );
+      this->m_InputMeshActor = vtkSmartPointer< vtkActor >::New( );
+      this->m_InputMeshActor->SetMapper( this->m_InputMeshMapper );
+      this->m_MPR->Add3DActor( this->m_InputMeshActor );
 
     } // fi
   }
index b8d91f12a60828cb4bd680e533a30f775b6318e9..959daf1fc2a62195bbe3ce2031b4c5c379c4cd78 100644 (file)
@@ -15,8 +15,7 @@
 #include <cpPlugins/Interface/Interface.h>
 #include <cpPlugins/Interface/ProcessObject.h>
 #include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/PolyData.h>
-#include <cpPlugins/Interface/DataObject.h>
+#include <cpPlugins/Interface/Mesh.h>
 #include <cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h>
 
 // -------------------------------------------------------------------------
@@ -39,8 +38,8 @@ public:
   typedef cpPlugins::Interface::Object        TPluginObject;
   typedef cpPlugins::Interface::DataObject    TPluginData;
   typedef cpPlugins::Interface::Image         TPluginImage;
-  typedef cpPlugins::Interface::PolyData      TPluginPolyData;
-  typedef cpPlugins::Interface::ProcessObject TPlugin;
+  typedef cpPlugins::Interface::Mesh          TPluginMesh;
+  typedef cpPlugins::Interface::ProcessObject TPluginFilter;
   typedef cpPlugins::Interface::Parameters    TParameters;
 
   typedef std::map< std::string, std::string > TStringMap;
@@ -50,6 +49,9 @@ public:
   explicit ImageMPR( QWidget* parent = 0 );
   virtual ~ImageMPR( );
 
+protected:
+  bool _LoadPlugins( const std::string& filename );
+
 private slots:
   void _triggered_actionOpenPlugins( );
   void _triggered_actionOpenInputImage( );
@@ -65,11 +67,13 @@ private:
   TStringMap m_BaseClasses;
 
   // Real data
-  TPluginImage::Pointer    m_InputImage;
-  TPluginPolyData::Pointer m_InputPolyData;
+  TPluginImage::Pointer m_InputImage;
+  TPluginMesh::Pointer  m_InputMesh;
 
   // Visualization stuff
   TMPR* m_MPR;
+  vtkSmartPointer< vtkPolyDataMapper > m_InputMeshMapper;
+  vtkSmartPointer< vtkActor >          m_InputMeshActor;
 
   /* TODO
      vtkSmartPointer< vtkOrientationMarkerWidget > m_3DOrientationWidget;
index 97801d4928898e69bdeb9f3ce34186b2601bf57d..3ea27975230294088208f9d13f5d64ef59961860 100644 (file)
@@ -5,15 +5,16 @@
 
 SET(
   EXAMPLES_PROGRAMS
-  example_TestParameters
-  example_LoadPlugins
+  ## example_TestParameters
+  ## example_LoadPlugins
   example_ReadWriteImage
-  example_ReadImageSeriesWriteImage
-  example_ReadQuadEdgeMesh
-  example_RenderQuadEdgeMesh
-  example_RGBImageToHSVChannels
-  example_RGBImageToYPbPrChannels
-  example_MPR
+  ## example_ReadImageSeriesWriteImage
+  ## example_ReadQuadEdgeMesh
+  ## example_RenderQuadEdgeMesh
+  ## example_RGBImageToHSVChannels
+  ## example_RGBImageToYPbPrChannels
+  ## example_MPR
+  example_MarchingCubes
   )
 
 FOREACH(prog ${EXAMPLES_PROGRAMS}) 
@@ -29,17 +30,17 @@ ENDFOREACH(prog)
 
 SET(
   NOPLUGINS_EXAMPLES_PROGRAMS
-  example_ExtractDICOMSeries
-  example_ImageGaussianModelEstimator
-  example_ReadQuadEdgeMeshWithoutPlugins
-  example_RenderQuadEdgeMeshWithoutPlugins
-  example_ParallelImageMean
-  example_LightCompensation
-  example_1DImageGradient
-  example_2DImageGradient
-  example_3DImageGradient
-  example_2DGulsunTekMedialness
-  example_3DGulsunTekMedialness
+  ## example_ExtractDICOMSeries
+  ## example_ImageGaussianModelEstimator
+  ## example_ReadQuadEdgeMeshWithoutPlugins
+  ## example_RenderQuadEdgeMeshWithoutPlugins
+  ## example_ParallelImageMean
+  ## example_LightCompensation
+  ## example_1DImageGradient
+  ## example_2DImageGradient
+  ## example_3DImageGradient
+  ## example_2DGulsunTekMedialness
+  ## example_3DGulsunTekMedialness
   ## example_KalmanVelocity
   )
 FOREACH(prog ${NOPLUGINS_EXAMPLES_PROGRAMS}) 
diff --git a/appli/examples/example_MarchingCubes.cxx b/appli/examples/example_MarchingCubes.cxx
new file mode 100644 (file)
index 0000000..7894fe0
--- /dev/null
@@ -0,0 +1,76 @@
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+int main( int argc, char* argv[] )
+{
+  if( argc < 5 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " plugins_file"
+      << " input_image value output_mesh" << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create interface
+  typedef cpPlugins::Interface::Interface TInterface;
+  typedef TInterface::TClasses            TClasses;
+  TInterface plugins;
+  if( !plugins.Load( argv[ 1 ] ) )
+  {
+    std::cerr << "Failed to load plugins." << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create objects
+  typedef cpPlugins::Interface::ProcessObject TProcessObject;
+  typedef cpPlugins::Interface::Parameters    TParameters;
+  cpPlugins::Interface::ProcessObject::Pointer reader, writer, mc;
+  reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+  writer = plugins.CreateProcessObject( "cpPlugins::MeshWriter" );
+  mc = plugins.CreateProcessObject( "cpPlugins::MarchingCubes" );
+  if( reader.IsNull( ) || writer.IsNull( ) || mc.IsNull( ) )
+  {
+    std::cerr << "No suitable objects found in plugins." << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Configure reader
+  TParameters reader_params = reader->GetDefaultParameters( );
+  for( int i = 2; i < argc - 2; ++i )
+    reader_params.AddValueToStringList( "FileNames", argv[ i ] );
+  reader->SetParameters( reader_params );
+  // Configure marching cubes
+  TParameters mc_params = mc->GetDefaultParameters( );
+  mc_params.AddValueToRealList( "Thresholds", std::atof( argv[ argc - 2 ] ) );
+  mc->SetParameters( mc_params );
+
+  // Configure writer
+  TParameters writer_params = writer->GetDefaultParameters( );
+  writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
+  writer->SetParameters( writer_params );
+
+  // Connect pipeline
+  mc->SetInput( 0, reader->GetOutput( 0 ) );
+  writer->SetInput( 0, mc->GetOutput( 0 ) );
+
+  // Execute pipeline
+  std::string err = writer->Update( );
+  if( err != "" )
+  {
+    std::cerr << "ERROR: " << err << std::endl;
+    return( 1 );
+
+  } // fi
+  return( 0 );
+}
+
+// eof - $RCSfile$
index fa644d055832eac3eadd42602d7d021b0049c396..8c562a96dcb0ea9aebcc94faea5b9c11a6d6c9c8 100644 (file)
@@ -7,44 +7,39 @@
 
 int main( int argc, char* argv[] )
 {
-  if( argc < 7 )
+  if( argc < 4 )
   {
     std::cerr
       << "Usage: " << argv[ 0 ]
       << " plugins_file"
-      << " input_image output_image"
-      << " dimensions pixel_type is_color" << std::endl;
+      << " input_image output_image" << std::endl;
     return( 1 );
 
   } // fi
-  std::string plugins_file = argv[ 1 ];
-  std::string input_image_file = argv[ 2 ];
-  std::string output_image_file = argv[ 3 ];
-  unsigned int dimensions = std::atoi( argv[ 4 ] );
-  std::string pixel_type = argv[ 5 ];
-  bool is_color = ( std::atoi( argv[ 6 ] ) == 1 );
 
   // Create interface
   typedef cpPlugins::Interface::Interface TInterface;
   typedef TInterface::TClasses            TClasses;
-
   TInterface plugins;
-  plugins.Load( plugins_file );
+  if( !plugins.Load( argv[ 1 ] ) )
+  {
+    std::cerr << "Failed to load plugins." << std::endl;
+    return( 1 );
+
+  } // fi
 
   // Create objects
   typedef cpPlugins::Interface::ProcessObject TProcessObject;
   typedef cpPlugins::Interface::Parameters    TParameters;
-  cpPlugins::Interface::ProcessObject::Pointer reader;
-  cpPlugins::Interface::ProcessObject::Pointer writer;
-
-  reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" );
+  cpPlugins::Interface::ProcessObject::Pointer reader, writer;
+  reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
   if( reader.IsNull( ) )
   {
     std::cerr << "No suitable reader found in plugins." << std::endl;
     return( 1 );
 
   } // fi
-  writer = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageWriter" );
+  writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" );
   if( writer.IsNull( ) )
   {
     std::cerr << "No suitable writer found in plugins." << std::endl;
@@ -54,25 +49,26 @@ int main( int argc, char* argv[] )
 
   // Configure reader
   TParameters reader_params = reader->GetDefaultParameters( );
-  reader_params.AddValueToStringList( "FileNames", input_image_file );
-  reader_params.SetValueAsString( "PixelType", pixel_type );
-  reader_params.SetValueAsUint( "ImageDimension", dimensions );
-  reader_params.SetValueAsUint( "IsColorImage", ( is_color? 1: 0 ) );
+  for( int i = 2; i < argc - 1; ++i )
+    reader_params.AddValueToStringList( "FileNames", argv[ i ] );
   reader->SetParameters( reader_params );
 
-  // Configure reader
+  // Configure writer
   TParameters writer_params = writer->GetDefaultParameters( );
-  writer_params.SetValueAsString( "FileName", output_image_file );
+  writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
   writer->SetParameters( writer_params );
 
   // Connect pipeline
   writer->SetInput( 0, reader->GetOutput( 0 ) );
 
-  std::string msg = writer->Update( );
-
-  if( msg != "" )
-    std::cerr << "ERROR: " << msg << std::endl;
+  // Execute pipeline
+  std::string err = writer->Update( );
+  if( err != "" )
+  {
+    std::cerr << "ERROR: " << err << std::endl;
+    return( 1 );
 
+  } // fi
   return( 0 );
 }
 
index 21b5f1d416d4dbfe0046e11b5799c333ead3f54d..73ff662f9c423c0891e26a965dc034120d18b57c 100644 (file)
@@ -1,31 +1,33 @@
 #include <cpPlugins/Interface/DataObject.h>
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::DataObject::
-GetClassName( ) const
+itk::DataObject* cpPlugins::Interface::DataObject::
+GetITKDataObject( )
 {
-  return( "cpPlugins::Interface::DataObject" );
+  return( this->m_ITKObject.GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::DataObject::
-GetClassType( ) const
+const itk::DataObject* cpPlugins::Interface::DataObject::
+GetITKDataObject( ) const
 {
-  return( "DataObject" );
+  return( this->m_ITKObject.GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
-itk::DataObject* cpPlugins::Interface::DataObject::
-GetRealDataObject( ) const
+vtkDataObject* cpPlugins::Interface::DataObject::
+GetVTKDataObject( )
 {
-  return( this->m_RealDataObject );
+  return( this->m_VTKObject.GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
-void cpPlugins::Interface::DataObject::
-SetRealDataObject( itk::DataObject* dobj )
+const vtkDataObject* cpPlugins::Interface::DataObject::
+GetVTKDataObject( ) const
 {
-  this->m_RealDataObject = dobj;
+  return( this->m_VTKObject.GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
@@ -46,16 +48,43 @@ GetSource( ) const
 void cpPlugins::Interface::DataObject::
 SetSource( cpPlugins::Interface::Object* src )
 {
-  this->m_Source = src;
+  if( this->m_Source.GetPointer( ) != src )
+  {
+    this->m_Source = src;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::DataObject::
 DisconnectPipeline( )
 {
-  if( this->m_RealDataObject.IsNotNull( ) )
+  if( this->m_ITKObject.IsNotNull( ) )
   {
-    this->m_RealDataObject->DisconnectPipeline( );
+    // Disconnect input pipelines
+    this->m_ITKObject->DisconnectPipeline( );
+    vtkImageData* vtk_image =
+      dynamic_cast< vtkImageData* >( this->m_VTKObject.GetPointer( ) );
+    vtkPolyData* vtk_pd =
+      dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) );
+    if( vtk_image != NULL )
+    {
+      vtkSmartPointer< vtkImageData > d =
+        vtkSmartPointer< vtkImageData >::New( );
+      d->ShallowCopy( vtk_image );
+      this->m_VTKObject = d;
+    }
+    else if( vtk_pd != NULL )
+    {
+      vtkSmartPointer< vtkPolyData > d =
+        vtkSmartPointer< vtkPolyData >::New( );
+      d->ShallowCopy( vtk_pd );
+      this->m_VTKObject = d;
+
+    } // fi
+
+    // Unbind source
     if( this->m_Source.IsNotNull( ) )
       this->m_Source->Delete( );
     this->Register( );
@@ -68,6 +97,8 @@ cpPlugins::Interface::DataObject::
 DataObject( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::DataObject";
+  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
index c6a2129576e27fcb81cce76559092b06bef7ba34..e61da5cbef4f04b82e41afccb1e092008795cd63 100644 (file)
@@ -3,10 +3,14 @@
 
 #include <map>
 #include <string>
-#include <itkDataObject.h>
+#include <vtkDataObject.h>
+#include <vtkSmartPointer.h>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Object.h>
 
+#define ITK_MANUAL_INSTANTIATION
+#include <itkDataObject.h>
+
 namespace cpPlugins
 {
   namespace Interface
@@ -23,15 +27,16 @@ namespace cpPlugins
       typedef itk::SmartPointer< const Self > ConstPointer;
 
     public:
-      itkNewMacro( Self );
       itkTypeMacro( DataObject, Object );
 
     public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
+      virtual itk::DataObject* GetITKDataObject( );
+      virtual const itk::DataObject* GetITKDataObject( ) const;
+      virtual void SetITKDataObject( itk::DataObject* o ) = 0;
 
-      itk::DataObject* GetRealDataObject( ) const;
-      virtual void SetRealDataObject( itk::DataObject* dobj );
+      virtual vtkDataObject* GetVTKDataObject( );
+      virtual const vtkDataObject* GetVTKDataObject( ) const;
+      virtual void SetVTKDataObject( vtkDataObject* o ) = 0;
 
       Object* GetSource( );
       const Object* GetSource( ) const;
@@ -49,8 +54,9 @@ namespace cpPlugins
       Self& operator=( const Self& );
 
     protected:
-      itk::DataObject::Pointer m_RealDataObject;
-      Object::Pointer          m_Source;
+      itk::DataObject::Pointer         m_ITKObject;
+      vtkSmartPointer< vtkDataObject > m_VTKObject;
+      Object::Pointer                  m_Source;
     };
 
   } // ecapseman
index b7b5218a18cc8c7bc1a5e00a28d6a5294d77ee89..24f7c50726493e183b68c9644942d9e0109562ff 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
 {
+  this->m_ClassName = "cpPlugins::Interface::FilterObject";
+  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
index 9718d76553271737cc2f6e687f683c99646d5b8d..0c1aafb5f9be01811fb4158b38719320fc84cdbd 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( FilterObject, ProcessObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       FilterObject( );
       virtual ~FilterObject( );
index c72663d5dbda9f65cb3cc2eddf021e64b4796fa3..a8b1d1bcafc03650b0c1ba69b7932e58f633bb63 100644 (file)
 #include <cpPlugins/Interface/Image.h>
 
-#define ITK_MANUAL_INSTANTIATION
+#undef ITK_MANUAL_INSTANTIATION
 #include <itkImage.h>
+#include <itkCovariantVector.h>
 #include <itkRGBPixel.h>
+#include <itkRGBAPixel.h>
+#include <itkVector.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkDiffusionTensor3D.h>
 #include <itkImageToVTKImageFilter.h>
+#include <itkVTKImageToImageFilter.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_Dimension( d, o, f )                         \
-  if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL )            \
-    this->f< d >( )
+#define cpPlugins_Image_Pixel( p, d, o )                                \
+  if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL )                \
+    this->_ITK_2_VTK_1< p, d >( o )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_Pixel( p, d, o, f )                             \
-  if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL )                \
-    this->f< p, d >( )
+#define cpPlugins_Image_Vector( p, d, o )                              \
+  if(                                                                  \
+    dynamic_cast< itk::Image< itk::Vector< p, d >, d >* >( o ) != NULL \
+    )                                                                  \
+    this->_ITK_2_VTK_1< itk::Vector< p, d >, d >( o )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_RGB( p, d, o, f )                               \
+#define cpPlugins_Image_CovVector( p, d, o )                            \
   if(                                                                   \
-    dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL   \
+    dynamic_cast< itk::Image< itk::CovariantVector< p, d >, d >* >( o ) \
+    !=                                                                  \
+    NULL                                                                \
     )                                                                   \
-    this->f< itk::RGBPixel< p >, d >( )
+    this->_ITK_2_VTK_1< itk::CovariantVector< p, d >, d >( o )
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Image::
-GetClassName( ) const
+#define cpPlugins_Image_SymTensor( p, d, o )                            \
+  if(                                                                   \
+    dynamic_cast< itk::Image< itk::SymmetricSecondRankTensor< p, d >, d >* >( o ) \
+    !=                                                                  \
+    NULL                                                                \
+    )                                                                   \
+    this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< p, d >, d >( o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_RGB( p, d, o )                  \
+  cpPlugins_Image_Pixel( itk::RGBPixel< p >, d, o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_RGBA( p, d, o )                 \
+  cpPlugins_Image_Pixel( itk::RGBAPixel< p >, d, o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_DiffTensor( p, d, o )                   \
+  cpPlugins_Image_Pixel( itk::DiffusionTensor3D< p >, d, o )
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Image::
+SetITKDataObject( itk::DataObject* o )
 {
-  return( "cpPlugins::Interface::Image" );
+  if( dynamic_cast< itk::ImageBase< 1 >* >( o ) != NULL )
+    this->_ITK_2_VTK_0< 1 >( o );
+  else if( dynamic_cast< itk::ImageBase< 2 >* >( o ) != NULL )
+    this->_ITK_2_VTK_0< 2 >( o );
+  else if( dynamic_cast< itk::ImageBase< 3 >* >( o ) != NULL )
+    this->_ITK_2_VTK_0< 3 >( o );
+  else
+    this->m_ITKObject = NULL;
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Image::
-SetRealDataObject( itk::DataObject* dobj )
+SetVTKDataObject( vtkDataObject* o )
 {
-  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 );
+  // this->m_VTKObject = o;
+  std::cerr << "Image: TODO this!!!!" << std::endl;
+  std::exit( 1 );
 }
 
 // -------------------------------------------------------------------------
 vtkImageData* cpPlugins::Interface::Image::
-GetVTKImageData( ) const
+GetVTKImageData( )
 {
-  return( this->m_VTKImageData );
+  return( dynamic_cast< vtkImageData* >( this->GetVTKDataObject( ) ) );
 }
 
 // -------------------------------------------------------------------------
-void cpPlugins::Interface::Image::
-UpdateVTKImageData( )
+const vtkImageData* cpPlugins::Interface::Image::
+GetVTKImageData( ) const
 {
-  this->m_Image2VTKImageData->Modified( );
-  this->m_Image2VTKImageData->Update( );
-  this->m_VTKImageData->Modified( );
+  return( dynamic_cast< const vtkImageData* >( this->GetVTKDataObject( ) ) );
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Image::
 Image( )
-  : Superclass( ),
-    m_VTKImageData( NULL )
+  : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::Image";
+  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
@@ -73,47 +108,95 @@ cpPlugins::Interface::Image::
 // -------------------------------------------------------------------------
 template< unsigned int D >
 void cpPlugins::Interface::Image::
-_VTK_0( )
+_ITK_2_VTK_0( itk::DataObject* o )
 {
-  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 );
+  cpPlugins_Image_Pixel( char, D, o );
+  else cpPlugins_Image_Pixel( short, D, o );
+  else cpPlugins_Image_Pixel( int, D, o );
+  else cpPlugins_Image_Pixel( long, D, o );
+  else cpPlugins_Image_Pixel( float, D, o );
+  else cpPlugins_Image_Pixel( double, D, o );
+  else cpPlugins_Image_Pixel( unsigned char, D, o );
+  else cpPlugins_Image_Pixel( unsigned short, D, o );
+  else cpPlugins_Image_Pixel( unsigned int, D, o );
+  else cpPlugins_Image_Pixel( unsigned long, D, o );
+  else cpPlugins_Image_RGB( char, D, o );
+  else cpPlugins_Image_RGB( short, D, o );
+  else cpPlugins_Image_RGB( int, D, o );
+  else cpPlugins_Image_RGB( long, D, o );
+  else cpPlugins_Image_RGB( float, D, o );
+  else cpPlugins_Image_RGB( double, D, o );
+  else cpPlugins_Image_RGB( unsigned char, D, o );
+  else cpPlugins_Image_RGB( unsigned short, D, o );
+  else cpPlugins_Image_RGB( unsigned int, D, o );
+  else cpPlugins_Image_RGB( unsigned long, D, o );
+  else cpPlugins_Image_RGBA( char, D, o );
+  else cpPlugins_Image_RGBA( short, D, o );
+  else cpPlugins_Image_RGBA( int, D, o );
+  else cpPlugins_Image_RGBA( long, D, o );
+  else cpPlugins_Image_RGBA( float, D, o );
+  else cpPlugins_Image_RGBA( double, D, o );
+  else cpPlugins_Image_RGBA( unsigned char, D, o );
+  else cpPlugins_Image_RGBA( unsigned short, D, o );
+  else cpPlugins_Image_RGBA( unsigned int, D, o );
+  else cpPlugins_Image_RGBA( unsigned long, D, o );
+  else cpPlugins_Image_Vector( char, D, o );
+  else cpPlugins_Image_Vector( short, D, o );
+  else cpPlugins_Image_Vector( int, D, o );
+  else cpPlugins_Image_Vector( long, D, o );
+  else cpPlugins_Image_Vector( float, D, o );
+  else cpPlugins_Image_Vector( double, D, o );
+  else cpPlugins_Image_Vector( unsigned char, D, o );
+  else cpPlugins_Image_Vector( unsigned short, D, o );
+  else cpPlugins_Image_Vector( unsigned int, D, o );
+  else cpPlugins_Image_Vector( unsigned long, D, o );
+  else cpPlugins_Image_CovVector( char, D, o );
+  else cpPlugins_Image_CovVector( short, D, o );
+  else cpPlugins_Image_CovVector( int, D, o );
+  else cpPlugins_Image_CovVector( long, D, o );
+  else cpPlugins_Image_CovVector( float, D, o );
+  else cpPlugins_Image_CovVector( double, D, o );
+  else cpPlugins_Image_CovVector( unsigned char, D, o );
+  else cpPlugins_Image_CovVector( unsigned short, D, o );
+  else cpPlugins_Image_CovVector( unsigned int, D, o );
+  else cpPlugins_Image_CovVector( unsigned long, D, o );
+  else cpPlugins_Image_SymTensor( char, D, o );
+  else cpPlugins_Image_SymTensor( short, D, o );
+  else cpPlugins_Image_SymTensor( int, D, o );
+  else cpPlugins_Image_SymTensor( long, D, o );
+  else cpPlugins_Image_SymTensor( float, D, o );
+  else cpPlugins_Image_SymTensor( double, D, o );
+  else cpPlugins_Image_SymTensor( unsigned char, D, o );
+  else cpPlugins_Image_SymTensor( unsigned short, D, o );
+  else cpPlugins_Image_SymTensor( unsigned int, D, o );
+  else cpPlugins_Image_SymTensor( unsigned long, D, o );
+  else cpPlugins_Image_DiffTensor( char, D, o );
+  else cpPlugins_Image_DiffTensor( short, D, o );
+  else cpPlugins_Image_DiffTensor( int, D, o );
+  else cpPlugins_Image_DiffTensor( long, D, o );
+  else cpPlugins_Image_DiffTensor( float, D, o );
+  else cpPlugins_Image_DiffTensor( double, D, o );
+  else cpPlugins_Image_DiffTensor( unsigned char, D, o );
+  else cpPlugins_Image_DiffTensor( unsigned short, D, o );
+  else cpPlugins_Image_DiffTensor( unsigned int, D, o );
+  else cpPlugins_Image_DiffTensor( unsigned long, D, o );
 }
 
 // -------------------------------------------------------------------------
 template< class P, unsigned int D >
 void cpPlugins::Interface::Image::
-_VTK_1( )
+_ITK_2_VTK_1( itk::DataObject* o )
 {
-  typedef itk::Image< P, D > _TImage;
-  typedef itk::ImageToVTKImageFilter< _TImage > _TFilter;
-
-  _TImage* img =
-    dynamic_cast< _TImage* >( this->Superclass::GetRealDataObject( ) );
-  typename _TFilter::Pointer filter = _TFilter::New( );
-  filter->SetInput( img );
-  filter->Update( );
-  this->m_VTKImageData = filter->GetOutput( );
-  this->m_Image2VTKImageData = filter;
+  typedef itk::Image< P, D > _I;
+  typedef itk::ImageToVTKImageFilter< _I > _F;
+  
+  typename _F::Pointer f = _F::New( );
+  f->SetInput( dynamic_cast< _I* >( o ) );
+  f->Update( );
+
+  this->m_ITKObject = o;
+  this->m_VTKObject = f->GetOutput( );
+  this->m_ITKvVTKConnection = f;
 }
 
 // eof - $RCSfile$
index 4ba14cbf558fc80964f610acf9b2b0df393f47ec..04d9507a1e1107bca513819c4fdd125cba8df400 100644 (file)
@@ -3,10 +3,12 @@
 
 #include <map>
 #include <string>
-#include <itkProcessObject.h>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/DataObject.h>
 
+#define ITK_MANUAL_INSTANTIATION
+#include <itkProcessObject.h>
+
 class vtkImageData;
 
 namespace cpPlugins
@@ -29,21 +31,21 @@ namespace cpPlugins
       itkTypeMacro( Image, DataObject );
 
     public:
-      virtual std::string GetClassName( ) const;
-      virtual void SetRealDataObject( itk::DataObject* dobj );
+      virtual void SetITKDataObject( itk::DataObject* o );
+      virtual void SetVTKDataObject( vtkDataObject* o );
 
-      vtkImageData* GetVTKImageData( ) const;
-      void UpdateVTKImageData( );
+      virtual vtkImageData* GetVTKImageData( );
+      virtual const vtkImageData* GetVTKImageData( ) const;
 
     protected:
       Image( );
       virtual ~Image( );
 
       template< unsigned int D >
-        void _VTK_0( );
+        void _ITK_2_VTK_0( itk::DataObject* o );
 
       template< class P, unsigned int D >
-        void _VTK_1( );
+        void _ITK_2_VTK_1( itk::DataObject* o );
 
     private:
       // Purposely not implemented
@@ -51,8 +53,7 @@ namespace cpPlugins
       Self& operator=( const Self& );
 
     protected:
-      itk::ProcessObject::Pointer m_Image2VTKImageData;
-      vtkImageData* m_VTKImageData;
+      itk::ProcessObject::Pointer m_ITKvVTKConnection;
     };
 
   } // ecapseman
index e22c14be616a85687e5bdebbc8d0cab59e4c9c62..3eda9e987d68cdac78715f750aec8dca15c1a85c 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
 {
+  this->m_ClassName = "cpPlugins::Interface::ImageSink";
+  this->m_ClassCategory = "ImageSink";
 }
 
 // -------------------------------------------------------------------------
index 526a46604b42bede6332b362e893c7f9104affb5..d8af19b2f199926a13b35470c084474d238082f3 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( ImageSink, SinkObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       ImageSink( );
       virtual ~ImageSink( );
index b58afd90571fddb2673399c400b97c18797b7960..8fd69b624cbdee640c3cb235f4ac84c0b6cf1962 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
 {
+  this->m_ClassName = "cpPlugins::Interface::ImageSource";
+  this->m_ClassCategory = "ImageSource";
 }
 
 // -------------------------------------------------------------------------
index 56004bf5c7e6c0e91cef7f9872069c6e6254825b..d2e0c527ff824e9b3a20db6deb492347600f7e09 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( ImageSource, SourceObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       ImageSource( );
       virtual ~ImageSource( );
index 962c7a0a2cab926c0c6dbb034e3feac2b7fd1523..80e87798bfd46a9e924c0d0e23ae160c50f5e3cb 100644 (file)
@@ -1,24 +1,12 @@
 #include <cpPlugins/Interface/ImageToImageFilter.h>
 
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToImageFilter::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::ImageToImageFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToImageFilter::
-GetClassType( ) const
-{
-  return( "ImageToImageFilter" );
-}
-
 // -------------------------------------------------------------------------
 cpPlugins::Interface::ImageToImageFilter::
 ImageToImageFilter( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::ImageToImageFilter";
+  this->m_ClassCategory = "ImageToImageFilter";
 }
 
 // -------------------------------------------------------------------------
index 5da8bf2cb9a794224dc4fcdc09cfac1638dad050..2cc56ae1b3ea6fc7cf109f29e61ec82106384cbf 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( ImageToImageFilter, FilterObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       ImageToImageFilter( );
       virtual ~ImageToImageFilter( );
index b2a2a296c2c3bfc2d2384473857b581244e185b1..ad535211563af0312f57d25f2ee1ea36d7a61284 100644 (file)
@@ -1,24 +1,12 @@
 #include <cpPlugins/Interface/ImageToMeshFilter.h>
 
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToMeshFilter::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::ImageToMeshFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToMeshFilter::
-GetClassType( ) const
-{
-  return( "ImageToMeshFilter" );
-}
-
 // -------------------------------------------------------------------------
 cpPlugins::Interface::ImageToMeshFilter::
 ImageToMeshFilter( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::ImageToMeshFilter";
+  this->m_ClassCategory = "ImageToMeshFilter";
 }
 
 // -------------------------------------------------------------------------
index 70dc9a207ae7768a4b45df0a32d09076af311673..f919c96701586df7f4e14e207605d8b44030f73f 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( ImageToMeshFilter, FilterObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       ImageToMeshFilter( );
       virtual ~ImageToMeshFilter( );
diff --git a/lib/cpPlugins/Interface/ImageToPolyLineParametricPathFilter.cxx b/lib/cpPlugins/Interface/ImageToPolyLineParametricPathFilter.cxx
deleted file mode 100644 (file)
index 85c03c1..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <cpPlugins/Interface/ImageToPolyLineParametricPathFilter.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::ImageToPolyLineParametricPathFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-GetClassType( ) const
-{
-  return( "ImageToPolyLineParametricPathFilter" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-ImageToPolyLineParametricPathFilter( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-~ImageToPolyLineParametricPathFilter( )
-{
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/ImageToPolyLineParametricPathFilter.h b/lib/cpPlugins/Interface/ImageToPolyLineParametricPathFilter.h
deleted file mode 100644 (file)
index 716bfad..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef __CPPLUGINS__INTERFACE__IMAGETOPOLYLINEPARAMETRICPATHFILTER__H__
-#define __CPPLUGINS__INTERFACE__IMAGETOPOLYLINEPARAMETRICPATHFILTER__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/FilterObject.h>
-
-namespace cpPlugins
-{
-  namespace Interface
-  {
-    /**
-     */
-    class cpPlugins_Interface_EXPORT ImageToPolyLineParametricPathFilter
-      : public FilterObject
-    {
-    public:
-      typedef ImageToPolyLineParametricPathFilter Self;
-      typedef FilterObject                        Superclass;
-      typedef itk::SmartPointer< Self >           Pointer;
-      typedef itk::SmartPointer< const Self >     ConstPointer;
-
-    public:
-      itkTypeMacro( ImageToPolyLineParametricPathFilter, FilterObject );
-
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
-    protected:
-      ImageToPolyLineParametricPathFilter( );
-      virtual ~ImageToPolyLineParametricPathFilter( );
-
-    private:
-      // Purposely not implemented
-      ImageToPolyLineParametricPathFilter( const Self& );
-      Self& operator=( const Self& );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__IMAGETOPOLYLINEPARAMETRICPATHFILTER__H__
-
-// eof - $RCSfile$
index ba4d66e07f450dd16fe100f21bbcb271e03bf5e4..f33d8d426262fba876949381152d80ae91db0736 100644 (file)
+#undef ITK_MANUAL_INSTANTIATION
 #include <itkImage.h>
+#include <itkCovariantVector.h>
 #include <itkRGBPixel.h>
+#include <itkRGBAPixel.h>
+#include <itkVector.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkDiffusionTensor3D.h>
 #include <itkImageToVTKImageFilter.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage( t, d )             \
-  template class itk::Image< t, d >;                    \
-  template class itk::Image< itk::RGBPixel< t >, d >
+#define cpPlugins_Instance_itkImage_Pixel( p, d )                       \
+  template class itk::Image< p, d >;                                    \
+  template class itk::ImageToVTKImageFilter< itk::Image< p, d > >
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage2vtkImage( t, d )                    \
-  template class itk::ImageToVTKImageFilter< itk::Image< t, d > >;      \
+#define cpPlugins_Instance_itkImage_RGB( p, d )                 \
+  cpPlugins_Instance_itkImage_Pixel( itk::RGBPixel< p >, d )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Instance_itkImage_RGBA( p, d )                \
+  cpPlugins_Instance_itkImage_Pixel( itk::RGBAPixel< p >, d )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Instance_itkImage_Vector( p, d )                      \
+  template class itk::Image< itk::Vector< p, d >, d >;                  \
   template class                                                        \
-  itk::ImageToVTKImageFilter< itk::Image< itk::RGBPixel< t >, d > >
+  itk::ImageToVTKImageFilter< itk::Image< itk::Vector< p, d >, d > >
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Instance_All_itkImage( t, d )          \
-  cpPlugins_Instance_itkImage( t, d );                   \
-  cpPlugins_Instance_itkImage2vtkImage( t, d )
+#define cpPlugins_Instance_itkImage_CovVector( p, d )                   \
+  template class itk::Image< itk::CovariantVector< p, d >, d >;         \
+  template class                                                        \
+  itk::ImageToVTKImageFilter< itk::Image< itk::CovariantVector< p, d >, d > >
 
 // -------------------------------------------------------------------------
-// Images without vtk conversion
-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 );
+#define cpPlugins_Instance_itkImage_SymTensor( p, d )                   \
+  template class itk::Image< itk::SymmetricSecondRankTensor< p, d >, d >; \
+  template class                                                        \
+  itk::ImageToVTKImageFilter< itk::Image< itk::SymmetricSecondRankTensor< p, d >, d > >
 
-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 );
+// -------------------------------------------------------------------------
+#define cpPlugins_Instance_itkImage_DiffTensor( p, d )                  \
+  cpPlugins_Instance_itkImage_Pixel( itk::DiffusionTensor3D< p >, d )
 
 // -------------------------------------------------------------------------
-// Images with vtk conversion
-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 );
+#define cpPlugins_Instance_itkImage_DIM( d )                      \
+  cpPlugins_Instance_itkImage_Pixel( char, d );                   \
+  cpPlugins_Instance_itkImage_Pixel( short, d );                  \
+  cpPlugins_Instance_itkImage_Pixel( int, d );                    \
+  cpPlugins_Instance_itkImage_Pixel( long, d );                   \
+  cpPlugins_Instance_itkImage_Pixel( float, d );                  \
+  cpPlugins_Instance_itkImage_Pixel( double, d );                 \
+  cpPlugins_Instance_itkImage_Pixel( unsigned char, d );          \
+  cpPlugins_Instance_itkImage_Pixel( unsigned short, d );         \
+  cpPlugins_Instance_itkImage_Pixel( unsigned int, d );           \
+  cpPlugins_Instance_itkImage_Pixel( unsigned long, d );          \
+  cpPlugins_Instance_itkImage_RGB( char, d );                     \
+  cpPlugins_Instance_itkImage_RGB( short, d );                    \
+  cpPlugins_Instance_itkImage_RGB( int, d );                      \
+  cpPlugins_Instance_itkImage_RGB( long, d );                     \
+  cpPlugins_Instance_itkImage_RGB( float, d );                    \
+  cpPlugins_Instance_itkImage_RGB( double, d );                   \
+  cpPlugins_Instance_itkImage_RGB( unsigned char, d );            \
+  cpPlugins_Instance_itkImage_RGB( unsigned short, d );           \
+  cpPlugins_Instance_itkImage_RGB( unsigned int, d );             \
+  cpPlugins_Instance_itkImage_RGB( unsigned long, d );            \
+  cpPlugins_Instance_itkImage_RGBA( char, d );                    \
+  cpPlugins_Instance_itkImage_RGBA( short, d );                   \
+  cpPlugins_Instance_itkImage_RGBA( int, d );                     \
+  cpPlugins_Instance_itkImage_RGBA( long, d );                    \
+  cpPlugins_Instance_itkImage_RGBA( float, d );                   \
+  cpPlugins_Instance_itkImage_RGBA( double, d );                  \
+  cpPlugins_Instance_itkImage_RGBA( unsigned char, d );           \
+  cpPlugins_Instance_itkImage_RGBA( unsigned short, d );          \
+  cpPlugins_Instance_itkImage_RGBA( unsigned int, d );            \
+  cpPlugins_Instance_itkImage_RGBA( unsigned long, d );           \
+  cpPlugins_Instance_itkImage_Vector( char, d );                  \
+  cpPlugins_Instance_itkImage_Vector( short, d );                 \
+  cpPlugins_Instance_itkImage_Vector( int, d );                   \
+  cpPlugins_Instance_itkImage_Vector( long, d );                  \
+  cpPlugins_Instance_itkImage_Vector( float, d );                 \
+  cpPlugins_Instance_itkImage_Vector( double, d );                \
+  cpPlugins_Instance_itkImage_Vector( unsigned char, d );         \
+  cpPlugins_Instance_itkImage_Vector( unsigned short, d );        \
+  cpPlugins_Instance_itkImage_Vector( unsigned int, d );          \
+  cpPlugins_Instance_itkImage_Vector( unsigned long, d );         \
+  cpPlugins_Instance_itkImage_CovVector( char, d );               \
+  cpPlugins_Instance_itkImage_CovVector( short, d );              \
+  cpPlugins_Instance_itkImage_CovVector( int, d );                \
+  cpPlugins_Instance_itkImage_CovVector( long, d );               \
+  cpPlugins_Instance_itkImage_CovVector( float, d );              \
+  cpPlugins_Instance_itkImage_CovVector( double, d );             \
+  cpPlugins_Instance_itkImage_CovVector( unsigned char, d );      \
+  cpPlugins_Instance_itkImage_CovVector( unsigned short, d );     \
+  cpPlugins_Instance_itkImage_CovVector( unsigned int, d );       \
+  cpPlugins_Instance_itkImage_CovVector( unsigned long, d );      \
+  cpPlugins_Instance_itkImage_SymTensor( char, d );               \
+  cpPlugins_Instance_itkImage_SymTensor( short, d );              \
+  cpPlugins_Instance_itkImage_SymTensor( int, d );                \
+  cpPlugins_Instance_itkImage_SymTensor( long, d );               \
+  cpPlugins_Instance_itkImage_SymTensor( float, d );              \
+  cpPlugins_Instance_itkImage_SymTensor( double, d );             \
+  cpPlugins_Instance_itkImage_SymTensor( unsigned char, d );      \
+  cpPlugins_Instance_itkImage_SymTensor( unsigned short, d );     \
+  cpPlugins_Instance_itkImage_SymTensor( unsigned int, d );       \
+  cpPlugins_Instance_itkImage_SymTensor( unsigned long, d );      \
+  cpPlugins_Instance_itkImage_DiffTensor( char, d );              \
+  cpPlugins_Instance_itkImage_DiffTensor( short, d );             \
+  cpPlugins_Instance_itkImage_DiffTensor( int, d );               \
+  cpPlugins_Instance_itkImage_DiffTensor( long, d );              \
+  cpPlugins_Instance_itkImage_DiffTensor( float, d );             \
+  cpPlugins_Instance_itkImage_DiffTensor( double, d );            \
+  cpPlugins_Instance_itkImage_DiffTensor( unsigned char, d );     \
+  cpPlugins_Instance_itkImage_DiffTensor( unsigned short, d );    \
+  cpPlugins_Instance_itkImage_DiffTensor( unsigned int, d );      \
+  cpPlugins_Instance_itkImage_DiffTensor( unsigned long, d );
 
-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 );
+// -------------------------------------------------------------------------
+cpPlugins_Instance_itkImage_DIM( 1 );
+cpPlugins_Instance_itkImage_DIM( 2 );
+cpPlugins_Instance_itkImage_DIM( 3 );
 
 // eof - $RCSfile$
index 14952ccebd53ebf3eb8a3514051748ab17f1a873..575db644e7a7123f5239947d133cf6514334886e 100644 (file)
@@ -1,10 +1,14 @@
-/* TODO
-   #include <itkMesh.h>
+#undef ITK_MANUAL_INSTANTIATION
+#include <itkMesh.h>
+#include <itkQuadEdgeMesh.h>
 
-   template class itk::Mesh< float, 2 >;
-   template class itk::Mesh< double, 2 >;
-   template class itk::Mesh< float, 3 >;
-   template class itk::Mesh< double, 3 >;
-*/
+template class itk::Mesh< float, 2 >;
+template class itk::Mesh< float, 3 >;
+template class itk::Mesh< double, 2 >;
+template class itk::Mesh< double, 3 >;
+template class itk::QuadEdgeMesh< float, 2 >;
+template class itk::QuadEdgeMesh< float, 3 >;
+template class itk::QuadEdgeMesh< double, 2 >;
+template class itk::QuadEdgeMesh< double, 3 >;
 
 // eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/Instances_itkPolyLineParametricPath.cxx b/lib/cpPlugins/Interface/Instances_itkPolyLineParametricPath.cxx
deleted file mode 100644 (file)
index 9c450fd..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <itkPolyLineParametricPath.h>
-#include <itkVectorContainer.h>
-#include <itkContinuousIndex.h>
-
-template class itk::PolyLineParametricPath< 1 >;
-template class itk::PolyLineParametricPath< 2 >;
-template class itk::PolyLineParametricPath< 3 >;
-template class itk::PolyLineParametricPath< 4 >;
-
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 1 > >;
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 2 > >;
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 3 > >;
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 4 > >;
-
-// eof - $RCSfile$
index 585e2d5fd4b260824390559a4cc204fb6766825d..a51f8be231409e38857b9b3a761b2c9dcebd818c 100644 (file)
@@ -29,7 +29,7 @@ namespace cpPlugins
       Interface( );
       virtual ~Interface( );
 
-      /// Plugin access
+      // Plugin access
       TClasses& GetClasses( );
       const TClasses& GetClasses( ) const;
       Object::Pointer CreateObject( const std::string& name ) const;
@@ -37,7 +37,7 @@ namespace cpPlugins
         const std::string& name
         ) const;
 
-      /// Interface to PLUMA
+      // Interface to PLUMA
       bool Load( const std::string& path );
       bool Load( const std::string& folder, const std::string& name );
       int LoadFromFolder( const std::string& folder, bool r = false );
index 9841f7e0c2bd3fd5cab159f4f08b1eae9e7d5230..c052e6a5a245a2a56993bbec01194632ad628cc1 100644 (file)
@@ -1,72 +1,87 @@
 #include <cpPlugins/Interface/Mesh.h>
 
-#include <vtkMapper.h>
-
-#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
+#include <vtkPolyData.h>
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Mesh::
-GetClassName( ) const
+void cpPlugins::Interface::Mesh::
+SetITKDataObject( itk::DataObject* o )
 {
-  return( "cpPlugins::Interface::Mesh" );
+  // TODO: conversion!!!
+  std::cout << "Mesh: SetITKDataObject " << std::endl;
+  std::exit( 1 );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Mesh::
-SetRealDataObject( itk::DataObject* dobj )
+SetVTKDataObject( vtkDataObject* o )
 {
-  this->Superclass::SetRealDataObject( dobj );
+  if( dynamic_cast< vtkPolyData* >( o ) != NULL )
+  {
+    this->m_VTKObject = o;
 
-  // 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;
-  typedef DataStructures::QuadEdgeMesh< float, 3 >  _TF3;
-  typedef DataStructures::QuadEdgeMesh< double, 3 > _TD3;
+    // TODO: conversion!!!
+  }
+  else
+    this->m_VTKObject = NULL;
+}
 
-  if     ( dynamic_cast< _TF2* >( dobj ) ) this->_Map< _TF2 >( );
-  else if( dynamic_cast< _TD2* >( dobj ) ) this->_Map< _TD2 >( );
-  else if( dynamic_cast< _TF3* >( dobj ) ) this->_Map< _TF3 >( );
-  else if( dynamic_cast< _TD3* >( dobj ) ) this->_Map< _TD3 >( );
+// -------------------------------------------------------------------------
+vtkPolyData* cpPlugins::Interface::Mesh::
+GetVTKPolyData( )
+{
+  return( dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) );
 }
 
 // -------------------------------------------------------------------------
-vtkMapper* cpPlugins::Interface::Mesh::
-GetVTKMapper( ) const
+const vtkPolyData* cpPlugins::Interface::Mesh::
+GetVTKPolyData( ) const
 {
-  return( this->m_Mapper );
+  return(
+    dynamic_cast< const vtkPolyData* >( this->m_VTKObject.GetPointer( ) )
+    );
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Mesh::
 Mesh( )
-  : Superclass( ),
-    m_Mapper( NULL )
+  : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::Mesh";
+  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Mesh::
 ~Mesh( )
 {
-  if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
 }
 
 // -------------------------------------------------------------------------
-template< class M >
+template< unsigned int D >
 void cpPlugins::Interface::Mesh::
-_Map( )
+_ITK_2_VTK_0( itk::DataObject* o )
 {
-  typedef
-    cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >
-    _TMapper;
+}
 
-  if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
-  M* mesh = dynamic_cast< M* >( this->Superclass::GetRealDataObject( ) );
-  _TMapper* mapper = _TMapper::New( );
-  mapper->SetInputData( mesh );
-  this->m_Mapper = mapper;
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+void cpPlugins::Interface::Mesh::
+_ITK_2_VTK_1( itk::DataObject* o )
+{
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int D >
+void cpPlugins::Interface::Mesh::
+_VTK_2_ITK_0( itk::DataObject* o )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+void cpPlugins::Interface::Mesh::
+_VTK_2_ITK_1( itk::DataObject* o )
+{
 }
 
 // eof - $RCSfile$
index a1f06771b7410c41190b230f5899a7e8faddc30b..ffaec80ce9809f4589893c4b35dabcc320957bfc 100644 (file)
@@ -1,13 +1,10 @@
 #ifndef __CPPLUGINS__INTERFACE__MESH__H__
 #define __CPPLUGINS__INTERFACE__MESH__H__
 
-#include <map>
-#include <string>
-#include <itkProcessObject.h>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/DataObject.h>
 
-class vtkMapper;
+class vtkPolyData;
 
 namespace cpPlugins
 {
@@ -29,25 +26,32 @@ namespace cpPlugins
       itkTypeMacro( Mesh, DataObject );
 
     public:
-      virtual std::string GetClassName( ) const;
-      virtual void SetRealDataObject( itk::DataObject* dobj );
+      virtual void SetITKDataObject( itk::DataObject* o );
+      virtual void SetVTKDataObject( vtkDataObject* o );
 
-      vtkMapper* GetVTKMapper( ) const;
+      vtkPolyData* GetVTKPolyData( );
+      const vtkPolyData* GetVTKPolyData( ) const;
 
     protected:
       Mesh( );
       virtual ~Mesh( );
 
-      template< class M >
-        void _Map( );
+      template< unsigned int D >
+        void _ITK_2_VTK_0( itk::DataObject* o );
+
+      template< class P, unsigned int D >
+        void _ITK_2_VTK_1( itk::DataObject* o );
+
+      template< unsigned int D >
+        void _VTK_2_ITK_0( itk::DataObject* o );
+
+      template< class P, unsigned int D >
+        void _VTK_2_ITK_1( itk::DataObject* o );
 
     private:
       // Purposely not implemented
       Mesh( const Self& );
       Self& operator=( const Self& );
-
-    protected:
-      vtkMapper* m_Mapper;
     };
 
   } // ecapseman
index dffacefbaa58119986a89df6f9c493c887956bee..e27259e624e25bc785c7655c0600d24c3b2c7919 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
 {
+  this->m_ClassName = "cpPlugins::Interface::MeshSink";
+  this->m_ClassCategory = "MeshSink";
 }
 
 // -------------------------------------------------------------------------
index 5eab768db00c6f9d43b6c6d463043eda4be2627d..3438e3a75bbf618a8a7520c97b81e4b737138ddc 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( MeshSink, SinkObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       MeshSink( );
       virtual ~MeshSink( );
index c60814791eaf969db6bf6ce82a0f494709fcb94c..91d7ed3c72c2a5037d15403c94f62e6bcc09bd2f 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
 {
+  this->m_ClassName = "cpPlugins::Interface::MeshSource";
+  this->m_ClassCategory = "MeshSource";
 }
 
 // -------------------------------------------------------------------------
index 745f62d0786337bead6e23e9793d9272e539b7c6..fe1a9793499db2820cb50bcc6e47bfe0aab98c2d 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( MeshSource, SourceObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       MeshSource( );
       virtual ~MeshSource( );
index 804a381b83902bddfea205e7c75dbf52596e37c7..394b9f9d74de18343e5f9c0c9cd280fcdd22df35 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
 {
+  this->m_ClassName = "cpPlugins::Interface::MeshToImageFilter";
+  this->m_ClassCategory = "MeshToImageFilter";
 }
 
 // -------------------------------------------------------------------------
index e8f0b830f77ddd229698ed2f0258d2a8d683993d..698ad0ae023f42b4cea96bd0fd0a9cd83f3f8a64 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( MeshToImageFilter, FilterObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       MeshToImageFilter( );
       virtual ~MeshToImageFilter( );
index 4f5c76ff03d65da4c2d95b864448323415d3011c..df88b170419b9199f8e9aef9502ab3b37dfcb7ad 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
 {
+  this->m_ClassName = "cpPlugins::Interface::MeshToMeshFilter";
+  this->m_ClassCategory = "MeshToMeshFilter";
 }
 
 // -------------------------------------------------------------------------
index d47197f63126eb876059d0034cf0021c65b5791a..399c3f726cd9fabacadf910228747f76a16e237a 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( MeshToMeshFilter, FilterObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       MeshToMeshFilter( );
       virtual ~MeshToMeshFilter( );
index 1792a506442b2a589cdddeb5fb7964503c7a030d..b4768faab5971f845db0c385bf7bddb7d74b7383 100644 (file)
@@ -1,24 +1,12 @@
 #include <cpPlugins/Interface/Object.h>
 
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Object::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::Object" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Object::
-GetClassType( ) const
-{
-  return( "Object" );
-}
-
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Object::
 Object( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::Object";
+  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
index fe86f1bc7efbb140e4b0e4f571bcc72e811bfd54..b133fe70281e60724a4c0a6f021c119228ade2d8 100644 (file)
@@ -3,9 +3,11 @@
 
 #include <string>
 #include <Pluma/Pluma.hpp>
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+
+#define ITK_MANUAL_INSTANTIATION
 #include <itkObject.h>
 #include <itkObjectFactory.h>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 
 // -------------------------------------------------------------------------
 #define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE )                 \
@@ -70,8 +72,8 @@ namespace cpPlugins
       itkTypeMacro( Object, itkObject );
 
     public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
+      itkGetConstMacro( ClassName, std::string );
+      itkGetConstMacro( ClassCategory, std::string );
 
     protected:
       Object( );
@@ -81,6 +83,10 @@ namespace cpPlugins
       // Purposely not implemented
       Object( const Self& );
       Self& operator=( const Self& );
+
+    protected:
+      std::string m_ClassName;
+      std::string m_ClassCategory;
     };
 
     /**
diff --git a/lib/cpPlugins/Interface/PolyData.cxx b/lib/cpPlugins/Interface/PolyData.cxx
deleted file mode 100644 (file)
index 5abcd19..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-
-#include <cpPlugins/Interface/PolyData.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyData::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::PolyData" );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PolyData::
-SetRealDataObject( itk::DataObject* dobj )
-{
-  // Nothing to be done here
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PolyData::
-SetRealDataObject( vtkDataObject* dobj )
-{
-  this->m_Data = dynamic_cast< vtkPolyData* >( dobj );
-  if( this->m_Data == NULL )
-    return;
-  this->m_Mapper->SetInputData( this->m_Data );
-  this->m_Actor->SetMapper( this->m_Mapper );
-}
-
-// -------------------------------------------------------------------------
-vtkPolyData* cpPlugins::Interface::PolyData::
-GetData( ) const
-{
-  return( this->m_Data );
-}
-
-// -------------------------------------------------------------------------
-vtkPolyDataMapper* cpPlugins::Interface::PolyData::
-GetMapper( ) const
-{
-  return( this->m_Mapper );
-}
-
-// -------------------------------------------------------------------------
-vtkActor* cpPlugins::Interface::PolyData::
-GetActor( ) const
-{
-  return( this->m_Actor );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyData::
-PolyData( )
-  : Superclass( )
-{
-  this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->m_Actor = vtkSmartPointer< vtkActor >::New( );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyData::
-~PolyData( )
-{
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/PolyData.h b/lib/cpPlugins/Interface/PolyData.h
deleted file mode 100644 (file)
index e5ead8c..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef __CPPLUGINS__INTERFACE__POLYDATA__H__
-#define __CPPLUGINS__INTERFACE__POLYDATA__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/DataObject.h>
-
-#include <vtkActor.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkSmartPointer.h>
-
-namespace cpPlugins
-{
-  namespace Interface
-  {
-    /**
-     */
-    class cpPlugins_Interface_EXPORT PolyData
-      : public DataObject
-    {
-    public:
-      typedef PolyData                        Self;
-      typedef DataObject                      Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( PolyData, DataObject );
-
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual void SetRealDataObject( itk::DataObject* dobj );
-      virtual void SetRealDataObject( vtkDataObject* dobj );
-
-      vtkPolyData* GetData( ) const;
-      vtkPolyDataMapper* GetMapper( ) const;
-      vtkActor* GetActor( ) const;
-
-    protected:
-      PolyData( );
-      virtual ~PolyData( );
-
-    private:
-      // Purposely not implemented
-      PolyData( const Self& );
-      Self& operator=( const Self& );
-
-    protected:
-      vtkSmartPointer< vtkPolyData >       m_Data;
-      vtkSmartPointer< vtkPolyDataMapper > m_Mapper;
-      vtkSmartPointer< vtkActor >          m_Actor;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYDATA__H__
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/PolyDataSource.cxx b/lib/cpPlugins/Interface/PolyDataSource.cxx
deleted file mode 100644 (file)
index e8f32d8..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <cpPlugins/Interface/PolyDataSource.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyDataSource::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::PolyDataSource" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyDataSource::
-GetClassType( ) const
-{
-  return( "PolyDataSource" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyDataSource::
-PolyDataSource( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyDataSource::
-~PolyDataSource( )
-{
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/PolyDataSource.h b/lib/cpPlugins/Interface/PolyDataSource.h
deleted file mode 100644 (file)
index 0022048..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef __CPPLUGINS__INTERFACE__POLYDATASOURCE__H__
-#define __CPPLUGINS__INTERFACE__POLYDATASOURCE__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/SourceObject.h>
-
-namespace cpPlugins
-{
-  namespace Interface
-  {
-    /**
-     */
-    class cpPlugins_Interface_EXPORT PolyDataSource
-      : public SourceObject
-    {
-    public:
-      typedef PolyDataSource                  Self;
-      typedef SourceObject                    Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-    public:
-      itkTypeMacro( PolyDataSource, SourceObject );
-
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
-    protected:
-      PolyDataSource( );
-      virtual ~PolyDataSource( );
-
-    private:
-      // Purposely not implemented
-      PolyDataSource( const Self& );
-      Self& operator=( const Self& );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYDATASOURCE__H__
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/PolyLineParametricPath.cxx b/lib/cpPlugins/Interface/PolyLineParametricPath.cxx
deleted file mode 100644 (file)
index 37be8af..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#include <cpPlugins/Interface/PolyLineParametricPath.h>
-
-#include <vtkCellArray.h>
-#include <vtkPoints.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkPolyLineParametricPath.h>
-#include <itkImageBase.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyLineParametricPath::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::PolyLineParametricPath" );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PolyLineParametricPath::
-SetRealDataObject( itk::DataObject* dobj, itk::DataObject* ref_image )
-{
-  typedef itk::PolyLineParametricPath< 2 > _T2;
-  typedef itk::PolyLineParametricPath< 3 > _T3;
-
-  this->Superclass::SetRealDataObject( dobj );
-
-  if( ref_image != NULL )
-  {
-    if( dynamic_cast< _T2* >( dobj ) != NULL )
-      this->_VTK< 2 >( ref_image );
-    else if( dynamic_cast< _T3* >( dobj ) != NULL )
-      this->_VTK< 3 >( ref_image );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPath::
-PolyLineParametricPath( )
-  : Superclass( )
-{
-  this->m_PolyData = vtkSmartPointer< vtkPolyData >::New( );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPath::
-~PolyLineParametricPath( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-void cpPlugins::Interface::PolyLineParametricPath::
-_VTK( itk::DataObject* ref_image )
-{
-  typedef itk::PolyLineParametricPath< D >     _TPath;
-  typedef typename _TPath::VertexListType      _TVertices;
-  typedef typename _TPath::ContinuousIndexType _TIndex;
-  typedef itk::ImageBase< D >                  _TImage;
-  typedef typename _TImage::PointType          _TPoint;
-
-  _TPath* path =
-    dynamic_cast< _TPath* >( this->m_RealDataObject.GetPointer( ) );
-  if( path == NULL )
-    return;
-  const _TVertices* vertices = path->GetVertexList( );
-  if( vertices == NULL )
-    return;
-  const _TImage* image = dynamic_cast< const _TImage* >( ref_image );
-
-  vtkSmartPointer< vtkPoints > points =
-    vtkSmartPointer< vtkPoints >::New( );
-  vtkSmartPointer< vtkCellArray > lines =
-    vtkSmartPointer< vtkCellArray >::New( );
-  double x, y, z;
-  for( unsigned int i = 0; i < vertices->Size( ); ++i )
-  {
-    _TIndex idx = vertices->GetElement( i );
-    if( image != NULL )
-    {
-      _TPoint pnt;
-      image->TransformContinuousIndexToPhysicalPoint( idx, pnt );
-      x = double( pnt[ 0 ] );
-      y = double( pnt[ 1 ] );
-      z = ( D >= 3 )? double( pnt[ 2 ] ): double( 0 );
-    }
-    else
-    {
-      x = double( idx[ 0 ] );
-      y = double( idx[ 1 ] );
-      z = ( D >= 3 )? double( idx[ 2 ] ): double( 0 );
-
-    } // fi
-    points->InsertNextPoint( x, y, z );
-    if( i > 0 )
-    {
-      lines->InsertNextCell( 2 );
-      lines->InsertCellPoint( i - 1 );
-      lines->InsertCellPoint( i );
-
-    } // fi
-    
-  } // rof
-  this->m_PolyData->SetPoints( points );
-  this->m_PolyData->SetLines( lines );
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/PolyLineParametricPath.h b/lib/cpPlugins/Interface/PolyLineParametricPath.h
deleted file mode 100644 (file)
index 0c3268b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__H__
-#define __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__H__
-
-#include <map>
-#include <string>
-#include <itkProcessObject.h>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/DataObject.h>
-
-#include <vtkPolyData.h>
-#include <vtkSmartPointer.h>
-
-namespace cpPlugins
-{
-  namespace Interface
-  {
-    /**
-     */
-    class cpPlugins_Interface_EXPORT PolyLineParametricPath
-      : public DataObject
-    {
-    public:
-      typedef PolyLineParametricPath          Self;
-      typedef DataObject                      Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( PolyLineParametricPath, DataObject );
-
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual void SetRealDataObject(
-        itk::DataObject* dobj,
-        itk::DataObject* ref_image = NULL
-        );
-
-    protected:
-      PolyLineParametricPath( );
-      virtual ~PolyLineParametricPath( );
-
-      template< unsigned int D >
-        void _VTK( itk::DataObject* ref_image );
-
-    private:
-      // Purposely not implemented
-      PolyLineParametricPath( const Self& );
-      Self& operator=( const Self& );
-
-    protected:
-      vtkSmartPointer< vtkPolyData > m_PolyData;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__H__
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/PolyLineParametricPathSource.cxx b/lib/cpPlugins/Interface/PolyLineParametricPathSource.cxx
deleted file mode 100644 (file)
index 4930491..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <cpPlugins/Interface/PolyLineParametricPathSource.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyLineParametricPathSource::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::PolyLineParametricPathSource" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyLineParametricPathSource::
-GetClassType( ) const
-{
-  return( "PolyLineParametricPathSource" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPathSource::
-PolyLineParametricPathSource( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPathSource::
-~PolyLineParametricPathSource( )
-{
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/PolyLineParametricPathSource.h b/lib/cpPlugins/Interface/PolyLineParametricPathSource.h
deleted file mode 100644 (file)
index 59578bf..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATHSOURCE__H__
-#define __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATHSOURCE__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/SourceObject.h>
-
-namespace cpPlugins
-{
-  namespace Interface
-  {
-    /**
-     */
-    class cpPlugins_Interface_EXPORT PolyLineParametricPathSource
-      : public SourceObject
-    {
-    public:
-      typedef PolyLineParametricPathSource    Self;
-      typedef SourceObject                    Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-    public:
-      itkTypeMacro( PolyLineParametricPathSource, SourceObject );
-
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
-    protected:
-      PolyLineParametricPathSource( );
-      virtual ~PolyLineParametricPathSource( );
-
-    private:
-      // Purposely not implemented
-      PolyLineParametricPathSource( const Self& );
-      Self& operator=( const Self& );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATHSOURCE__H__
-
-// eof - $RCSfile$
index 61eaf96e661763080ed48470bfabf069bca4e8b5..c6271ca6635e1f3421669be85ddc46dfb050baf3 100644 (file)
@@ -1,19 +1,5 @@
 #include <cpPlugins/Interface/ProcessObject.h>
 
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ProcessObject::
-GetClassName( ) const
-{
-  return( "cpPlugins::Interface::ProcessObject" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ProcessObject::
-GetClassType( ) const
-{
-  return( "ProcessObject" );
-}
-
 // -------------------------------------------------------------------------
 const cpPlugins::Interface::Parameters&
 cpPlugins::Interface::ProcessObject::
@@ -121,6 +107,8 @@ cpPlugins::Interface::ProcessObject::
 ProcessObject( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::ProcessObject";
+  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
@@ -130,22 +118,24 @@ cpPlugins::Interface::ProcessObject::
 }
 
 // -------------------------------------------------------------------------
-itk::DataObject* cpPlugins::Interface::ProcessObject::
-_GetInput( unsigned int idx )
-{
-  if( idx < this->m_Inputs.size( ) )
-    return( this->m_Inputs[ idx ]->GetRealDataObject( ) );
-  else
-    return( NULL );
-}
+/* TODO
+   itk::DataObject* cpPlugins::Interface::ProcessObject::
+   _GetInput( unsigned int idx )
+   {
+   if( idx < this->m_Inputs.size( ) )
+   return( this->m_Inputs[ idx ]->GetRealDataObject( ) );
+   else
+   return( NULL );
+   }
 
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::ProcessObject::
-_SetOutput( unsigned int idx, itk::DataObject* dobj )
-{
-  if( idx < this->m_Outputs.size( ) )
-    if( this->m_Outputs[ idx ].IsNotNull( ) )
-      this->m_Outputs[ idx ]->SetRealDataObject( dobj );
-}
+   // -------------------------------------------------------------------------
+   void cpPlugins::Interface::ProcessObject::
+   _SetOutput( unsigned int idx, itk::DataObject* dobj )
+   {
+   if( idx < this->m_Outputs.size( ) )
+   if( this->m_Outputs[ idx ].IsNotNull( ) )
+   this->m_Outputs[ idx ]->SetRealDataObject( dobj );
+   }
+*/
 
 // eof - $RCSfile$
index a9779282c8a59e37973504e1ec04730a4bf2a5ae..7cf63765c206464b05c7c12e37cc202ba751ff77 100644 (file)
@@ -1,12 +1,14 @@
 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 
-#include <itkProcessObject.h>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Object.h>
 #include <cpPlugins/Interface/DataObject.h>
 #include <cpPlugins/Interface/Parameters.h>
 
+#define ITK_MANUAL_INSTANTIATION
+#include <itkProcessObject.h>
+
 namespace cpPlugins
 {
   namespace Interface
@@ -26,8 +28,6 @@ namespace cpPlugins
       itkTypeMacro( ProcessObject, Object );
 
     public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
       virtual const Parameters& GetDefaultParameters( ) const;
       virtual void SetParameters( const Parameters& params );
 
@@ -47,17 +47,19 @@ namespace cpPlugins
       ProcessObject( );
       virtual ~ProcessObject( );
 
-      virtual itk::DataObject* _GetInput( unsigned int idx );
-      virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj );
+      /* TODO
+         virtual itk::DataObject* _GetInput( unsigned int idx );
+         virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj );
+      */
 
       template< class O >
-      void _MakeOutput( unsigned int idx )
-        {
-          if( idx >= this->m_Outputs.size( ) )
-            return;
-          this->m_Outputs[ idx ] = O::New( );
-          this->m_Outputs[ idx ]->SetSource( this );
-        }
+        void _MakeOutput( unsigned int idx )
+      {
+        if( idx >= this->m_Outputs.size( ) )
+          return;
+        this->m_Outputs[ idx ] = O::New( );
+        this->m_Outputs[ idx ]->SetSource( this );
+      }
 
       virtual std::string _GenerateData( ) = 0;
 
index 309a3d18e02060cca8bd0eea827fa96c6a7b81db..6fdaf4c3afa7e55780afa890ccadb2928ee588e2 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::SinkObject";
+  this->m_ClassCategory = "BasicObject";
   this->SetNumberOfOutputs( 0 );
 }
 
index 4edc44c813cf465cf1248ae03adc89426d1e6bf3..b03fb9dc072bad8510448936d8ccc91041d42c8d 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( SinkObject, ProcessObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       SinkObject( );
       virtual ~SinkObject( );
index 9ad08785f15d183ae949105fa950714884797dbf..bcead3acc2f2959c532d9629bead806ede5f0b14 100644 (file)
@@ -1,24 +1,12 @@
 #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( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::Interface::SourceObject";
+  this->m_ClassCategory = "BasicObject";
   this->SetNumberOfInputs( 0 );
 }
 
index ecb528ccbba61b8fd8e1dca28c09e4f75b69ed82..5a030b249463df6791b8a992f5643cfe9ea2a642 100644 (file)
@@ -22,10 +22,6 @@ namespace cpPlugins
     public:
       itkTypeMacro( SourceObject, ProcessObject );
 
-    public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
-
     protected:
       SourceObject( );
       virtual ~SourceObject( );
index e8e9d5eadf6195cfe6e6aec68284fec2b7f54c43..09b4b5ae682f1b412b1c23b640dc7cac6fb86e6c 100644 (file)
@@ -4,12 +4,31 @@ SET(LIBRARY_NAME cpPlugins)
 ## = Source code =
 ## ===============
 
-FILE(GLOB LIB_HEADERS_H   "*.h")
-FILE(GLOB LIB_HEADERS_HPP "*.hpp")
-FILE(GLOB LIB_HEADERS_HXX "*.hxx")
-FILE(GLOB LIB_SOURCES_C   "*.c")
-FILE(GLOB LIB_SOURCES_CPP "*.cpp")
-FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+#FILE(GLOB LIB_HEADERS_H   "*.h")
+#FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+#FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+#FILE(GLOB LIB_SOURCES_C   "*.c")
+#FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+#FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+SET(
+  LIB_HEADERS_H
+  ImageReader.h
+  ImageWriter.h
+  MeshReader.h
+  MeshWriter.h
+  MarchingCubes.h
+  )
+SET(
+  LIB_SOURCES_CXX
+  Host.cxx
+  ImageReader.cxx
+  ImageWriter.cxx
+  MeshReader.cxx
+  MeshWriter.cxx
+  MarchingCubes.cxx
+  )
 
 ## =====================
 ## = Compilation rules =
index ad93e89cc09c8860d5d297b6194d90537bb8a0b2..44f225741497ce400febd8854dac99cd5883a050 100644 (file)
@@ -1,27 +1,36 @@
 #include <Pluma/Connector.hpp>
 #include <cpPlugins/Plugins/ImageReader.h>
-#include <cpPlugins/Plugins/ImageSeriesReader.h>
 #include <cpPlugins/Plugins/ImageWriter.h>
-#include <cpPlugins/Plugins/MarchingCubes.h>
 #include <cpPlugins/Plugins/MeshReader.h>
-#include <cpPlugins/Plugins/PolyDataReader.h>
-#include <cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h>
-#include <cpPlugins/Plugins/RGBImageToYPbPrChannelsFilter.h>
+#include <cpPlugins/Plugins/MeshWriter.h>
+#include <cpPlugins/Plugins/MarchingCubes.h>
 
+/*
+  #include <cpPlugins/Plugins/ImageSeriesReader.h>
+  #include <cpPlugins/Plugins/MeshReader.h>
+  #include <cpPlugins/Plugins/PolyDataReader.h>
+  #include <cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h>
+  #include <cpPlugins/Plugins/RGBImageToYPbPrChannelsFilter.h>
+*/
 /// TODO: doc
+
 PLUMA_CONNECTOR
 bool connect( pluma::Host& host )
 {
   using namespace cpPlugins::Plugins;
 
   host.add( new ImageReaderProvider( ) );
-  host.add( new ImageSeriesReaderProvider( ) );
   host.add( new ImageWriterProvider( ) );
+  host.add( new MeshReaderProvider( ) );
+  host.add( new MeshWriterProvider( ) );
   host.add( new MarchingCubesProvider( ) );
+/*
+  host.add( new ImageSeriesReaderProvider( ) );
   host.add( new MeshReaderProvider( ) );
   host.add( new PolyDataReaderProvider( ) );
   host.add( new RGBImageToHSVChannelsFilterProvider( ) );
   host.add( new RGBImageToYPbPrChannelsFilterProvider( ) );
+*/
   return( true );
 }
 
index da7b949485bcb72e7bb9947b3a63df4dd88f1ea7..2d1ae0493887d5cc8976be55a595eea88b118420 100644 (file)
@@ -1,36 +1,27 @@
 #include <cpPlugins/Plugins/ImageReader.h>
 #include <cpPlugins/Interface/Image.h>
 
-#include <itkImageFileReader.h>
-#include <itkImageSeriesReader.h>
+#include <set>
 
-#define ITK_MANUAL_INSTANTIATION
+#undef ITK_MANUAL_INSTANTIATION
 #include <itkImage.h>
 #include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageReader::
-GetClassName( ) const
-{
-  return( "cpPlugins::Plugins::ImageReader" );
-}
+#include <itkImageFileReader.h>
+#include <itkImageSeriesReader.h>
 
 // -------------------------------------------------------------------------
 cpPlugins::Plugins::ImageReader::
 ImageReader( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::ImageReader";
+  this->m_ClassCategory = "ImageReader";
+
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
 
   using namespace cpPlugins::Interface;
   this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
-  this->m_DefaultParameters.Configure( Parameters::String, "PixelType" );
-  this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" );
-  this->m_DefaultParameters.Configure( Parameters::Uint, "IsColorImage" );
-  this->m_DefaultParameters.SetValueAsString( "PixelType", "uchar" );
-  this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 );
-  this->m_DefaultParameters.SetValueAsUint( "IsColorImage", 0 );
   this->m_Parameters = this->m_DefaultParameters;
 }
 
@@ -44,157 +35,225 @@ cpPlugins::Plugins::ImageReader::
 std::string cpPlugins::Plugins::ImageReader::
 _GenerateData( )
 {
-  using namespace cpPlugins::Interface;
-  Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" );
-  std::string r = "cpPlugins::Plugins::ImageReader: itk::Image dimension not supported.";
-  if     ( dim == 1 ) r = this->_GD0< 1 >( );
-  else if( dim == 2 ) r = this->_GD0< 2 >( );
-  else if( dim == 3 ) r = this->_GD0< 3 >( );
-  else if( dim == 4 ) r = this->_GD0< 4 >( );
+  // Get filenames
+  TStringList names;
+  this->m_Parameters.GetValueAsStringList( names, "FileNames" );
 
+  std::string r = "";
+  if( names.size( ) >= 1 )
+  {
+    // Guess image properties
+    itk::ImageIOBase::Pointer io =
+      itk::ImageIOFactory::CreateImageIO(
+        names[ 0 ].c_str( ),
+        itk::ImageIOFactory::ReadMode
+        );
+    if( io.IsNotNull( ) )
+    {
+      io->SetFileName( names[ 0 ] );
+      io->ReadImageInformation( );
+      if( names.size( ) == 1 )
+      {
+        switch( io->GetNumberOfDimensions( ) )
+        {
+        case 1: r = this->_GD0< 1 >( io, names ); break;
+        case 2: r = this->_GD0< 2 >( io, names ); break;
+        case 3: r = this->_GD0< 3 >( io, names ); break;
+        default:
+          r = "ImageReader: Image dimension not supported.";
+          break;
+        } // hctiws
+      }
+      else if( names.size( ) > 1 )
+      {
+        switch( io->GetNumberOfDimensions( ) )
+        {
+        case 1: r = this->_GD0< 2 >( io, names ); break;
+        case 2: r = this->_GD0< 3 >( io, names ); break;
+        default:
+          r = "ImageReader: Image dimension not supported.";
+          break;
+        } // hctiws
+
+      } // fi
+    }
+    else
+      r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\"";
+  }
+  else
+    r = "No image files given";
   return( r );
 }
 
 // -------------------------------------------------------------------------
 template< unsigned int D >
 std::string cpPlugins::Plugins::ImageReader::
-_GD0( )
+_GD0( itk::ImageIOBase* io, const TStringList& names )
 {
-  using namespace cpPlugins::Interface;
-  Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" );
-  Parameters::TUint ci = this->m_Parameters.GetValueAsUint( "IsColorImage" );
-
-  std::string r = "cpPlugins::Plugins::ImageReader: itk::Image pixel type not supported";
-  if( ci == 0 )
-  {
-    if( pt == "char" )
-      r = this->_GD1< char, D >( );
-    else if( pt == "short" )
-      r = this->_GD1< short, D >( );
-    else if( pt == "int" )
-      r = this->_GD1< int, D >( );
-    else if( pt == "long" )
-      r = this->_GD1< long, D >( );
-    else if( pt == "uchar" )
-      r = this->_GD1< unsigned char, D >( );
-    else if( pt == "ushort" )
-      r = this->_GD1< unsigned short, D >( );
-    else if( pt == "uint" )
-      r = this->_GD1< unsigned int, D >( );
-    else if( pt == "ulong" )
-      r = this->_GD1< unsigned long, D >( );
-    else if( pt == "float" )
-      r = this->_GD1< float, D >( );
-    else if( pt == "double" )
-      r = this->_GD1< double, D >( );
-  }
-  else
+  std::string r = "";
+  switch( io->GetComponentType( ) )
   {
-    if( pt == "char" )
-      r = this->_GD1< itk::RGBPixel< char >, D >( );
-    else if( pt == "short" )
-      r = this->_GD1< itk::RGBPixel< short >, D >( );
-    else if( pt == "int" )
-      r = this->_GD1< itk::RGBPixel< int >, D >( );
-    else if( pt == "long" )
-      r = this->_GD1< itk::RGBPixel< long >, D >( );
-    else if( pt == "uchar" )
-      r = this->_GD1< itk::RGBPixel< unsigned char >, D >( );
-    else if( pt == "ushort" )
-      r = this->_GD1< itk::RGBPixel< unsigned short >, D >( );
-    else if( pt == "uint" )
-      r = this->_GD1< itk::RGBPixel< unsigned int >, D >( );
-    else if( pt == "ulong" )
-      r = this->_GD1< itk::RGBPixel< unsigned long >, D >( );
-    else if( pt == "float" )
-      r = this->_GD1< itk::RGBPixel< float >, D >( );
-    else if( pt == "double" )
-      r = this->_GD1< itk::RGBPixel< double >, D >( );
-  } // fi
+  case itk::ImageIOBase::UCHAR:
+    r = this->_GD1< unsigned char, D >( io, names );
+    break;
+  case itk::ImageIOBase::CHAR:
+    r = this->_GD1< char, D >( io, names );
+    break;
+  case itk::ImageIOBase::USHORT:
+    r = this->_GD1< unsigned short, D >( io, names );
+    break;
+  case itk::ImageIOBase::SHORT:
+    r = this->_GD1< short, D >( io, names );
+    break;
+  case itk::ImageIOBase::UINT:
+    r = this->_GD1< unsigned int, D >( io, names );
+    break;
+  case itk::ImageIOBase::INT:
+    r = this->_GD1< int, D >( io, names );
+    break;
+  case itk::ImageIOBase::ULONG:
+    r = this->_GD1< unsigned long, D >( io, names );
+    break;
+  case itk::ImageIOBase::LONG:
+    r = this->_GD1< long, D >( io, names );
+    break;
+  case itk::ImageIOBase::FLOAT:
+    r = this->_GD1< float, D >( io, names );
+    break;
+  case itk::ImageIOBase::DOUBLE:
+    r = this->_GD1< double, D >( io, names );
+    break;
+  default:
+    r = "ImageReader: Atomic pixel type not supported.";
+    break;
+  } // hctiws
   return( r );
 }
 
 // -------------------------------------------------------------------------
 template< class P, unsigned int D >
 std::string cpPlugins::Plugins::ImageReader::
-_GD1( )
+_GD1( itk::ImageIOBase* io, const TStringList& names )
 {
-  typedef itk::Image< P, D > _TImage;
+  std::string r = "";
+  switch( io->GetPixelType( ) )
+  {
+  case itk::ImageIOBase::SCALAR:
+    r = this->_GD2< P, D >( names );
+    break;
+  case itk::ImageIOBase::RGB:
+    r = this->_GD2< itk::RGBPixel< P >, D >( names );
+    break;
+  case itk::ImageIOBase::RGBA:
+    r = this->_GD2< itk::RGBAPixel< P >, D >( names );
+    break;
+    /* TODO
+       case itk::ImageIOBase::OFFSET:
+       r = this->_GD2< itk::Offset< P >, D >( names );
+       break;
+       case itk::ImageIOBase::VECTOR:
+       r = this->_GD2< P, D >( names );
+       break;
+       case itk::ImageIOBase::POINT:
+       r = this->_GD2< P, D >( names );
+       break;
+       case itk::ImageIOBase::COVARIANTVECTOR:
+       r = this->_GD2< P, D >( names );
+       break;
+       case itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR:
+       r = this->_GD2< P, D >( names );
+       break;
+       case itk::ImageIOBase::DIFFUSIONTENSOR3D:
+       r = this->_GD2< P, D >( names );
+       break;
+    */
+    /* TODO
+       case itk::ImageIOBase::COMPLEX:
+       r = this->_GD2< std::complex< P >, D >( names );
+       break;
+       case itk::ImageIOBase::FIXEDARRAY:
+       r = this->_GD2< P, D >( names );
+       break;
+       case itk::ImageIOBase::MATRIX:
+       r = this->_GD2< P, D >( names );
+       break;
+    */
+  default:
+    r = "ImageReader: Pixel type not supported.";
+    break;
+  } // hctiws
+  return( r );
+}
 
-  // Get filenames
-  using namespace cpPlugins::Interface;
-  std::vector< Parameters::TString > unordered_names;
-  this->m_Parameters.GetValueAsStringList( unordered_names, "FileNames" );
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+std::string cpPlugins::Plugins::ImageReader::
+_GD2( const TStringList& names )
+{
+  typedef itk::Image< P, D > _I;
 
-  if( unordered_names.size( ) == 1 )
+  std::string r = "";
+  if( names.size( ) == 1 )
   {
     // Read single image
-    typedef itk::ImageFileReader< _TImage > _TSingleReader;
-
-    _TSingleReader* singleReader =
-      dynamic_cast< _TSingleReader* >(
-        this->m_RealProcessObject.GetPointer( )
-        );
-    if( singleReader == NULL )
+    typedef itk::ImageFileReader< _I > _SR;
+    _SR* reader =
+      dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
+    if( reader == NULL )
     {
-      this->m_RealProcessObject = _TSingleReader::New( );
-      singleReader =
-        dynamic_cast< _TSingleReader* >(
-          this->m_RealProcessObject.GetPointer( )
-          );
+      this->m_RealProcessObject = _SR::New( );
+      reader =
+        dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
 
     } // fi
-    singleReader->SetFileName( unordered_names.front( ) );
+    reader->SetFileName( names[ 0 ] );
     try
     {
-      singleReader->Update( );
+      reader->Update( );
+      this->m_Outputs[ 0 ]->SetITKDataObject( reader->GetOutput( ) );
     }
     catch( itk::ExceptionObject& err )
     {
-      return( err.GetDescription( ) );
+      r = "ImageReader: " + std::string( err.GetDescription( ) );
+      this->m_Outputs[ 0 ]->SetITKDataObject( NULL );
 
     } // yrt
-    this->_SetOutput( 0, singleReader->GetOutput( ) );
-    return( "" );
   }
-  else if( unordered_names.size( ) > 1 )
+  else if( names.size( ) > 1 )
   {
     // Read image series
     std::set< std::string > ordered_names;
-    for( unsigned int i = 0; i < unordered_names.size( ); ++i )
-      ordered_names.insert( unordered_names[ i ] );
+    for( unsigned int i = 0; i < names.size( ); ++i )
+      ordered_names.insert( names[ i ] );
 
-    typedef itk::ImageSeriesReader< _TImage > _TMultiReader;
-    _TMultiReader* multiReader =
-      dynamic_cast< _TMultiReader* >(
-        this->m_RealProcessObject.GetPointer( )
-        );
-    if( multiReader == NULL )
+    typedef itk::ImageSeriesReader< _I > _MR;
+    _MR* reader =
+      dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
+    if( reader == NULL )
     {
-      this->m_RealProcessObject = _TMultiReader::New( );
-      multiReader =
-        dynamic_cast< _TMultiReader* >(
-          this->m_RealProcessObject.GetPointer( )
-          );
+      this->m_RealProcessObject = _MR::New( );
+      reader =
+        dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
 
     } // fi
     std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
     for( ; fnIt != ordered_names.end( ); ++fnIt )
-      multiReader->AddFileName( *fnIt );
+      reader->AddFileName( *fnIt );
     try
     {
-      multiReader->Update( );
+      reader->Update( );
+      this->m_Outputs[ 0 ]->SetITKDataObject( reader->GetOutput( ) );
     }
     catch( itk::ExceptionObject& err )
     {
-      return( err.GetDescription( ) );
+      r = "ImageReader: " + std::string( err.GetDescription( ) );
+      this->m_Outputs[ 0 ]->SetITKDataObject( NULL );
 
     } // yrt
-    this->_SetOutput( 0, multiReader->GetOutput( ) );
-    return( "" );
   }
   else
-    return( "No image filename(s) given." );
+    r = "ImageReader: No image files given";
+  return( r );
 }
 
 // eof - $RCSfile$
index 61efe0d2858e556d11e2cce2c7a1fce009f35253..07aeebaec6ef8c63415baae0d8d317e7d31a2e6a 100644 (file)
@@ -1,9 +1,13 @@
 #ifndef __CPPLUGINS__PLUGINS__IMAGEREADER__H__
 #define __CPPLUGINS__PLUGINS__IMAGEREADER__H__
 
+#include <vector>
+
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
 #include <cpPlugins/Interface/ImageSource.h>
-#include <itkProcessObject.h>
+
+#define ITK_MANUAL_INSTANTIATION
+#include <itkImageIOBase.h>
 
 namespace cpPlugins
 {
@@ -20,13 +24,14 @@ namespace cpPlugins
       typedef itk::SmartPointer< Self >         Pointer;
       typedef itk::SmartPointer< const Self >   ConstPointer;
 
+      typedef
+        std::vector< cpPlugins::Interface::Parameters::TString >
+        TStringList;
+
     public:
       itkNewMacro( Self );
       itkTypeMacro( ImageReader, cpPluginsInterfaceImageSource );
 
-    public:
-      virtual std::string GetClassName( ) const;
-
     protected:
       ImageReader( );
       virtual ~ImageReader( );
@@ -34,10 +39,13 @@ namespace cpPlugins
       virtual std::string _GenerateData( );
 
       template< unsigned int D >
-        std::string _GD0( );
+        std::string _GD0( itk::ImageIOBase* io, const TStringList& names );
+
+      template< class P, unsigned int D >
+        std::string _GD1( itk::ImageIOBase* io, const TStringList& names );
 
       template< class P, unsigned int D >
-        std::string _GD1( );
+        std::string _GD2( const TStringList& names );
 
     private:
       // Purposely not implemented
diff --git a/lib/cpPlugins/Plugins/ImageSeriesReader.cxx b/lib/cpPlugins/Plugins/ImageSeriesReader.cxx
deleted file mode 100644 (file)
index 30585e7..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#include <cpPlugins/Plugins/ImageSeriesReader.h>
-#include <cpPlugins/Interface/Image.h>
-
-#include <set>
-#include <sstream>
-
-#include <itkImageSeriesReader.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageSeriesReader::
-GetClassName( ) const
-{
-  return( "cpPlugins::Plugins::ImageSeriesReader" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageSeriesReader::
-ImageSeriesReader( )
-  : Superclass( )
-{
-  this->SetNumberOfOutputs( 1 );
-  this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
-
-  using namespace cpPlugins::Interface;
-  this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
-  this->m_DefaultParameters.Configure( Parameters::String, "PixelType" );
-  this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" );
-  this->m_DefaultParameters.Configure( Parameters::Uint, "IsColorImage" );
-  this->m_DefaultParameters.SetValueAsString( "PixelType", "uchar" );
-  this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 );
-  this->m_DefaultParameters.SetValueAsUint( "IsColorImage", 0 );
-  this->m_Parameters = this->m_DefaultParameters;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageSeriesReader::
-~ImageSeriesReader( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageSeriesReader::
-_GenerateData( )
-{
-  using namespace cpPlugins::Interface;
-  Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" );
-
-  std::string r = "cpPlugins::Plugins::ImageSeriesReader: itk::Image dimension not supported.";
-  if     ( dim == 2 ) r = this->_GD0< 2 >( );
-  else if( dim == 3 ) r = this->_GD0< 3 >( );
-  else if( dim == 4 ) r = this->_GD0< 4 >( );
-
-  return( r );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::ImageSeriesReader::
-_GD0( )
-{
-  using namespace cpPlugins::Interface;
-  Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" );
-  Parameters::TUint ci = this->m_Parameters.GetValueAsUint( "IsColorImage" );
-
-  std::string r = "cpPlugins::Plugins::ImageSeriesReader: itk::Image pixel type not supported";
-  if( ci == 0 )
-  {
-    if( pt == "char" )
-      r = this->_GD1< char, D >( );
-    else if( pt == "short" )
-      r = this->_GD1< short, D >( );
-    else if( pt == "int" )
-      r = this->_GD1< int, D >( );
-    else if( pt == "long" )
-      r = this->_GD1< long, D >( );
-    else if( pt == "uchar" )
-      r = this->_GD1< unsigned char, D >( );
-    else if( pt == "ushort" )
-      r = this->_GD1< unsigned short, D >( );
-    else if( pt == "uint" )
-      r = this->_GD1< unsigned int, D >( );
-    else if( pt == "ulong" )
-      r = this->_GD1< unsigned long, D >( );
-    else if( pt == "float" )
-      r = this->_GD1< float, D >( );
-    else if( pt == "double" )
-      r = this->_GD1< double, D >( );
-  }
-  else if( ci == 1 )
-  {
-    if( pt == "char" )
-      r = this->_GD1< itk::RGBPixel< char >, D >( );
-    else if( pt == "short" )
-      r = this->_GD1< itk::RGBPixel< short >, D >( );
-    else if( pt == "int" )
-      r = this->_GD1< itk::RGBPixel< int >, D >( );
-    else if( pt == "long" )
-      r = this->_GD1< itk::RGBPixel< long >, D >( );
-    else if( pt == "uchar" )
-      r = this->_GD1< itk::RGBPixel< unsigned char >, D >( );
-    else if( pt == "ushort" )
-      r = this->_GD1< itk::RGBPixel< unsigned short >, D >( );
-    else if( pt == "uint" )
-      r = this->_GD1< itk::RGBPixel< unsigned int >, D >( );
-    else if( pt == "ulong" )
-      r = this->_GD1< itk::RGBPixel< unsigned long >, D >( );
-    else if( pt == "float" )
-      r = this->_GD1< itk::RGBPixel< float >, D >( );
-    else if( pt == "double" )
-      r = this->_GD1< itk::RGBPixel< double >, D >( );
-  } // fi
-  return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::ImageSeriesReader::
-_GD1( )
-{
-  using namespace cpPlugins::Interface;
-  std::vector< Parameters::TString > unordered_names;
-  this->m_Parameters.GetValueAsStringList( unordered_names, "FileNames" );
-  std::set< std::string > ordered_names;
-  for( unsigned int i = 0; i < unordered_names.size( ); ++i )
-    ordered_names.insert( unordered_names[ i ] );
-
-  // Reader
-  typedef itk::Image< P, D > _TImage;
-  typedef itk::ImageSeriesReader< _TImage > _TReader;
-
-  _TReader* reader =
-    dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
-  if( reader == NULL )
-  {
-    this->m_RealProcessObject = _TReader::New( );
-    reader =
-      dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
-
-  } // fi
-  std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
-  for( ; fnIt != ordered_names.end( ); ++fnIt )
-    reader->AddFileName( *fnIt );
-  try
-  {
-    reader->Update( );
-  }
-  catch( itk::ExceptionObject& err )
-  {
-    return( err.GetDescription( ) );
-
-  } // yrt
-  this->_SetOutput( 0, reader->GetOutput( ) );
-  return( "" );
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/ImageSeriesReader.h b/lib/cpPlugins/Plugins/ImageSeriesReader.h
deleted file mode 100644 (file)
index f2bcf03..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__
-#define __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__
-
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/ImageSource.h>
-#include <itkProcessObject.h>
-
-namespace cpPlugins
-{
-  namespace Plugins
-  {
-    /**
-     */
-    class cpPlugins_EXPORT ImageSeriesReader
-      : public cpPlugins::Interface::ImageSource
-    {
-    public:
-      typedef ImageSeriesReader                 Self;
-      typedef cpPlugins::Interface::ImageSource Superclass;
-      typedef itk::SmartPointer< Self >         Pointer;
-      typedef itk::SmartPointer< const Self >   ConstPointer;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( ImageSeriesReader, cpPluginsInterfaceImageSource );
-
-    public:
-      virtual std::string GetClassName( ) const;
-
-    protected:
-      ImageSeriesReader( );
-      virtual ~ImageSeriesReader( );
-
-      virtual std::string _GenerateData( );
-
-      template< unsigned int D >
-      std::string _GD0( );
-
-      template< class P, unsigned int D >
-      std::string _GD1( );
-
-    private:
-      // Purposely not implemented
-      ImageSeriesReader( const Self& );
-      Self& operator=( const Self& );
-    };
-
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( ImageSeriesReader );
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__
-
-// eof - $RCSfile$
index de74e90d019c5884c8ea32aa9903b5a1e0c344c2..9c99f2c8490ee2c5bcedb72a80423519fc176e8c 100644 (file)
@@ -1,40 +1,34 @@
 #include <cpPlugins/Plugins/ImageWriter.h>
 
-#include <itkImageFileWriter.h>
-
-#define ITK_MANUAL_INSTANTIATION
+#undef ITK_MANUAL_INSTANTIATION
 #include <itkImage.h>
 #include <itkRGBPixel.h>
+#include <itkImageFileWriter.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_Dimension( r, d, o, f )                \
-  if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL )            \
-    r = this->f< d >( )
+#define cpPlugins_ImageWriter_Dimension( r, d, i, f )                \
+  if( dynamic_cast< itk::ImageBase< d >* >( i ) != NULL )            \
+    r = this->f< d >( )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_Pixel( r, p, d, o, f )                    \
-  if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL )                \
-    r = this->f< p, d >( )
+#define cpPlugins_ImageWriter_Pixel( r, p, d, i, f )                    \
+  if( dynamic_cast< itk::Image< p, d >* >( i ) != NULL )                \
+    r = this->f< p, d >( )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_RGB( r, p, d, o, f )                      \
+#define cpPlugins_ImageWriter_RGB( r, p, d, i, f )                      \
   if(                                                                   \
-    dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL   \
+    dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( i ) != NULL   \
     )                                                                   \
-    r = this->f< itk::RGBPixel< p >, d >( )
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageWriter::
-GetClassName( ) const
-{
-  return( "cpPlugins::Plugins::ImageWriter" );
-}
+    r = this->f< itk::RGBPixel< p >, d >( i )
 
 // -------------------------------------------------------------------------
 cpPlugins::Plugins::ImageWriter::
 ImageWriter( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::ImageWriter";
+  this->m_ClassCategory = "ImageWriter";
   this->SetNumberOfInputs( 1 );
 
   using namespace cpPlugins::Interface;
@@ -52,79 +46,73 @@ cpPlugins::Plugins::ImageWriter::
 std::string cpPlugins::Plugins::ImageWriter::
 _GenerateData( )
 {
-  itk::DataObject* o = this->_GetInput( 0 );
+  itk::DataObject* i = this->m_Inputs[ 0 ]->GetITKDataObject( );
 
-  std::string r = "cpPlugins::Plugins::ImageWriter: itk::Image dimension not supported.";
-  cpPlugins_ImageWriter_Dimension( r, 1, o, _GD0 );
-  else cpPlugins_ImageWriter_Dimension( r, 2, o, _GD0 );
-  else cpPlugins_ImageWriter_Dimension( r, 3, o, _GD0 );
-  else cpPlugins_ImageWriter_Dimension( r, 4, o, _GD0 );
+  std::string r = "ImageWriter: Image dimension not supported.";
+  cpPlugins_ImageWriter_Dimension     ( r, 1, i, _GD0 );
+  else cpPlugins_ImageWriter_Dimension( r, 2, i, _GD0 );
+  else cpPlugins_ImageWriter_Dimension( r, 3, i, _GD0 );
   return( r );
 }
 
 // -------------------------------------------------------------------------
 template< unsigned int D >
 std::string cpPlugins::Plugins::ImageWriter::
-_GD0( )
+_GD0( itk::DataObject* i )
 {
-  itk::ImageBase< D >* i =
-    dynamic_cast< itk::ImageBase< D >* >( this->_GetInput( 0 ) );
-
-  std::string r = "cpPlugins::Plugins::ImageWriter: itk::Image pixel type not supported";
-  cpPlugins_ImageWriter_Pixel( r, char, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, short, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, int, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, long, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, unsigned char, D, i, _GD1 );
+  std::string r = "ImageWriter: Image pixel type not supported";
+  cpPlugins_ImageWriter_Pixel     ( r, char          , D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, short         , D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, int           , D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, long          , D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, unsigned char , D, i, _GD1 );
   else cpPlugins_ImageWriter_Pixel( r, unsigned short, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, unsigned int, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, unsigned long, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, float, D, i, _GD1 );
-  else cpPlugins_ImageWriter_Pixel( r, double, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, char, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, short, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, int, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, long, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, unsigned char, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, unsigned short, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, unsigned int, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, unsigned long, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, float, D, i, _GD1 );
-  else cpPlugins_ImageWriter_RGB( r, double, D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, unsigned int  , D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, unsigned long , D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, float         , D, i, _GD1 );
+  else cpPlugins_ImageWriter_Pixel( r, double        , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, char          , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, short         , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, int           , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, long          , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, unsigned char , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, unsigned short, D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, unsigned int  , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, unsigned long , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, float         , D, i, _GD1 );
+  else cpPlugins_ImageWriter_RGB  ( r, double        , D, i, _GD1 );
   return( r );
 }
 
 // -------------------------------------------------------------------------
 template< class P, unsigned int D >
 std::string cpPlugins::Plugins::ImageWriter::
-_GD1( )
+_GD1( itk::DataObject* i )
 {
-  typedef itk::Image< P, D > _TImage;
-  typedef itk::ImageFileWriter< _TImage > _TWriter;
+  typedef itk::Image< P, D > _I;
+  typedef itk::ImageFileWriter< _I > _W;
 
   // Get filename
   using namespace cpPlugins::Interface;
   Parameters::TString fname =
     this->m_Parameters.GetValueAsString( "FileName" );
 
-  _TWriter* writer =
-    dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) );
+  _W* writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
   if( writer == NULL )
   {
-    this->m_RealProcessObject = _TWriter::New( );
-    writer =
-      dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) );
+    this->m_RealProcessObject = _W::New( );
+    writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
 
   } // fi
   writer->SetFileName( fname );
-  writer->SetInput( dynamic_cast< _TImage* >( this->_GetInput( 0 ) ) );
+  writer->SetInput( dynamic_cast< _I* >( i ) );
   try
   {
     writer->Update( );
   }
   catch( itk::ExceptionObject& err )
   {
-    return( err.GetDescription( ) );
+    return( "ImageWriter: " + std::string( err.GetDescription( ) ) );
 
   } // yrt
   return( "" );
index 4a02fe20f7c052955f830a71b94114063d0a6732..dc8d5da04539ac4e54619ce5489e9ba6f424c551 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
 #include <cpPlugins/Interface/ImageSink.h>
-#include <itkProcessObject.h>
 
 namespace cpPlugins
 {
@@ -24,9 +23,6 @@ namespace cpPlugins
       itkNewMacro( Self );
       itkTypeMacro( ImageWriter, cpPluginsInterfaceImageSink );
 
-    public:
-      virtual std::string GetClassName( ) const;
-
     protected:
       ImageWriter( );
       virtual ~ImageWriter( );
@@ -34,10 +30,10 @@ namespace cpPlugins
       virtual std::string _GenerateData( );
 
       template< unsigned int D >
-      std::string _GD0( );
+        std::string _GD0( itk::DataObject* i );
 
       template< class P, unsigned int D >
-      std::string _GD1( );
+        std::string _GD1( itk::DataObject* i );
 
     private:
       // Purposely not implemented
index 12aad40157c72f728ad7c128b6c818f4398ed823..bc56f9cb4f9fd38e7df6d7d16a0e4a29225e200e 100644 (file)
 #include <cpPlugins/Interface/Image.h>
 #include <cpPlugins/Interface/Mesh.h>
 
-#include <itkImageFileReader.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MarchingCubes::
-GetClassName( ) const
-{
-  return( "cpPlugins::Plugins::MarchingCubes" );
-}
+#include <vtkImageData.h>
+#include <vtkMarchingCubes.h>
+#include <vtkMarchingSquares.h>
 
 // -------------------------------------------------------------------------
 cpPlugins::Plugins::MarchingCubes::
 MarchingCubes( )
-  : Superclass( )
+  : Superclass( ),
+    m_Algorithm( NULL )
 {
+  this->m_ClassName = "cpPlugins::MarchingCubes";
+
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
 
-  /* TODO
-     this->m_DefaultParameters[ "FileName" ] =
-     TParameter( "string", "no_file_name" );
-     this->m_DefaultParameters[ "PixelType" ] = TParameter( "type", "uchar" );
-     this->m_DefaultParameters[ "ImageDimension" ] = TParameter( "int", "2" );
-     this->m_DefaultParameters[ "IsColorImage" ] = TParameter( "bool", "0" );
-  */
+  using namespace cpPlugins::Interface;
+  this->m_DefaultParameters.Configure( Parameters::RealList, "Thresholds" );
+  this->m_Parameters = this->m_DefaultParameters;
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Plugins::MarchingCubes::
 ~MarchingCubes( )
 {
+  if( this->m_Algorithm != NULL )
+    this->m_Algorithm->Delete( );
 }
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::Plugins::MarchingCubes::
 _GenerateData( )
 {
-  return( "" );
-  /* TODO
-     TParameters::const_iterator dIt;
-
-     // Get image dimension
-  dIt = this->m_Parameters.find( "ImageDimension" );
-  if( dIt == this->m_Parameters.end( ) )
-    dIt = this->m_DefaultParameters.find( "ImageDimension" );
-
-  std::string r = "cpPlugins::Plugins::MarchingCubes: itk::Image dimension not supported.";
-  if     ( dIt->second.second == "1" ) r = this->_GD0< 1 >( );
-  else if( dIt->second.second == "2" ) r = this->_GD0< 2 >( );
-  else if( dIt->second.second == "3" ) r = this->_GD0< 3 >( );
-  else if( dIt->second.second == "4" ) r = this->_GD0< 4 >( );
-
-  return( r );
-  */
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::MarchingCubes::
-_GD0( )
-{
-  return( "" );
-  /* TODO
-  TParameters::const_iterator tIt, cIt;
-
-  // Get image pixel type
-  tIt = this->m_Parameters.find( "PixelType" );
-  if( tIt == this->m_Parameters.end( ) )
-    tIt = this->m_DefaultParameters.find( "PixelType" );
-  cIt = this->m_Parameters.find( "IsColorImage" );
-  if( cIt == this->m_Parameters.end( ) )
-    cIt = this->m_DefaultParameters.find( "IsColorImage" );
-
-  std::string r = "cpPlugins::Plugins::MarchingCubes: itk::Image pixel type not supported";
-  if( cIt->second.second == "0" )
+  // Get input
+  cpPlugins::Interface::Image* input =
+    dynamic_cast< cpPlugins::Interface::Image* >(
+      this->m_Inputs[ 0 ].GetPointer( )
+      );
+  if( input == NULL )
+    return( "MarchingCubes: Input data is not a valid image." );
+  vtkImageData* vtk_input =
+    dynamic_cast< vtkImageData* >( input->GetVTKDataObject( ) );
+  if( vtk_input == NULL )
+    return( "MarchingCubes: Input does not have a valid conversion to VTK." );
+
+  if( this->m_Algorithm != NULL )
+    this->m_Algorithm->Delete( );
+
+  std::vector< double > values;
+  this->m_Parameters.GetValueAsRealList( values, "Thresholds" );
+  if( vtk_input->GetDataDimension( ) == 2 )
   {
-    if( tIt->second.second == "char" )
-      r = this->_GD1< char, D >( );
-    else if( tIt->second.second == "short" )
-      r = this->_GD1< short, D >( );
-    else if( tIt->second.second == "int" )
-      r = this->_GD1< int, D >( );
-    else if( tIt->second.second == "long" )
-      r = this->_GD1< long, D >( );
-    else if( tIt->second.second == "uchar" )
-      r = this->_GD1< unsigned char, D >( );
-    else if( tIt->second.second == "ushort" )
-      r = this->_GD1< unsigned short, D >( );
-    else if( tIt->second.second == "uint" )
-      r = this->_GD1< unsigned int, D >( );
-    else if( tIt->second.second == "ulong" )
-      r = this->_GD1< unsigned long, D >( );
-    else if( tIt->second.second == "float" )
-      r = this->_GD1< float, D >( );
-    else if( tIt->second.second == "double" )
-      r = this->_GD1< double, D >( );
+    vtkMarchingSquares* ms = vtkMarchingSquares::New( );
+    ms->SetInputData( vtk_input );
+    for( unsigned int i = 0; i < values.size( ); ++i )
+      ms->SetValue( i, values[ i ] );
+    this->m_Algorithm = ms;
   }
-  else if( cIt->second.second == "1" )
-  {
-    if( tIt->second.second == "char" )
-      r = this->_GD1< itk::RGBPixel< char >, D >( );
-    else if( tIt->second.second == "short" )
-      r = this->_GD1< itk::RGBPixel< short >, D >( );
-    else if( tIt->second.second == "int" )
-      r = this->_GD1< itk::RGBPixel< int >, D >( );
-    else if( tIt->second.second == "long" )
-      r = this->_GD1< itk::RGBPixel< long >, D >( );
-    else if( tIt->second.second == "uchar" )
-      r = this->_GD1< itk::RGBPixel< unsigned char >, D >( );
-    else if( tIt->second.second == "ushort" )
-      r = this->_GD1< itk::RGBPixel< unsigned short >, D >( );
-    else if( tIt->second.second == "uint" )
-      r = this->_GD1< itk::RGBPixel< unsigned int >, D >( );
-    else if( tIt->second.second == "ulong" )
-      r = this->_GD1< itk::RGBPixel< unsigned long >, D >( );
-    else if( tIt->second.second == "float" )
-      r = this->_GD1< itk::RGBPixel< float >, D >( );
-    else if( tIt->second.second == "double" )
-      r = this->_GD1< itk::RGBPixel< double >, D >( );
-  } // fi
-  return( r );
-*/
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::MarchingCubes::
-_GD1( )
-{
-  return( "" );
-  /* TODO
-  TParameters::const_iterator fIt;
-
-  // Get filename
-  fIt = this->m_Parameters.find( "FileName" );
-  if( fIt == this->m_Parameters.end( ) )
-    fIt = this->m_DefaultParameters.find( "FileName" );
-
-  typedef itk::Image< P, D > _TImage;
-  typedef itk::ImageFileReader< _TImage > _TReader;
-
-  _TReader* reader =
-    dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) );
-  if( reader == NULL )
-  {
-    this->m_Reader = _TReader::New( );
-    reader = dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) );
-
-  } // fi
-  reader->SetFileName( fIt->second.second );
-  try
+  else if( vtk_input->GetDataDimension( ) == 3 )
   {
-    reader->Update( );
+    vtkMarchingCubes* mc = vtkMarchingCubes::New( );
+    mc->SetInputData( vtk_input );
+    for( unsigned int i = 0; i < values.size( ); ++i )
+      mc->SetValue( i, values[ i ] );
+    this->m_Algorithm = mc;
   }
-  catch( itk::ExceptionObject& err )
-  {
-    return( err.GetDescription( ) );
+  else
+    return( "MarchingCubes: Input data does not have a valid dimension." );
 
-  } // yrt
-  this->_SetOutput( 0, reader->GetOutput( ) );
+  // Execute filter
+  this->m_Algorithm->Update( );
+  this->m_Outputs[ 0 ]->SetVTKDataObject( this->m_Algorithm->GetOutput( ) );
   return( "" );
-*/
 }
 
 // eof - $RCSfile$
index c84668bcec2fe63b34d7c500d1acd05a13c259a1..4375842d02d5155455f4357286deed92c193b849 100644 (file)
@@ -3,7 +3,8 @@
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
 #include <cpPlugins/Interface/ImageToMeshFilter.h>
-#include <itkProcessObject.h>
+
+class vtkPolyDataAlgorithm;
 
 namespace cpPlugins
 {
@@ -24,25 +25,19 @@ namespace cpPlugins
       itkNewMacro( Self );
       itkTypeMacro( MarchingCubes, cpPluginsInterfaceImageToMeshFilter );
 
-    public:
-      virtual std::string GetClassName( ) const;
-
     protected:
       MarchingCubes( );
       virtual ~MarchingCubes( );
 
       virtual std::string _GenerateData( );
 
-      template< unsigned int D >
-      std::string _GD0( );
-
-      template< class P, unsigned int D >
-      std::string _GD1( );
-
     private:
       // Purposely not implemented
       MarchingCubes( const Self& );
       Self& operator=( const Self& );
+
+    protected:
+      vtkPolyDataAlgorithm* m_Algorithm;
     };
 
     // ---------------------------------------------------------------------
index b7ce4ba88e3d5667232cef35c237d82a95854295..5338c32b3424ebd1464be2406a7144e682fb4042 100644 (file)
@@ -1,21 +1,17 @@
 #include <cpPlugins/Plugins/MeshReader.h>
 #include <cpPlugins/Interface/Mesh.h>
 
-#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/IO/MeshReader.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MeshReader::
-GetClassName( ) const
-{
-  return( "cpPlugins::Plugins::MeshReader" );
-}
+#include <vtkPolyData.h>
+#include <vtkPolyDataReader.h>
 
 // -------------------------------------------------------------------------
 cpPlugins::Plugins::MeshReader::
 MeshReader( )
   : Superclass( )
 {
+  this->m_ClassName = "cpPlugins::MeshReader";
+  this->m_ClassCategory = "MeshReader";
+
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
 
@@ -40,7 +36,7 @@ _GenerateData( )
 {
   using namespace cpPlugins::Interface;
   Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" );
-  std::string r = "cpPlugins::Plugins::MeshReader: itk::Mesh dimension not supported.";
+  std::string r = "MeshReader: Mesh dimension not supported.";
   if( dim == 3 )
     r = this->_GD0< 3 >( );
   return( r );
@@ -53,7 +49,7 @@ _GD0( )
 {
   using namespace cpPlugins::Interface;
   Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" );
-  std::string r = "cpPlugins::Plugins::MeshReader: itk::Mesh pixel type not supported";
+  std::string r = "MeshReader: Mesh pixel type not supported";
   if( pt == "float" )       r = this->_GD1< float, D >( );
   else if( pt == "double" ) r = this->_GD1< double, D >( );
   return( r );
@@ -69,31 +65,14 @@ _GD1( )
   Parameters::TString fname =
     this->m_Parameters.GetValueAsString( "FileName" );
 
-  using namespace cpPlugins::Extensions;
-  typedef DataStructures::QuadEdgeMesh< P, D > _TMesh;
-  typedef IO::MeshReader< _TMesh > _TReader;
-
-  _TReader* reader =
-    dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
-  if( reader == NULL )
-  {
-    this->m_RealProcessObject = _TReader::New( );
-    reader =
-      dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
-
-  } // fi
-  reader->SetFileName( fname );
-  try
-  {
-    reader->Update( );
-  }
-  catch( itk::ExceptionObject& err )
-  {
-    return( err.GetDescription( ) );
-
-  } // yrt
-  this->_SetOutput( 0, reader->GetOutput( ) );
+  if( this->m_Reader != NULL )
+    this->m_Reader->Delete( );
 
+  vtkPolyDataReader* pdr = vtkPolyDataReader::New( );
+  this->m_Reader = pdr;
+  pdr->SetFileName( fname.c_str( ) );
+  pdr->Update( );
+  this->m_Outputs[ 0 ]->SetVTKDataObject( pdr->GetOutput( ) );
   return( "" );
 }
 
index 6689608289a4a208d3ae23ba58f2e31b322e016e..d2b42de38452bd8e3233ed559b9a796f27788640 100644 (file)
@@ -3,7 +3,8 @@
 
 #include <cpPlugins/Plugins/cpPlugins_Export.h>
 #include <cpPlugins/Interface/MeshSource.h>
-#include <itkProcessObject.h>
+
+class vtkDataReader;
 
 namespace cpPlugins
 {
@@ -24,9 +25,6 @@ namespace cpPlugins
       itkNewMacro( Self );
       itkTypeMacro( MeshReader, cpPluginsInterfaceMeshSource );
 
-    public:
-      virtual std::string GetClassName( ) const;
-
     protected:
       MeshReader( );
       virtual ~MeshReader( );
@@ -43,6 +41,9 @@ namespace cpPlugins
       // Purposely not implemented
       MeshReader( const Self& );
       Self& operator=( const Self& );
+
+    protected:
+      vtkDataReader* m_Reader;
     };
 
     // ---------------------------------------------------------------------
diff --git a/lib/cpPlugins/Plugins/MeshWriter.cxx b/lib/cpPlugins/Plugins/MeshWriter.cxx
new file mode 100644 (file)
index 0000000..beaee04
--- /dev/null
@@ -0,0 +1,55 @@
+#include <cpPlugins/Plugins/MeshWriter.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataWriter.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::MeshWriter::
+MeshWriter( )
+  : Superclass( ),
+    m_Writer( NULL )
+{
+  this->m_ClassName = "cpPlugins::MeshWriter";
+  this->m_ClassCategory = "MeshWriter";
+  this->SetNumberOfInputs( 1 );
+
+  using namespace cpPlugins::Interface;
+  this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
+  this->m_Parameters = this->m_DefaultParameters;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::MeshWriter::
+~MeshWriter( )
+{
+  if( this->m_Writer != NULL )
+    this->m_Writer->Delete( );
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Plugins::MeshWriter::
+_GenerateData( )
+{
+  vtkPolyData* i =
+    dynamic_cast< vtkPolyData* >(
+      this->m_Inputs[ 0 ]->GetVTKDataObject( )
+      );
+  if( i == NULL )
+    return( "MeshWriter: No suitable input." );
+  std::string fname = this->m_Parameters.GetValueAsString( "FileName" );
+
+  if( this->m_Writer != NULL )
+    this->m_Writer->Delete( );
+
+  vtkPolyDataWriter* pdw = vtkPolyDataWriter::New( );
+  this->m_Writer = pdw;
+  pdw->SetInputData( i );
+  pdw->SetFileName( fname.c_str( ) );
+  pdw->Update( );
+  if( pdw->GetErrorCode( ) != 0 )
+    return( "MeshWriter: someting wrong happened." );
+  return( "" );
+}
+
+// eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/MeshWriter.h b/lib/cpPlugins/Plugins/MeshWriter.h
new file mode 100644 (file)
index 0000000..d0726ec
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef __CPPLUGINS__PLUGINS__MESHWRITER__H__
+#define __CPPLUGINS__PLUGINS__MESHWRITER__H__
+
+#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/Interface/MeshSink.h>
+
+class vtkDataWriter;
+
+namespace cpPlugins
+{
+  namespace Plugins
+  {
+    /**
+     */
+    class cpPlugins_EXPORT MeshWriter
+      : public cpPlugins::Interface::MeshSink
+    {
+    public:
+      typedef MeshWriter                      Self;
+      typedef cpPlugins::Interface::MeshSink  Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( MeshWriter, cpPluginsInterfaceMeshSink );
+
+    protected:
+      MeshWriter( );
+      virtual ~MeshWriter( );
+
+      virtual std::string _GenerateData( );
+
+    private:
+      // Purposely not implemented
+      MeshWriter( const Self& );
+      Self& operator=( const Self& );
+
+    protected:
+      vtkDataWriter* m_Writer;
+    };
+
+    // ---------------------------------------------------------------------
+    CPPLUGINS_INHERIT_PROVIDER( MeshWriter );
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__PLUGINS__MESHWRITER__H__
+
+// eof - $RCSfile$