]> Creatis software - cpPlugins.git/commitdiff
Widget integration (step 3/6). WARNING: IT DOES NOT COMPILE YET
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 3 Oct 2015 23:45:29 +0000 (01:45 +0200)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 3 Oct 2015 23:45:29 +0000 (01:45 +0200)
43 files changed:
appli/ImageMPR/ImageMPR.cxx
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpExtensions/Visualization/ImageSliceActors.h
lib/cpPlugins/Interface/BaseProcessObjects.cxx
lib/cpPlugins/Interface/BaseProcessObjects.h
lib/cpPlugins/Interface/CMakeLists.txt
lib/cpPlugins/Interface/DataObject.cxx
lib/cpPlugins/Interface/DataObject.h
lib/cpPlugins/Interface/DataObject.hxx [new file with mode: 0644]
lib/cpPlugins/Interface/Image.cxx
lib/cpPlugins/Interface/Image.h
lib/cpPlugins/Interface/Image.hxx
lib/cpPlugins/Interface/ImplicitFunction.cxx
lib/cpPlugins/Interface/ImplicitFunction.h
lib/cpPlugins/Interface/ImplicitFunction.hxx [deleted file]
lib/cpPlugins/Interface/Mesh.cxx
lib/cpPlugins/Interface/Mesh.h
lib/cpPlugins/Interface/Mesh.hxx
lib/cpPlugins/Interface/ParametersListWidget.cxx
lib/cpPlugins/Interface/ParametersListWidget.h
lib/cpPlugins/Interface/ParametersQtDialog.cxx
lib/cpPlugins/Interface/ParametersQtDialog.h
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/cpPlugins/Interface/ProcessObject.hxx
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
lib/cpPlugins/Plugins/BasicFilters/Cutter.h
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h
lib/cpPlugins/Plugins/IO/ImageReader.cxx
lib/cpPlugins/Plugins/IO/ImageWriter.cxx
lib/cpPlugins/Plugins/IO/MeshReader.cxx
lib/cpPlugins/Plugins/IO/MeshReader.h
lib/cpPlugins/Plugins/IO/MeshWriter.cxx
lib/cpPlugins/Plugins/IO/MeshWriter.h

index 7fffc2732df90c2864acef0691e53db90bc2e463..0100a138a5faadb54c3841b5c0fb0baa299c5435 100644 (file)
@@ -194,7 +194,8 @@ _ConfigureMeshActors( )
 {
   if( this->m_Mesh.IsNull( ) )
     return( "Valid mesh not found." );
-  
+
+  this->m_Mesh->CreateVTKActor( );
   vtkActor* vtk_actor = this->m_Mesh->GetVTKActor( );
   if( vtk_actor != NULL )
   {
@@ -216,8 +217,9 @@ _ConfigureMeshActors( )
     std::string lerr = this->m_Cutters[ i ]->Update( );
     if( lerr == "" )
     {
+      this->m_Cutters[ i ]->GetOutput< TPluginMesh >( 0 )->CreateVTKActor( );
       vtkActor* actor = this->m_Cutters[ i ]->GetOutput< TPluginMesh >( 0 )->GetVTKActor( );
-      mprActors->GetSliceActors( i )->AddActor( this->m_Cutters[ i ]->GetVTKAlgorithm( ), actor );
+      mprActors->GetSliceActors( i )->AddActor( this->m_Cutters[ i ]->GetVTK< vtkAlgorithm >( ), actor );
       if( i == 0 )
         this->m_MPRObjects->GetXRenderer( )->AddActor( actor );
       else if( i == 1 )
@@ -263,7 +265,7 @@ _triggered_actionOpenInputImage( )
   std::string err = this->_LoadImage( this->m_Image );
   if( err == "" )
   {
-    vtkImageData* vtk_id = this->m_Image->GetVTKImageData( );
+    vtkImageData* vtk_id = this->m_Image->GetVTK< vtkImageData >( );
     if( vtk_id != NULL )
     {
       this->m_MPRObjects->SetImage( vtk_id );
@@ -305,7 +307,7 @@ _triggered_actionOpenSegmentation( )
   std::string err = this->_LoadImage( this->m_Segmentation );
   if( err == "" )
   {
-    vtkImageData* vtk_id = this->m_Segmentation->GetVTKImageData( );
+    vtkImageData* vtk_id = this->m_Segmentation->GetVTK< vtkImageData >( );
     if( vtk_id != NULL )
     {
       this->m_MPRObjects->AddAuxiliaryImage( vtk_id );
@@ -413,7 +415,9 @@ _triggered_actionImageToImage( )
     result->DisconnectPipeline( );
     this->m_Image = result;
     if( this->m_Image.IsNotNull( ) )
-      this->m_MPRObjects->SetImage( this->m_Image->GetVTKImageData( ) );
+      this->m_MPRObjects->SetImage(
+        this->m_Image->GetVTK< vtkImageData >( )
+        );
   }
   else
     QMessageBox::critical(
index 31787e54fc66c9e7736ea37180e4adf19a2fa573..f945bd397eb6c6b885f61f5e234c2bdb44182c7e 100644 (file)
@@ -170,10 +170,17 @@ GetPlaneFunction( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 AddActor( vtkAlgorithm* algorithm, vtkActor* actor )
 {
-  this->OtherActors.push_back( std::pair< vtkSmartPointer< vtkAlgorithm >, vtkSmartPointer< vtkActor > >( algorithm, actor ) );
+  this->OtherActors.push_back( TActorPair( algorithm, actor ) );
   this->AddItem( actor );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+AddActor( vtkActor* actor )
+{
+  this->AddActor( NULL, actor );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 SetInterpolate( bool v )
@@ -376,12 +383,19 @@ SetSliceNumber( const int& slice )
   // Prepare other actors to update
   for( unsigned int i = 0; i < this->OtherActors.size( ); ++i )
   {
-#error CLEAN UP CODING STYLE AND NULL POINTER CHECK
+    if( this->OtherActors[ i ].first.GetPointer( ) != NULL )
+    {
+      this->OtherActors[ i ].first->Modified( );
+      this->OtherActors[ i ].first->Update( );
+
+    } // fi
+
+    if( this->OtherActors[ i ].second.GetPointer( ) != NULL )
+    {
+      this->OtherActors[ i ].second->GetMapper( )->Modified( );
+      this->OtherActors[ i ].second->Modified( );
 
-    this->OtherActors[ i ].first->Modified( );
-    this->OtherActors[ i ].first->Update( );
-    this->OtherActors[ i ].second->GetMapper( )->Modified( );
-    this->OtherActors[ i ].second->Modified( );
+    } // fi
 
   } // rof
 
index 091b7bcf89ce399cceabf473b48b6cac111fa671..8889b2f08d5986decaea77dbeef024e03c3cdc8b 100644 (file)
@@ -55,6 +55,7 @@ namespace cpExtensions
       const vtkPlane* GetPlaneFunction( ) const;
 
       void AddActor( vtkAlgorithm* algorithm, vtkActor* actor );
+      void AddActor( vtkActor* actor );
 
       void SetInterpolate( bool v );
       void InterpolateOn( );
@@ -86,7 +87,11 @@ namespace cpExtensions
       // Multiple actors
       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
-      std::vector< std::pair< vtkSmartPointer< vtkAlgorithm >, vtkSmartPointer< vtkActor > > >            OtherActors;
+
+      typedef
+      std::pair< vtkSmartPointer< vtkAlgorithm >, vtkSmartPointer< vtkActor > >
+      TActorPair;
+      std::vector< TActorPair > OtherActors;
       bool Interpolate;
 
       // Unique objects
index 004d9394679703a4d5902de982833103f494ba4a..8177b759457f266d7b93259cde9a37e4f3f6af31 100644 (file)
@@ -1,15 +1,15 @@
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
-cpPlugins_Interface_Code_ProcessObject( SourceObject );
-cpPlugins_Interface_Code_ProcessObject( SinkObject );
-cpPlugins_Interface_Code_ProcessObject( FilterObject );
-cpPlugins_Interface_Code_ProcessObject( ImageSource );
-cpPlugins_Interface_Code_ProcessObject( MeshSource );
-cpPlugins_Interface_Code_ProcessObject( ImageSink );
-cpPlugins_Interface_Code_ProcessObject( MeshSink );
-cpPlugins_Interface_Code_ProcessObject( ImageToImageFilter );
-cpPlugins_Interface_Code_ProcessObject( ImageToMeshFilter );
-cpPlugins_Interface_Code_ProcessObject( MeshToImageFilter );
-cpPlugins_Interface_Code_ProcessObject( MeshToMeshFilter );
+cpPlugins_Code_ProcessObject( SourceObject );
+cpPlugins_Code_ProcessObject( SinkObject );
+cpPlugins_Code_ProcessObject( FilterObject );
+cpPlugins_Code_ProcessObject( ImageSource );
+cpPlugins_Code_ProcessObject( MeshSource );
+cpPlugins_Code_ProcessObject( ImageSink );
+cpPlugins_Code_ProcessObject( MeshSink );
+cpPlugins_Code_ProcessObject( ImageToImageFilter );
+cpPlugins_Code_ProcessObject( ImageToMeshFilter );
+cpPlugins_Code_ProcessObject( MeshToImageFilter );
+cpPlugins_Code_ProcessObject( MeshToMeshFilter );
 
 // eof - $RCSfile$
index 04c29822b1b7afb3660d53ed0f00170477adaaca..d76d8b6a548f857af187d4bce61a8f993c84feed 100644 (file)
@@ -5,7 +5,7 @@
 #include <cpPlugins/Interface/ProcessObject.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Interface_Define_ProcessObject( O, S )        \
+#define cpPlugins_Define_ProcessObject( O, S )                  \
   class cpPlugins_Interface_EXPORT O                            \
     : public S                                                  \
   {                                                             \
@@ -25,7 +25,7 @@
   }
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Interface_Code_ProcessObject( O )     \
+#define cpPlugins_Code_ProcessObject( O )               \
   cpPlugins::Interface::O::O( ) : Superclass( )         \
   {                                                     \
     this->m_ClassName = "cpPlugins::Interface::#O";     \
   cpPlugins::Interface::O::~O( ) { }
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_Input_Demangle( T, D, I, O, r, f )      \
-  if( ( O = I->GetITKImage< itk::Image< T, D > >( ) ) != NULL ) \
-    r = this->f< itk::Image< T, D > >( O )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Input_Demangle( A, T, DP, DI, I, O, r, f ) \
-  if(                                                                   \
-    ( O = I->GetITKImage< itk::Image< A< T, DP >, DI > >( ) ) != NULL   \
-    )                                                                   \
-    r = this->f< itk::Image< A< T, DP >, DI > >( O )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes( D, I, O, r, f ) \
-  cpPlugins_Image_Input_Demangle( char, D, I, O, r, f );                \
-  else cpPlugins_Image_Input_Demangle( short, D, I, O, r, f );          \
-  else cpPlugins_Image_Input_Demangle( int, D, I, O, r, f );            \
-  else cpPlugins_Image_Input_Demangle( long, D, I, O, r, f );           \
-  else cpPlugins_Image_Input_Demangle( float, D, I, O, r, f );          \
-  else cpPlugins_Image_Input_Demangle( double, D, I, O, r, f );         \
-  else cpPlugins_Image_Input_Demangle( unsigned char, D, I, O, r, f );  \
-  else cpPlugins_Image_Input_Demangle( unsigned short, D, I, O, r, f ); \
-  else cpPlugins_Image_Input_Demangle( unsigned int, D, I, O, r, f );   \
-  else cpPlugins_Image_Input_Demangle( unsigned long, D, I, O, r, f )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_Input_Demangle_Dimension_AllTypes( D, I, O, r, f ) \
-  cpPlugins_Image_Input_Demangle( char, D, I, O, r, f );                \
-  else cpPlugins_Image_Input_Demangle( short, D, I, O, r, f );          \
-  else cpPlugins_Image_Input_Demangle( int, D, I, O, r, f );            \
-  else cpPlugins_Image_Input_Demangle( long, D, I, O, r, f );           \
-  else cpPlugins_Image_Input_Demangle( float, D, I, O, r, f );          \
-  else cpPlugins_Image_Input_Demangle( double, D, I, O, r, f );         \
-  else cpPlugins_Image_Input_Demangle( unsigned char, D, I, O, r, f );  \
-  else cpPlugins_Image_Input_Demangle( unsigned short, D, I, O, r, f ); \
-  else cpPlugins_Image_Input_Demangle( unsigned int, D, I, O, r, f );   \
-  else cpPlugins_Image_Input_Demangle( unsigned long, D, I, O, r, f );  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    std::complex< float >, D, I, O, r, f                                \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    std::complex< double >, D, I, O, r, f                               \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< char >, D, I, O, r, f                                \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< short >, D, I, O, r, f                               \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< int >, D, I, O, r, f                                 \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< long >, D, I, O, r, f                                \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< unsigned char >, D, I, O, r, f                       \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< unsigned short >, D, I, O, r, f                      \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< unsigned int >, D, I, O, r, f                        \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< unsigned long >, D, I, O, r, f                       \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< float >, D, I, O, r, f                               \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBPixel< double >, D, I, O, r, f                              \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< char >, D, I, O, r, f                               \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< short >, D, I, O, r, f                              \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< int >, D, I, O, r, f                                \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< long >, D, I, O, r, f                               \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< unsigned char >, D, I, O, r, f                      \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< unsigned short >, D, I, O, r, f                     \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< unsigned int >, D, I, O, r, f                       \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< unsigned long >, D, I, O, r, f                      \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< float >, D, I, O, r, f                              \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::RGBAPixel< double >, D, I, O, r, f                             \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    itk::Offset< D >, D, I, O, r, f                                     \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::Vector, float, D, D, I, O, r, f                                \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::Vector, double, D, D, I, O, r, f                               \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::Point, float, D, D, I, O, r, f                                 \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::Point, double, D, D, I, O, r, f                                \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::CovariantVector, float, D, D, I, O, r, f                       \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::CovariantVector, double, D, D, I, O, r, f                      \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::SymmetricSecondRankTensor, float, D, D, I, O, r, f             \
-    );                                                                  \
-  else cpPlugins_ImageArray_Input_Demangle(                             \
-    itk::SymmetricSecondRankTensor, double, D, D, I, O, r, f            \
-    )
+#define cpPlugins_Image_Demangle( T, D, I, O, R, F )            \
+  if( ( O = I->GetITK< itk::Image< T, D > >( ) ) != NULL )      \
+    R = this->F< itk::Image< T, D > >( O )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_Demangle( A, T, DI, DA, I, O, R, F )       \
+  if( ( O = I->GetITK< itk::Image< A< T, DA >, DI > >( ) ) != NULL )    \
+    R = this->F< itk::Image< A< T, DA >, DI > >( O )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Demangle( T, D, I, O, R, F )              \
+  if( ( O = I->GetITK< itk::VectorImage< T, D > >( ) ) != NULL )        \
+    R = this->F< itk::VectorImage< T, D > >( O )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayVectorImage_Demangle( A, T, DI, DA, I, O, R, F ) \
+  if( ( O = I->GetITK< itk::VectorImage< A< T, DA >, DI > >( ) ) != NULL ) \
+    R = this->F< itk::VectorImage< A< T, DA >, DI > >( O )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle_AllScalarTypes( D, I, O, R, F )        \
+  cpPlugins_Image_Demangle( char, D, I, O, R, F );                      \
+  else cpPlugins_Image_Demangle( short, D, I, O, R, F );                \
+  else cpPlugins_Image_Demangle( int, D, I, O, R, F );                  \
+  else cpPlugins_Image_Demangle( long, D, I, O, R, F );                 \
+  else cpPlugins_Image_Demangle( unsigned char, D, I, O, R, F );        \
+  else cpPlugins_Image_Demangle( unsigned short, D, I, O, R, F );       \
+  else cpPlugins_Image_Demangle( unsigned int, D, I, O, R, F );         \
+  else cpPlugins_Image_Demangle( unsigned long, D, I, O, R, F );        \
+  else cpPlugins_Image_Demangle( float, D, I, O, R, F );                \
+  else cpPlugins_Image_Demangle( double, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle_AllComplexTypes( D, I, O, R, F )       \
+  cpPlugins_Image_Demangle( std::complex< float >, D, I, O, R, F );     \
+  else cpPlugins_Image_Demangle( std::complex< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle_AllRGBTypes( D, I, O, R, F )           \
+  cpPlugins_Image_Demangle( itk::RGBPixel< char >, D, I, O, R, F );     \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< short >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< int >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< long >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< unsigned char >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< unsigned short >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< unsigned int >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< unsigned long >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< float >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBPixel< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle_AllRGBATypes( D, I, O, R, F )           \
+  cpPlugins_Image_Demangle( itk::RGBAPixel< char >, D, I, O, R, F );     \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< short >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< int >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< long >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< unsigned char >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< unsigned short >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< unsigned int >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< unsigned long >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< float >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::RGBAPixel< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle_AllDiffusionTensor3DTypes( D, I, O, R, F ) \
+  cpPlugins_Image_Demangle( itk::DiffusionTensor3D< float >, D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::DiffusionTensor3D< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_Demangle_AllVectorTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayImage_Demangle( itk::Vector, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayImage_Demangle( itk::Vector, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_Demangle_AllCovariantVectorTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayImage_Demangle( itk::CovariantVector, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayImage_Demangle( itk::CovariantVector, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_Demangle_AllPointTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayImage_Demangle( itk::Point, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayImage_Demangle( itk::Point, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_Demangle_AllSymmetricSecondRankTensorTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayImage_Demangle( itk::SymmetricSecondRankTensor, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayImage_Demangle( itk::SymmetricSecondRankTensor, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle_AllTypes( D, I, O, R, F )              \
+  cpPlugins_Image_Demangle_AllScalarTypes( D, I, O, R, F );             \
+  else cpPlugins_Image_Demangle_AllComplexTypes( D, I, O, R, F );       \
+  else cpPlugins_Image_Demangle_AllRGBTypes( D, I, O, R, F );           \
+  else cpPlugins_Image_Demangle_AllRGBATypes( D, I, O, R, F );          \
+  else cpPlugins_Image_Demangle_AllDiffusionTensor3DTypes( D, I, O, R, F ); \
+  else cpPlugins_Image_Demangle( itk::Offset< D >, D, I, O, R, F );     \
+  else cpPlugins_ArrayImage_Demangle_AllVectorTypes( D, D, I, O, R, F ); \
+  else cpPlugins_ArrayImage_Demangle_AllCovariantVectorTypes( D, D, I, O, R, F ); \
+  else cpPlugins_ArrayImage_Demangle_AllPointTypes( D, D, I, O, R, F ); \
+  else cpPlugins_ArrayImage_Demangle_AllSymmetricSecondRankTensorTypes( D, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Demangle_AllScalarTypes( D, I, O, R, F )  \
+  cpPlugins_VectorImage_Demangle( char, D, I, O, R, F );                \
+  else cpPlugins_VectorImage_Demangle( short, D, I, O, R, F );          \
+  else cpPlugins_VectorImage_Demangle( int, D, I, O, R, F );            \
+  else cpPlugins_VectorImage_Demangle( long, D, I, O, R, F );           \
+  else cpPlugins_VectorImage_Demangle( unsigned char, D, I, O, R, F );  \
+  else cpPlugins_VectorImage_Demangle( unsigned short, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( unsigned int, D, I, O, R, F );   \
+  else cpPlugins_VectorImage_Demangle( unsigned long, D, I, O, R, F );  \
+  else cpPlugins_VectorImage_Demangle( float, D, I, O, R, F );          \
+  else cpPlugins_VectorImage_Demangle( double, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Demangle_AllComplexTypes( D, I, O, R, F ) \
+  cpPlugins_VectorImage_Demangle( std::complex< float >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( std::complex< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Demangle_AllRGBTypes( D, I, O, R, F )     \
+  cpPlugins_VectorImage_Demangle( itk::RGBPixel< char >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< short >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< int >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< long >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< unsigned char >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< unsigned short >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< unsigned int >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< unsigned long >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< float >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBPixel< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Demangle_AllRGBATypes( D, I, O, R, F )    \
+  cpPlugins_VectorImage_Demangle( itk::RGBAPixel< char >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< short >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< int >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< long >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< unsigned char >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< unsigned short >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< unsigned int >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< unsigned long >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< float >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::RGBAPixel< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Demangle_AllDiffusionTensor3DTypes( D, I, O, R, F ) \
+  cpPlugins_VectorImage_Demangle( itk::DiffusionTensor3D< float >, D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::DiffusionTensor3D< double >, D, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayVectorImage_Demangle_AllVectorTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayVectorImage_Demangle( itk::Vector, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle( itk::Vector, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayVectorImage_Demangle_AllCovariantVectorTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayVectorImage_Demangle( itk::CovariantVector, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle( itk::CovariantVector, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayVectorImage_Demangle_AllPointTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayVectorImage_Demangle( itk::Point, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle( itk::Point, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayVectorImage_Demangle_AllSymmetricSecondRankTensorTypes( DI, DA, I, O, R, F ) \
+  cpPlugins_ArrayVectorImage_Demangle( itk::SymmetricSecondRankTensor, float, DI, DA, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle( itk::SymmetricSecondRankTensor, double, DI, DA, I, O, R, F )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Demangle_AllTypes( D, I, O, R, F )        \
+  cpPlugins_VectorImage_Demangle_AllScalarTypes( D, I, O, R, F );       \
+  else cpPlugins_VectorImage_Demangle_AllComplexTypes( D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle_AllRGBTypes( D, I, O, R, F );     \
+  else cpPlugins_VectorImage_Demangle_AllRGBATypes( D, I, O, R, F );    \
+  else cpPlugins_VectorImage_Demangle_AllDiffusionTensor3DTypes( D, I, O, R, F ); \
+  else cpPlugins_VectorImage_Demangle( itk::Offset< D >, D, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle_AllVectorTypes( D, D, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle_AllCovariantVectorTypes( D, D, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle_AllPointTypes( D, D, I, O, R, F ); \
+  else cpPlugins_ArrayVectorImage_Demangle_AllSymmetricSecondRankTensorTypes( D, D, I, O, R, F )
 
 namespace cpPlugins
 {
   namespace Interface
   {
-    cpPlugins_Interface_Define_ProcessObject( SourceObject, ProcessObject );
-    cpPlugins_Interface_Define_ProcessObject( SinkObject, ProcessObject );
-    cpPlugins_Interface_Define_ProcessObject( FilterObject, ProcessObject );
-    cpPlugins_Interface_Define_ProcessObject( ImageSource, SourceObject );
-    cpPlugins_Interface_Define_ProcessObject( MeshSource, SourceObject );
-    cpPlugins_Interface_Define_ProcessObject( ImageSink, SinkObject );
-    cpPlugins_Interface_Define_ProcessObject( MeshSink, SinkObject );
-    cpPlugins_Interface_Define_ProcessObject(
-      ImageToImageFilter, FilterObject
-      );
-    cpPlugins_Interface_Define_ProcessObject(
-      ImageToMeshFilter, FilterObject
-      );
-    cpPlugins_Interface_Define_ProcessObject(
-      MeshToImageFilter, FilterObject
-      );
-    cpPlugins_Interface_Define_ProcessObject(
-      MeshToMeshFilter, FilterObject
-      );
+    cpPlugins_Define_ProcessObject( SourceObject, ProcessObject );
+    cpPlugins_Define_ProcessObject( SinkObject, ProcessObject );
+    cpPlugins_Define_ProcessObject( FilterObject, ProcessObject );
+    cpPlugins_Define_ProcessObject( ImageSource, SourceObject );
+    cpPlugins_Define_ProcessObject( MeshSource, SourceObject );
+    cpPlugins_Define_ProcessObject( ImageSink, SinkObject );
+    cpPlugins_Define_ProcessObject( MeshSink, SinkObject );
+    cpPlugins_Define_ProcessObject( ImageToImageFilter, FilterObject );
+    cpPlugins_Define_ProcessObject( ImageToMeshFilter, FilterObject );
+    cpPlugins_Define_ProcessObject( MeshToImageFilter, FilterObject );
+    cpPlugins_Define_ProcessObject( MeshToMeshFilter, FilterObject );
 
   } // ecapseman
 
index 8ee622177e320c774d787591844a42170ef01ad2..a607fcad7fe3dd540ba3d786003df446c8a2c2bc 100644 (file)
@@ -10,68 +10,14 @@ CONFIGURE_FILE(
 ## = Source code =
 ## ===============
 
-SET(
-  LIB_HEADERS_H
-  BaseProcessObjects.h
-  DataObject.h
-  Image.h
-  ImplicitFunction.h
-  Interface.h
-  Macros.h
-  Mesh.h
-  Object.h
-  Parameters.h
-  ProcessObject.h
-  )
-
-SET(
-  LIB_HEADERS_HPP
-  )
-
-SET(
-  LIB_HEADERS_HXX
-  Image.hxx
-  ImplicitFunction.hxx
-  Mesh.hxx
-  Parameters.hxx
-  ProcessObject.hxx
-  )
-
-SET(
-  LIB_SOURCES_C
-  )
-SET(
-  LIB_SOURCES_CPP
-  )
-
-SET(
-  LIB_SOURCES_CXX
-  Instances_itkImage.cxx
-  Instances_itkVectorImage.cxx
-  Instances_itkMesh.cxx
-  BaseProcessObjects.cxx
-  DataObject.cxx
-  Image.cxx
-  ImplicitFunction.cxx
-  Interface.cxx
-  Mesh.cxx
-  Object.cxx
-  Parameters.cxx
-  ProcessObject.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")
 
 IF(USE_QT4)
-  SET(
-    LIB_HEADERS_H
-    ${LIB_HEADERS_H}
-    ParametersQtDialog.h
-    )
-  SET(
-    LIB_SOURCES_CXX
-    ${LIB_SOURCES_CXX}
-    ParametersQtDialog.cxx
-    )
-
   SET(
     LIB_QT_UI
     ParametersListWidget.ui
index d68d2b7769148b53f44995ec37f5dbf5df35fd46..536ea811fdeb90c8b124a199f71bdb908a1981d2 100644 (file)
@@ -1,4 +1,6 @@
 #include <cpPlugins/Interface/DataObject.h>
+
+#include <itkDataObject.h>
 #include <vtkImageData.h>
 #include <vtkPolyData.h>
 
@@ -32,29 +34,27 @@ SetSource( cpPlugins::Interface::Object* src )
 void cpPlugins::Interface::DataObject::
 DisconnectPipeline( )
 {
-  if( this->m_ITKObject.IsNotNull( ) )
-  {
-    // 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;
+  // Disconnect input pipelines (ITK)
+  itk::DataObject* itk_obj = this->GetITK< itk::DataObject >( );
+  if( itk_obj != NULL )
+    itk_obj->DisconnectPipeline( );
 
-    } // fi
+  // Disconnect input pipelines (VTK)
+  vtkImageData* vtk_image = this->GetVTK< vtkImageData >( );
+  vtkPolyData* vtk_pd = this->GetVTK< vtkPolyData >( );
+  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
 
index aad997708c5a8df08947efb2065d76f2e1be2e06..3347b64d1ad4312784056b01bb1b838a5239f10e 100644 (file)
@@ -1,14 +1,13 @@
 #ifndef __CPPLUGINS__INTERFACE__DATAOBJECT__H__
 #define __CPPLUGINS__INTERFACE__DATAOBJECT__H__
 
-#include <map>
-#include <string>
-#include <vtkObject.h>
-#include <vtkSmartPointer.h>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Object.h>
 
-#include <itkDataObject.h>
+#include <itkObject.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkObject.h>
 
 namespace cpPlugins
 {
@@ -35,6 +34,18 @@ namespace cpPlugins
 
       void DisconnectPipeline( );
 
+      template< class T >
+        inline T* GetITK( );
+
+      template< class T >
+        inline const T* GetITK( ) const;
+
+      template< class T >
+        inline T* GetVTK( );
+
+      template< class T >
+        inline const T* GetVTK( ) const;
+
     protected:
       DataObject( );
       virtual ~DataObject( );
@@ -45,7 +56,7 @@ namespace cpPlugins
       Self& operator=( const Self& );
 
     protected:
-      itk::DataObject::Pointer     m_ITKObject;
+      itk::Object::Pointer         m_ITKObject;
       vtkSmartPointer< vtkObject > m_VTKObject;
       Object::Pointer              m_Source;
     };
@@ -54,6 +65,8 @@ namespace cpPlugins
 
 } // ecapseman
 
+#include <cpPlugins/Interface/DataObject.hxx>
+
 #endif // __CPPLUGINS__INTERFACE__DATAOBJECT__H__
 
 // eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/DataObject.hxx b/lib/cpPlugins/Interface/DataObject.hxx
new file mode 100644 (file)
index 0000000..a7e6c63
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef __CPPLUGINS__INTERFACE__DATAOBJECT__HXX__
+#define __CPPLUGINS__INTERFACE__DATAOBJECT__HXX__
+
+// -------------------------------------------------------------------------
+template< class T >
+T* cpPlugins::Interface::DataObject::
+GetITK( )
+{
+  return( dynamic_cast< T* >( this->m_ITKObject.GetPointer( ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class T >
+const T* cpPlugins::Interface::DataObject::
+GetITK( ) const
+{
+  return( dynamic_cast< const T* >( this->m_ITKObject.GetPointer( ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class T >
+T* cpPlugins::Interface::DataObject::
+GetVTK( )
+{
+  return( dynamic_cast< T* >( this->m_VTKObject.GetPointer( ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class T >
+const T* cpPlugins::Interface::DataObject::
+GetVTK( ) const
+{
+  return( dynamic_cast< const T* >( this->m_VTKObject.GetPointer( ) ) );
+}
+
+#endif // __CPPLUGINS__INTERFACE__DATAOBJECT__HXX__
+
+// eof - $RCSfile$
index b0d18b001a0557da7a391fd2f7f2f2d992cbf878..ad7b3ad19f02a8e053d01cba32e41bcd08387893 100644 (file)
 #include <cpPlugins/Interface/Image.h>
 
-/* TODO
-   #include <complex>
-   #include <vtkImageData.h>
-
-   #define ITK_MANUAL_INSTANTIATION
-   #include <itkImage.h>
-   #include <itkImageToVTKImageFilter.h>
-
-   #include <itkCovariantVector.h>
-   #include <itkDiffusionTensor3D.h>
-   #include <itkPoint.h>
-   #include <itkRGBPixel.h>
-   #include <itkRGBAPixel.h>
-   #include <itkSymmetricSecondRankTensor.h>
-   #include <itkVector.h>
-*/
-
-// -------------------------------------------------------------------------
-/* TODO
-   void cpPlugins::Interface::Image::
-   SetITKDataObject( itk::DataObject* o )
-   {
-   bool r;
-   if( dynamic_cast< itk::ImageBase< 1 >* >( o ) != NULL )
-   {
-   cpPlugins_Image_Array_Demangle(
-   itk::Vector, float, 1, 1, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Vector, double, 1, 1, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Point, float, 1, 1, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Point, double, 1, 1, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::CovariantVector, float, 1, 1, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::CovariantVector, double, 1, 1, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::SymmetricSecondRankTensor, float, 1, 1, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::SymmetricSecondRankTensor, double, 1, 1, o, _Type, r
-   );
-   else r = this->_Dim< 1 >( o );
-   }
-   else if( dynamic_cast< itk::ImageBase< 2 >* >( o ) != NULL )
-   {
-   cpPlugins_Image_Demangle(
-   itk::RGBPixel< char >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBPixel< short >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBPixel< unsigned char >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBPixel< unsigned short >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< char >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< short >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< unsigned char >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< unsigned short >, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Vector, float, 2, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Vector, double, 2, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Point, float, 2, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Point, double, 2, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::CovariantVector, float, 2, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::CovariantVector, double, 2, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::SymmetricSecondRankTensor, float, 2, 2, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::SymmetricSecondRankTensor, double, 2, 2, o, _Type, r
-   );
-   else r = this->_Dim< 2 >( o );
-   }
-   else if( dynamic_cast< itk::ImageBase< 3 >* >( o ) != NULL )
-   {
-   cpPlugins_Image_Demangle(
-   itk::RGBPixel< char >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBPixel< short >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBPixel< unsigned char >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBPixel< unsigned short >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< char >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< short >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< unsigned char >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::RGBAPixel< unsigned short >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Vector, float, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Vector, double, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Point, float, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::Point, double, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::CovariantVector, float, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::CovariantVector, double, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::SymmetricSecondRankTensor, float, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Array_Demangle(
-   itk::SymmetricSecondRankTensor, double, 3, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::DiffusionTensor3D< float >, 3, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   itk::DiffusionTensor3D< double >, 3, o, _Type, r
-   );
-   else r = this->_Dim< 3 >( o );
-   }
-   else if( dynamic_cast< itk::ImageBase< 4 >* >( o ) != NULL )
-   {
-   this->m_ITKObject = o;
-   this->m_VTKObject = NULL;
-   this->m_ITKvVTKConnection = NULL;
-
-   } // fi
-   }
-*/
-
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Image::
-SetVTKImageData( vtkImageData* image )
+SetVTK( vtkObject* image )
 {
   // this->m_VTKObject = image;
   std::cerr << "Image: TODO this!!!!" << std::endl;
   std::exit( 1 );
 }
 
-// -------------------------------------------------------------------------
-vtkImageData* cpPlugins::Interface::Image::
-GetVTKImageData( )
-{
-  return(
-    dynamic_cast< vtkImageData* >( this->m_VTKObject.GetPointer( ) )
-    );
-}
-
-// -------------------------------------------------------------------------
-const vtkImageData* cpPlugins::Interface::Image::
-GetVTKImageData( ) const
-{
-  return(
-    dynamic_cast< const vtkImageData* >( this->m_VTKObject.GetPointer( ) )
-    );
-}
-
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Image::
 Image( )
@@ -213,70 +24,4 @@ cpPlugins::Interface::Image::
 {
 }
 
-// -------------------------------------------------------------------------
-/* TODO
-   template< unsigned int D >
-   bool cpPlugins::Interface::Image::
-   _Dim( itk::DataObject* o )
-   {
-   bool r;
-   cpPlugins_Image_Demangle(
-   char, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   short, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   int, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   long, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   unsigned char, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   unsigned short, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   unsigned int, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   unsigned long, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   float, D, o, _Type, r
-   );
-   else cpPlugins_Image_Demangle(
-   double, D, o, _Type, r
-   );
-   else
-   {
-   this->m_ITKObject = o;
-   this->m_VTKObject = NULL;
-   this->m_ITKvVTKConnection = NULL;
-
-   } // fi
-   return( true );
-   }
-
-   // -------------------------------------------------------------------------
-   template< class I >
-   bool cpPlugins::Interface::Image::
-   _Type( itk::DataObject* o )
-   {
-   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;
-
-   return( true );
-   }
-*/
-
 // eof - $RCSfile$
index a5beda39b58b59c7e3424a435f1cdbb9c1cafb7a..5d0d55b6807497ed2ad9b0a2893b885287d0b6ee 100644 (file)
@@ -30,24 +30,16 @@ namespace cpPlugins
 
     public:
       template< class I >
-        inline void SetITKImage( itk::DataObject* object );
+        inline void SetITK( itk::Object* object );
 
-      template< class I >
-        inline I* GetITKImage( );
-
-      template< class I >
-        inline const I* GetITKImage( ) const;
-
-      virtual void SetVTKImageData( vtkImageData* image );
-      virtual vtkImageData* GetVTKImageData( );
-      virtual const vtkImageData* GetVTKImageData( ) const;
+      virtual void SetVTK( vtkObject* image );
 
     protected:
       Image( );
       virtual ~Image( );
 
       template< class P, unsigned int D >
-        inline void _ITK_2_VTK( itk::DataObject* object );
+        inline void _ITK_2_VTK( itk::Object* object );
 
     private:
       // Purposely not implemented
index b6794a36bcdb1d3bc582db225ab6d2f8f6481dee..2f5f1d59a5071adee381adc82ef18361ad95d9fd 100644 (file)
@@ -3,7 +3,10 @@
 
 #include <cpPlugins/Interface/Macros.h>
 
+#include <complex>
+
 #include <itkImage.h>
+#include <itkVectorImage.h>
 #include <itkImageToVTKImageFilter.h>
 
 #include <itkCovariantVector.h>
 #include <itkVector.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_Demangle( TI, T, D, o )                 \
-  if( typeid( typename TI::PixelType ) == typeid( T ) )         \
+#define cpPlugins_VTKImage_Demangle( TI, T, D, o )              \
+  if( typeid( TI ) == typeid( itk::Image< T, D > ) )            \
     this->_ITK_2_VTK< T, D >( o )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Demangle( TI, T, P, DP, DI, o )           \
-  if( typeid( typename TI::PixelType ) == typeid( T< P, DP > ) )       \
+#define cpPlugins_VTKImageArray_Demangle( TI, T, P, DP, DI, o )      \
+  if( typeid( TI ) == typeid( itk::Image< T< P, DP >, DI > ) )       \
     this->_ITK_2_VTK< T< P, DP >, DI >( o )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_Demangle_Dimension( TI, D, o )                  \
-  cpPlugins_Image_Demangle( TI, char, D, o );                           \
-  else cpPlugins_Image_Demangle( TI, short, D, o );                     \
-  else cpPlugins_Image_Demangle( TI, int, D, o );                       \
-  else cpPlugins_Image_Demangle( TI, long, D, o );                      \
-  else cpPlugins_Image_Demangle( TI, float, D, o );                     \
-  else cpPlugins_Image_Demangle( TI, double, D, o );                    \
-  else cpPlugins_Image_Demangle( TI, unsigned char, D, o );             \
-  else cpPlugins_Image_Demangle( TI, unsigned short, D, o );            \
-  else cpPlugins_Image_Demangle( TI, unsigned int, D, o );              \
-  else cpPlugins_Image_Demangle( TI, unsigned long, D, o );             \
-  else cpPlugins_Image_Demangle( TI, itk::RGBPixel< char >, D, o );     \
-  else cpPlugins_Image_Demangle( TI, itk::RGBPixel< short >, D, o );    \
-  else cpPlugins_Image_Demangle(                                        \
-    TI, itk::RGBPixel< unsigned char >, D, o                            \
-    );                                                                  \
-  else cpPlugins_Image_Demangle(                                        \
-    TI, itk::RGBPixel< unsigned short >, D, o                           \
-    );                                                                  \
-  else cpPlugins_Image_Demangle( TI, itk::RGBAPixel< char >, D, o );    \
-  else cpPlugins_Image_Demangle( TI, itk::RGBAPixel< short >, D, o );   \
-  else cpPlugins_Image_Demangle(                                        \
-    TI, itk::RGBAPixel< unsigned char >, D, o                           \
-    );                                                                  \
-  else cpPlugins_Image_Demangle(                                        \
-    TI, itk::RGBAPixel< unsigned short >, D, o                          \
-    );                                                                  \
-  else cpPlugins_ImageArray_Demangle(                                   \
-    TI, itk::Vector, float, D, D, o                                     \
-    );                                                                  \
-  else cpPlugins_ImageArray_Demangle(                                   \
-    TI, itk::Vector, double, D, D, o                                    \
-    );                                                                  \
-  else cpPlugins_ImageArray_Demangle(                                   \
-    TI, itk::CovariantVector, float, D, D, o                            \
-    );                                                                  \
-  else cpPlugins_ImageArray_Demangle(                                   \
-    TI, itk::CovariantVector, double, D, D, o                           \
-    );                                                                  \
-  else cpPlugins_ImageArray_Demangle( TI, itk::Point, float, D, D, o ); \
-  else cpPlugins_ImageArray_Demangle(                                   \
-    TI, itk::Point, double, D, D, o                                     \
-    );                                                                  \
-  else cpPlugins_ImageArray_Demangle(                                   \
-    TI, itk::SymmetricSecondRankTensor, float, D, D, o                  \
-    );                                                                  \
-  else cpPlugins_ImageArray_Demangle(                                   \
-    TI, itk::SymmetricSecondRankTensor, double, D, D, o                 \
-    )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_Import( T, D )                                  \
-  cpPlugins_TEMPLATE_IMPORT(                                            \
-    2(class cpPlugins_Interface_EXPORT itk::Image< T, D >)              \
-    )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Import( T, D )                               \
-  cpPlugins_TEMPLATE_IMPORT(                                            \
-    2(                                                                  \
-      class cpPlugins_Interface_EXPORT                                  \
-      itk::ImageToVTKImageFilter< itk::Image< T, D > >                  \
-      )                                                                 \
-    )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Import( A, T, DA, DI )                     \
-  cpPlugins_TEMPLATE_IMPORT(                                            \
-    3(                                                                  \
-      class cpPlugins_Interface_EXPORT                                  \
-      itk::Image< itk::A< T, DA >, DI >                                 \
-      )                                                                 \
-    )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Import( A, T, DA, DI )                  \
-  cpPlugins_TEMPLATE_IMPORT(                                            \
-    3(                                                                  \
-      class cpPlugins_Interface_EXPORT                                  \
-      itk::ImageToVTKImageFilter< itk::Image< itk::A< T, DA >, DI > >   \
-      )                                                                 \
-    )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_Import_AllDimensions( T )       \
-  cpPlugins_Image_Import( T, 2 );                       \
-  cpPlugins_Image_Import( T, 3 );                       \
-  cpPlugins_Image_Import( T, 4 )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Import_AllDimensions( T )       \
-  cpPlugins_VTKImage_Import( T, 2 );                       \
-  cpPlugins_VTKImage_Import( T, 3 )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Import_AllDimensions( A, T )             \
-  cpPlugins_ImageArray_Import( A, T, 2, 2 );                          \
-  cpPlugins_ImageArray_Import( A, T, 3, 3 );                          \
-  cpPlugins_ImageArray_Import( A, T, 4, 4 )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Import_AllDimensions( A, T )            \
-  cpPlugins_VTKImageArray_Import( A, T, 2, 2 );                         \
-  cpPlugins_VTKImageArray_Import( A, T, 3, 3 )
-
-// -------------------------------------------------------------------------
-// ITK base clases
-
-#ifndef cpPlugins_Interface_EXPORTS
-
-cpPlugins_Image_Import_AllDimensions( char );
-cpPlugins_Image_Import_AllDimensions( short );
-cpPlugins_Image_Import_AllDimensions( int );
-cpPlugins_Image_Import_AllDimensions( long );
-cpPlugins_Image_Import_AllDimensions( unsigned char );
-cpPlugins_Image_Import_AllDimensions( unsigned short );
-cpPlugins_Image_Import_AllDimensions( unsigned int );
-cpPlugins_Image_Import_AllDimensions( unsigned long );
-cpPlugins_Image_Import_AllDimensions( float );
-cpPlugins_Image_Import_AllDimensions( double );
-
-cpPlugins_Image_Import_AllDimensions( std::complex< float > );
-cpPlugins_Image_Import_AllDimensions( std::complex< double > );
-
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< char > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< short > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< int > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< long > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< unsigned char > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< unsigned short > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< unsigned int > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBPixel< unsigned long > );
-
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< char > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< short > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< int > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< long > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< unsigned char > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< unsigned short > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< unsigned int > );
-cpPlugins_Image_Import_AllDimensions( itk::RGBAPixel< unsigned long > );
-
-cpPlugins_ImageArray_Import_AllDimensions( Vector, float );
-cpPlugins_ImageArray_Import_AllDimensions( Vector, double );
-
-cpPlugins_ImageArray_Import_AllDimensions( CovariantVector, float );
-cpPlugins_ImageArray_Import_AllDimensions( CovariantVector, double );
-
-cpPlugins_ImageArray_Import_AllDimensions( Point, float );
-cpPlugins_ImageArray_Import_AllDimensions( Point, double );
-
-cpPlugins_ImageArray_Import_AllDimensions(
-  SymmetricSecondRankTensor, float
-  );
-cpPlugins_ImageArray_Import_AllDimensions(
-  SymmetricSecondRankTensor, double
-  );
-
-cpPlugins_Image_Import( itk::DiffusionTensor3D< float >, 3 );
-cpPlugins_Image_Import( itk::DiffusionTensor3D< double >, 3 );
-cpPlugins_Image_Import( itk::Offset< 2 >, 2 );
-cpPlugins_Image_Import( itk::Offset< 3 >, 3 );
-cpPlugins_Image_Import( itk::Offset< 4 >, 4 );
+#define cpPlugins_VTKImage_Demangle_AllDims( TI, T, o )         \
+  cpPlugins_VTKImage_Demangle( TI, T, 2, o );                   \
+  else cpPlugins_VTKImage_Demangle( TI, T, 3, o )
 
 // -------------------------------------------------------------------------
-// ITK<->VTK base clases
-cpPlugins_VTKImage_Import_AllDimensions( char );
-cpPlugins_VTKImage_Import_AllDimensions( short );
-cpPlugins_VTKImage_Import_AllDimensions( int );
-cpPlugins_VTKImage_Import_AllDimensions( long );
-cpPlugins_VTKImage_Import_AllDimensions( unsigned char );
-cpPlugins_VTKImage_Import_AllDimensions( unsigned short );
-cpPlugins_VTKImage_Import_AllDimensions( unsigned int );
-cpPlugins_VTKImage_Import_AllDimensions( unsigned long );
-cpPlugins_VTKImage_Import_AllDimensions( float );
-cpPlugins_VTKImage_Import_AllDimensions( double );
-
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< char > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< short > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< int > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< long > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< unsigned char > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< unsigned short > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< unsigned int > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< unsigned long > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< float > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< double > );
-
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< char > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< short > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< int > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< long > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< unsigned char > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< unsigned short > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< unsigned int > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< unsigned long > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< float > );
-cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< double > );
-
-cpPlugins_VTKImageArray_Import_AllDimensions( Vector, float );
-cpPlugins_VTKImageArray_Import_AllDimensions( Vector, double );
-
-cpPlugins_VTKImageArray_Import_AllDimensions( CovariantVector, float );
-cpPlugins_VTKImageArray_Import_AllDimensions( CovariantVector, double );
-
-cpPlugins_VTKImageArray_Import_AllDimensions( Point, float );
-cpPlugins_VTKImageArray_Import_AllDimensions( Point, double );
-
-cpPlugins_VTKImageArray_Import_AllDimensions(
-  SymmetricSecondRankTensor, float
-  );
-cpPlugins_VTKImageArray_Import_AllDimensions(
-  SymmetricSecondRankTensor, double
-  );
-
-cpPlugins_VTKImage_Import( itk::DiffusionTensor3D< float >, 3 );
-cpPlugins_VTKImage_Import( itk::DiffusionTensor3D< double >, 3 );
-
-#endif // cpPlugins_Interface_EXPORTS
+#define cpPlugins_VTKImageArray_Demangle_AllDims( TI, T, P, o )      \
+  cpPlugins_VTKImageArray_Demangle( TI, T, P, 2, 2, o );             \
+  else cpPlugins_VTKImageArray_Demangle( TI, T, P, 3, 3, o )
 
 // -------------------------------------------------------------------------
 template< class I >
 void cpPlugins::Interface::Image::
-SetITKImage( itk::DataObject* object )
+SetITK( itk::Object* object )
 {
   // Check if input object has the desired type
   I* image = dynamic_cast< I* >( object );
@@ -262,32 +54,46 @@ SetITKImage( itk::DataObject* object )
   } // fi
 
   // Connect it to VTK
-  if( I::ImageDimension == 2 )
-  {
-    cpPlugins_Image_Demangle_Dimension( I, 2, object );
-    else
-    {
-      this->m_VTKObject = NULL;
-      this->m_ITKvVTKConnection = NULL;
-
-    } // fi
-  }
-  else if( I::ImageDimension == 3 )
-  {
-    cpPlugins_Image_Demangle_Dimension( I, 3, object );
-    else cpPlugins_Image_Demangle(
-      I, itk::DiffusionTensor3D< float >, 3, object
-      );
-    else cpPlugins_Image_Demangle(
-      I, itk::DiffusionTensor3D< double >, 3, object
-      );
-    else
-    {
-      this->m_VTKObject = NULL;
-      this->m_ITKvVTKConnection = NULL;
-
-    } // fi
-  }
+  cpPlugins_VTKImage_Demangle_AllDims( I, char, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, short, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, int, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, long, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned char, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned short, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned int, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned long, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, float, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, double, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< char >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< short >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< int >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< long >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned char >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned short >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned int >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned long >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< float >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< double >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< char >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< short >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< int >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< long >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned char >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned short >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned int >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned long >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< float >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< double >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::DiffusionTensor3D< float >, image );
+  else cpPlugins_VTKImage_Demangle_AllDims( I, itk::DiffusionTensor3D< double >, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Vector, float, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Vector, double, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::CovariantVector, float, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::CovariantVector, double, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Point, float, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Point, double, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::SymmetricSecondRankTensor, float, image );
+  else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::SymmetricSecondRankTensor, double, image );
   else
   {
     this->m_VTKObject = NULL;
@@ -300,26 +106,10 @@ SetITKImage( itk::DataObject* object )
   this->Modified( );
 }
 
-// -------------------------------------------------------------------------
-template< class I >
-I* cpPlugins::Interface::Image::
-GetITKImage( )
-{
-  return( dynamic_cast< I* >( this->m_ITKObject.GetPointer( ) ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I >
-const I* cpPlugins::Interface::Image::
-GetITKImage( ) const
-{
-  return( dynamic_cast< const I* >( this->m_ITKObject.GetPointer( ) ) );
-}
-
 // -------------------------------------------------------------------------
 template< class P, unsigned int D >
 void cpPlugins::Interface::Image::
-_ITK_2_VTK( itk::DataObject* object )
+_ITK_2_VTK( itk::Object* object )
 {
   typedef itk::Image< P, D > _I;
 
@@ -339,6 +129,236 @@ _ITK_2_VTK( itk::DataObject* object )
   this->m_ITKvVTKConnection = f;
 }
 
+#ifndef cpPlugins_Interface_EXPORTS
+
+// =========================================================================
+// ==========           Declare import itk::Image types           ==========
+// =========================================================================
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ITKImage_Import( T, D )                       \
+  cpPlugins_TEMPLATE_IMPORT(                                    \
+    2(class cpPlugins_Interface_EXPORT itk::Image< T, D >)      \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ITKArrayImage_Import( A, T, DA, DI )                  \
+  cpPlugins_TEMPLATE_IMPORT(                                            \
+    3(class cpPlugins_Interface_EXPORT itk::Image< A< T, DA >, DI >)    \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ITKImage_AllDims_Import( T )  \
+  cpPlugins_ITKImage_Import( T, 2 );            \
+  cpPlugins_ITKImage_Import( T, 3 );            \
+  cpPlugins_ITKImage_Import( T, 4 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ITKArrayImage_AllDims_Import( A, T )  \
+  cpPlugins_ITKArrayImage_Import( A, T, 2, 2 );         \
+  cpPlugins_ITKArrayImage_Import( A, T, 3, 3 );         \
+  cpPlugins_ITKArrayImage_Import( A, T, 4, 4 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VTKImage_Import( T, D )               \
+  cpPlugins_TEMPLATE_IMPORT(                            \
+    2(                                                  \
+      class cpPlugins_Interface_EXPORT                  \
+      itk::ImageToVTKImageFilter< itk::Image< T, D > >  \
+      )                                                 \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VTKArrayImage_Import( A, T, DA, DI )                  \
+  cpPlugins_TEMPLATE_IMPORT(                                            \
+    3(class                                                             \
+      cpPlugins_Interface_EXPORT                                        \
+      itk::ImageToVTKImageFilter< itk::Image< A< T, DA >, DI > >)       \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VTKImage_AllDims_Import( T )  \
+  cpPlugins_VTKImage_Import( T, 2 );            \
+  cpPlugins_VTKImage_Import( T, 3 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VTKArrayImage_AllDims_Import( A, T )  \
+  cpPlugins_VTKArrayImage_Import( A, T, 2, 2 );         \
+  cpPlugins_VTKArrayImage_Import( A, T, 3, 3 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Import( T, D )          \
+  cpPlugins_ITKImage_Import( T, D );            \
+  cpPlugins_VTKImage_Import( T, D )             \
+  
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_AllDims_Import( T )     \
+  cpPlugins_ITKImage_AllDims_Import( T );       \
+  cpPlugins_VTKImage_AllDims_Import( T )        \
+  
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_AllDims_Import( A, T )     \
+  cpPlugins_ITKArrayImage_AllDims_Import( A, T );       \
+  cpPlugins_VTKArrayImage_AllDims_Import( A, T )        \
+  
+// -------------------------------------------------------------------------
+// ITK-VTK base clases
+// -------------------------------------------------------------------------
+
+cpPlugins_Image_AllDims_Import( char );
+cpPlugins_Image_AllDims_Import( short );
+cpPlugins_Image_AllDims_Import( int );
+cpPlugins_Image_AllDims_Import( long );
+cpPlugins_Image_AllDims_Import( unsigned char );
+cpPlugins_Image_AllDims_Import( unsigned short );
+cpPlugins_Image_AllDims_Import( unsigned int );
+cpPlugins_Image_AllDims_Import( unsigned long );
+cpPlugins_Image_AllDims_Import( float );
+cpPlugins_Image_AllDims_Import( double );
+
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< char > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< short > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< int > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< long > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< unsigned char > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< unsigned short > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< unsigned int > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< unsigned long > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< float > );
+cpPlugins_Image_AllDims_Import( itk::RGBPixel< double > );
+
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< char > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< short > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< int > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< long > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< unsigned char > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< unsigned short > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< unsigned int > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< unsigned long > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< float > );
+cpPlugins_Image_AllDims_Import( itk::RGBAPixel< double > );
+
+cpPlugins_Image_AllDims_Import( itk::DiffusionTensor3D< float > );
+cpPlugins_Image_AllDims_Import( itk::DiffusionTensor3D< double > );
+
+cpPlugins_ArrayImage_AllDims_Import( itk::Vector, float );
+cpPlugins_ArrayImage_AllDims_Import( itk::Vector, double );
+
+cpPlugins_ArrayImage_AllDims_Import( itk::CovariantVector, float );
+cpPlugins_ArrayImage_AllDims_Import( itk::CovariantVector, double );
+
+cpPlugins_ArrayImage_AllDims_Import( itk::Point, float );
+cpPlugins_ArrayImage_AllDims_Import( itk::Point, double );
+
+cpPlugins_ArrayImage_AllDims_Import( itk::SymmetricSecondRankTensor, float );
+cpPlugins_ArrayImage_AllDims_Import( itk::SymmetricSecondRankTensor, double );
+
+// -------------------------------------------------------------------------
+// ITK-only base clases
+// -------------------------------------------------------------------------
+
+cpPlugins_ITKImage_AllDims_Import( std::complex< float > );
+cpPlugins_ITKImage_AllDims_Import( std::complex< double > );
+
+cpPlugins_ITKImage_Import( itk::Offset< 2 >, 2 );
+cpPlugins_ITKImage_Import( itk::Offset< 3 >, 3 );
+cpPlugins_ITKImage_Import( itk::Offset< 4 >, 4 );
+
+// =========================================================================
+// ==========        Declare import itk::VectorImage types        ==========
+// =========================================================================
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_Import( T, D )                            \
+  cpPlugins_TEMPLATE_IMPORT(                                            \
+    2(class cpPlugins_Interface_EXPORT itk::VectorImage< T, D >)        \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayVectorImage_Import( A, T, DA, DI )               \
+  cpPlugins_TEMPLATE_IMPORT(                                            \
+    3(class                                                             \
+      cpPlugins_Interface_EXPORT                                        \
+      itk::VectorImage< A< T, DA >, DI >)                               \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VectorImage_AllDims_Import( T )  \
+  cpPlugins_VectorImage_Import( T, 2 );            \
+  cpPlugins_VectorImage_Import( T, 3 );            \
+  cpPlugins_VectorImage_Import( T, 4 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayVectorImage_AllDims_Import( A, T )     \
+  cpPlugins_ArrayVectorImage_Import( A, T, 2, 2 );            \
+  cpPlugins_ArrayVectorImage_Import( A, T, 3, 3 );            \
+  cpPlugins_ArrayVectorImage_Import( A, T, 4, 4 )
+
+// -------------------------------------------------------------------------
+// ITK-VTK base clases
+// -------------------------------------------------------------------------
+
+cpPlugins_VectorImage_AllDims_Import( char );
+cpPlugins_VectorImage_AllDims_Import( short );
+cpPlugins_VectorImage_AllDims_Import( int );
+cpPlugins_VectorImage_AllDims_Import( long );
+cpPlugins_VectorImage_AllDims_Import( unsigned char );
+cpPlugins_VectorImage_AllDims_Import( unsigned short );
+cpPlugins_VectorImage_AllDims_Import( unsigned int );
+cpPlugins_VectorImage_AllDims_Import( unsigned long );
+cpPlugins_VectorImage_AllDims_Import( float );
+cpPlugins_VectorImage_AllDims_Import( double );
+
+cpPlugins_VectorImage_AllDims_Import( std::complex< float > );
+cpPlugins_VectorImage_AllDims_Import( std::complex< double > );
+
+cpPlugins_VectorImage_Import( itk::Offset< 2 >, 2 );
+cpPlugins_VectorImage_Import( itk::Offset< 3 >, 3 );
+cpPlugins_VectorImage_Import( itk::Offset< 4 >, 4 );
+
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< char > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< short > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< int > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< long > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< unsigned char > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< unsigned short > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< unsigned int > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< unsigned long > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< float > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBPixel< double > );
+
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< char > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< short > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< int > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< long > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< unsigned char > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< unsigned short > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< unsigned int > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< unsigned long > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< float > );
+cpPlugins_VectorImage_AllDims_Import( itk::RGBAPixel< double > );
+
+cpPlugins_VectorImage_AllDims_Import( itk::DiffusionTensor3D< float > );
+cpPlugins_VectorImage_AllDims_Import( itk::DiffusionTensor3D< double > );
+
+cpPlugins_ArrayVectorImage_AllDims_Import( itk::Vector, float );
+cpPlugins_ArrayVectorImage_AllDims_Import( itk::Vector, double );
+
+cpPlugins_ArrayVectorImage_AllDims_Import( itk::CovariantVector, float );
+cpPlugins_ArrayVectorImage_AllDims_Import( itk::CovariantVector, double );
+
+cpPlugins_ArrayVectorImage_AllDims_Import( itk::Point, float );
+cpPlugins_ArrayVectorImage_AllDims_Import( itk::Point, double );
+
+cpPlugins_ArrayVectorImage_AllDims_Import(
+  itk::SymmetricSecondRankTensor, float
+  );
+cpPlugins_ArrayVectorImage_AllDims_Import(
+  itk::SymmetricSecondRankTensor, double
+  );
+
+#endif // cpPlugins_Interface_EXPORTS
+
 #endif // __CPPLUGINS__INTERFACE__IMAGE__HXX__
 
 // eof - $RCSfile$
index 1ffc516739274ca2fa26d863a67678b141a237a6..5802ac86c831d451a473034d33c57a2ced024497 100644 (file)
@@ -49,28 +49,6 @@ cpPlugins_Interface_ImplicitFunction_DEF( Quadric );
 cpPlugins_Interface_ImplicitFunction_DEF( Sphere );
 cpPlugins_Interface_ImplicitFunction_DEF( Superquadric );
 
-// -------------------------------------------------------------------------
-vtkImplicitFunction* cpPlugins::Interface::ImplicitFunction::
-GetVTKImplicitFunction( )
-{
-  return(
-    dynamic_cast< vtkImplicitFunction* >(
-      this->m_VTKObject.GetPointer( )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-const vtkImplicitFunction* cpPlugins::Interface::ImplicitFunction::
-GetVTKImplicitFunction( ) const
-{
-  return(
-    dynamic_cast< const vtkImplicitFunction* >(
-      this->m_VTKObject.GetPointer( )
-      )
-    );
-}
-
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::ImplicitFunction::
 SetFunction( vtkImplicitFunction* function )
index 6b9c7ee0c98fee15ccc646871f67963bb6a4940c..18ff63d3d5767afe1707be4c24099c5cb9cb99ec 100644 (file)
@@ -29,21 +29,6 @@ namespace cpPlugins
       itkTypeMacro( ImplicitFunction, DataObject );
 
     public:
-      template< class F >
-        inline F* GetITKImplicitFunction( );
-
-      template< class F >
-        inline const F* GetITKImplicitFunction( ) const;
-
-      template< class F >
-        inline F* GetVTKImplicitFunction( );
-
-      template< class F >
-        inline const F* GetVTKImplicitFunction( ) const;
-
-      virtual vtkImplicitFunction* GetVTKImplicitFunction( );
-      virtual const vtkImplicitFunction* GetVTKImplicitFunction( ) const;
-
       void SetFunction( vtkImplicitFunction* function );
 
       void SetFunctionToBox( );
diff --git a/lib/cpPlugins/Interface/ImplicitFunction.hxx b/lib/cpPlugins/Interface/ImplicitFunction.hxx
deleted file mode 100644 (file)
index 307d437..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef __CPPLUGINS__INTERFACE__IMPLICITFUNCTION__HXX__
-#define __CPPLUGINS__INTERFACE__IMPLICITFUNCTION__HXX__
-
-// -------------------------------------------------------------------------
-template< class F >
-F* cpPlugins::Interface::ImplicitFunction::
-GetITKImplicitFunction( )
-{
-  return( dynamic_cast< F* >( this->m_ITKObject.GetPointer( ) ) );
-}
-
-// -------------------------------------------------------------------------
-template< class F >
-const F* cpPlugins::Interface::ImplicitFunction::
-GetITKImplicitFunction( ) const
-{
-  return( dynamic_cast< const F* >( this->m_ITKObject.GetPointer( ) ) );
-}
-
-// -------------------------------------------------------------------------
-template< class F >
-F* cpPlugins::Interface::ImplicitFunction::
-GetVTKImplicitFunction( )
-{
-  return( dynamic_cast< F* >( this->m_VTKObject.GetPointer( ) ) );
-}
-
-// -------------------------------------------------------------------------
-template< class F >
-const F* cpPlugins::Interface::ImplicitFunction::
-GetVTKImplicitFunction( ) const
-{
-  return( dynamic_cast< const F* >( this->m_VTKObject.GetPointer( ) ) );
-}
-
-#endif // __CPPLUGINS__INTERFACE__IMPLICITFUNCTION__HXX__
-
-// eof - $RCSfile$
index 8507a4b52a2e0f385b3b60c306a0d4428e1afc5a..e179c8ed61e4b0e34b7fcd391b6c92d2cf73309c 100644 (file)
@@ -4,33 +4,37 @@
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Mesh::
-SetVTKMesh( vtkPolyData* mesh )
+SetVTK( vtkObject* mesh )
 {
-  this->m_VTKObject = mesh;
-
-  this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->m_Actor = vtkSmartPointer< vtkActor >::New( );
-
-  this->m_Mapper->SetInputData( mesh );
-  this->m_Actor->SetMapper( this->m_Mapper );
-
+  if( dynamic_cast< vtkPolyData* >( mesh ) != NULL )
+    this->m_VTKObject = mesh;
+  else
+    this->m_VTKObject = NULL;
+  this->m_Mapper = NULL;
+  this->m_Actor = NULL;
   this->Modified( );
 }
 
 // -------------------------------------------------------------------------
-vtkPolyData* cpPlugins::Interface::Mesh::
-GetVTKMesh( )
+void cpPlugins::Interface::Mesh::
+CreateVTKActor( )
 {
-  return( dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) );
-}
+  vtkPolyData* pd = this->GetVTK< vtkPolyData >( );
+  if(
+    pd != NULL &&
+    (
+      this->m_Mapper.GetPointer( ) == NULL ||
+      this->m_Actor.GetPointer( ) == NULL
+      )
+    )
+  {
+    this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+    this->m_Actor = vtkSmartPointer< vtkActor >::New( );
+    this->m_Mapper->SetInputData( pd );
+    this->m_Actor->SetMapper( this->m_Mapper );
+    this->Modified( );
 
-// -------------------------------------------------------------------------
-const vtkPolyData* cpPlugins::Interface::Mesh::
-GetVTKMesh( ) const
-{
-  return(
-    dynamic_cast< const vtkPolyData* >( this->m_VTKObject.GetPointer( ) )
-    );
+  } // fi
 }
 
 // -------------------------------------------------------------------------
@@ -50,7 +54,9 @@ GetVTKActor( ) const
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Mesh::
 Mesh( )
-  : Superclass( )
+  : Superclass( ),
+    m_Mapper( NULL ),
+    m_Actor( NULL )
 {
   this->m_ClassName = "cpPlugins::Interface::Mesh";
   this->m_ClassCategory = "BasicObject";
index 75c5eb3683e766a6a546e3091330116d170a8b2e..20c56fb2aaaa45e5c6fcc881560bbd76c67dd550 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <vtkSmartPointer.h>
 #include <vtkActor.h>
-#include <vtkPolyData.h>
 #include <vtkPolyDataMapper.h>
 
 namespace cpPlugins
@@ -30,17 +29,11 @@ namespace cpPlugins
 
     public:
       template< class M >
-        inline void SetITKMesh( itk::DataObject* object );
+        inline void SetITK( itk::Object* object );
 
-      template< class M >
-        inline M* GetITKMesh( );
-
-      template< class M >
-        inline const M* GetITKMesh( ) const;
+      virtual void SetVTK( vtkObject* mesh );
 
-      virtual void SetVTKMesh( vtkPolyData* mesh );
-      virtual vtkPolyData* GetVTKMesh( );
-      virtual const vtkPolyData* GetVTKMesh( ) const;
+      virtual void CreateVTKActor( );
       virtual vtkActor* GetVTKActor( );
       virtual const vtkActor* GetVTKActor( ) const;
 
index e897f617458dbf0a2ccd6758c568c72002293329..da891678da571596752fac22fa2e7cdb2046a784 100644 (file)
@@ -30,32 +30,12 @@ cpPlugins_Mesh_Import( QuadEdgeMesh, double, 3 );
 // -------------------------------------------------------------------------
 template< class M >
 void cpPlugins::Interface::Mesh::
-SetITKMesh( itk::DataObject* object )
+SetITK( itk::Object* object )
 {
   std::cerr << "SetITKMesh: TODO" << std::endl;
   std::exit( 1 );
 }
 
-// -------------------------------------------------------------------------
-template< class M >
-M* cpPlugins::Interface::Mesh::
-GetITKMesh( )
-{
-  std::cerr << "GetITKMesh: TODO" << std::endl;
-  std::exit( 1 );
-  return( NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class M >
-const M* cpPlugins::Interface::Mesh::
-GetITKMesh( ) const
-{
-  std::cerr << "GetITKMesh (const): TODO" << std::endl;
-  std::exit( 1 );
-  return( NULL );
-}
-
 #endif // __CPPLUGINS__INTERFACE__MESH__HXX__
 
 // eof - $RCSfile$
index 752bb68e7311094151ec15ca393b5d050ce6ad5c..7ac8534b892b7fe9e5418f86576717d5512256b9 100644 (file)
@@ -1,4 +1,7 @@
 #include <cpPlugins/Interface/ParametersListWidget.h>
+
+#ifdef cpPlugins_Interface_QT4
+
 #include <cpPlugins/Interface/ui_ParametersListWidget.h>
 
 #include <set>
@@ -134,4 +137,6 @@ _changeValuesCount( )
     table->insertRow( table->rowCount( ) );
 }
 
+#endif // cpPlugins_Interface_QT4
+
 // eof - $RCSfile$
index eb186dd58d8eacfa739ed59cd14b4793f25559e2..60133e33ae580e39270d49d8a0db0be7faa8b59a 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef __CPPLUGINS__INTERFACE__PARAMETERSLISTWIDGET__H__
 #define __CPPLUGINS__INTERFACE__PARAMETERSLISTWIDGET__H__
 
+#include <cpPlugins/Interface/Config.h>
+
+#ifdef cpPlugins_Interface_QT4
+
 #include <vector>
 #include <QWidget>
 
@@ -46,6 +50,8 @@ namespace cpPlugins
 
 } // ecapseman
 
+#endif // cpPlugins_Interface_QT4
+
 #endif // __CPPLUGINS__INTERFACE__PARAMETERSLISTWIDGET__H__
 
 // eof - $RCSfile$
index e6c5f5768030aae38f0c77ed827ce257301e0b63..decfdc0914fcedd30d25cdff3f81a0a5b7756171 100644 (file)
@@ -1,5 +1,7 @@
 #include <cpPlugins/Interface/ParametersQtDialog.h>
 
+#ifdef cpPlugins_Interface_QT4
+
 #include <limits>
 #include <vector>
 
@@ -218,4 +220,6 @@ ParametersQtDialog(
   return( true );
 }
 
+#endif // cpPlugins_Interface_QT4
+
 // eof - $RCSfile$
index daf2517b6663d8818ac153934a5378cc7f87ea63..6cc8ea4682c0f358a681dcb98fc64e2688cc2f5b 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef __CPPLUGINS__INTERFACE__PARAMETERSQTDIALOG__H__
 #define __CPPLUGINS__INTERFACE__PARAMETERSQTDIALOG__H__
 
+#include <cpPlugins/Interface/Config.h>
+
+#ifdef cpPlugins_Interface_QT4
+
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Parameters.h>
 
@@ -20,6 +24,8 @@ namespace cpPlugins
 
 } // ecapseman
 
+#endif // cpPlugins_Interface_QT4
+
 #endif // __CPPLUGINS__INTERFACE__PARAMETERSQTDIALOG__H__
 
 // eof - $RCSfile$
index a53476f894a8b30953fadfb84322a211fcebd6bf..bc5f7f21aae6efc78678ff9aa2cd7957e03e7d2a 100644 (file)
@@ -121,7 +121,9 @@ ExecConfigurationDialog( QWidget* parent )
 // -------------------------------------------------------------------------
 cpPlugins::Interface::ProcessObject::
 ProcessObject( )
-  : Superclass( )
+  : Superclass( ),
+    m_ITKObject( NULL ),
+    m_VTKObject( NULL )
 {
   this->m_ClassName = "cpPlugins::Interface::ProcessObject";
   this->m_ClassCategory = "BasicObject";
index 51cf06742c0ccb72ce01c3d9d9c2cf97e4266055..2a9fc916e17045d4be9fffc5e177332056ade156 100644 (file)
@@ -15,7 +15,8 @@ typedef char QWidget
 
 #include <itkProcessObject.h>
 
-class vtkAlgorithm;
+#include <vtkSmartPointer.h>
+#include <vtkAlgorithm.h>
 
 namespace cpPlugins
 {
@@ -36,11 +37,6 @@ namespace cpPlugins
       itkTypeMacro( ProcessObject, Object );
 
     public:
-      virtual vtkAlgorithm* GetVTKAlgorithm( )
-      { return( NULL ); }
-      virtual const vtkAlgorithm* GetVTKAlgorithm( ) const
-      { return( NULL ); }
-
       virtual const Parameters& GetDefaultParameters( ) const;
       virtual void SetParameters( const Parameters& params );
 
@@ -57,6 +53,18 @@ namespace cpPlugins
 
       virtual bool ExecConfigurationDialog( QWidget* parent );
 
+      template< class T >
+        inline T* GetITK( );
+
+      template< class T >
+        inline const T* GetITK( ) const;
+
+      template< class T >
+        inline T* GetVTK( );
+
+      template< class T >
+        inline const T* GetVTK( ) const;
+
       template< class T >
         inline T* GetInput( unsigned int idx );
 
@@ -73,6 +81,12 @@ namespace cpPlugins
       ProcessObject( );
       virtual ~ProcessObject( );
 
+      template< class F >
+        inline F* _CreateITK( );
+
+      template< class F >
+        inline F* _CreateVTK( );
+
       template< class O >
         inline void _MakeOutput( unsigned int idx );
 
@@ -84,7 +98,9 @@ namespace cpPlugins
       Self& operator=( const Self& );
 
     protected:
-      itk::ProcessObject::Pointer m_RealProcessObject;
+      itk::ProcessObject::Pointer     m_ITKObject;
+      vtkSmartPointer< vtkAlgorithm > m_VTKObject;
+
       Parameters m_DefaultParameters;
       Parameters m_Parameters;
 
index f84d4a6301e202cf44bfbb95fb8b0e4b9b7a4bb2..50c03ce82cdfc0fb4c7a13fc2bd1f30424a56b5d 100644 (file)
@@ -1,6 +1,38 @@
 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
 
+// -------------------------------------------------------------------------
+template< class T >
+T* cpPlugins::Interface::ProcessObject::
+GetITK( )
+{
+  return( dynamic_cast< T* >( this->m_ITKObject.GetPointer( ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class T >
+const T* cpPlugins::Interface::ProcessObject::
+GetITK( ) const
+{
+  return( dynamic_cast< const T* >( this->m_ITKObject.GetPointer( ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class T >
+T* cpPlugins::Interface::ProcessObject::
+GetVTK( )
+{
+  return( dynamic_cast< T* >( this->m_VTKObject.GetPointer( ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class T >
+const T* cpPlugins::Interface::ProcessObject::
+GetVTK( ) const
+{
+  return( dynamic_cast< const T* >( this->m_VTKObject.GetPointer( ) ) );
+}
+
 // -------------------------------------------------------------------------
 template< class T >
 T* cpPlugins::Interface::ProcessObject::
@@ -49,6 +81,39 @@ GetOutput( unsigned int idx ) const
     return( NULL );
 }
 
+// -------------------------------------------------------------------------
+template< class F >
+F* cpPlugins::Interface::ProcessObject::
+_CreateITK( )
+{
+  F* filter = dynamic_cast< F* >( this->m_ITKObject.GetPointer( ) );
+  if( filter == NULL )
+  {
+    typename F::Pointer ptr = F::New( );
+    this->m_ITKObject = ptr;
+    filter = ptr.GetPointer( );
+    this->m_VTKObject = NULL;
+
+  } // fi
+  return( filter );
+}
+
+// -------------------------------------------------------------------------
+template< class F >
+F* cpPlugins::Interface::ProcessObject::
+_CreateVTK( )
+{
+  F* filter = dynamic_cast< F* >( this->m_VTKObject.GetPointer( ) );
+  if( filter == NULL )
+  {
+    filter = F::New( );
+    this->m_VTKObject = filter;
+    this->m_ITKObject = NULL;
+
+  } // fi
+  return( filter );
+}
+
 // -------------------------------------------------------------------------
 template< class O >
 void cpPlugins::Interface::ProcessObject::
index ea7c965184579ad6a01033ce59d1f29d36c2dbac..1a257a68ef346a0f46962f676c5537b7c2fccf5f 100644 (file)
@@ -45,15 +45,9 @@ _GenerateData( )
 
   itk::DataObject* itk_image = NULL;
   std::string r = "";
-  cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    2, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    3, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    4, image, itk_image, r, _DemangleOutput
-    );
+  cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllScalarTypes( 4, image, itk_image, r, _GD0 );
   else r = "BinaryThresholdImageFilter: Input image type not supported.";
   return( r );
 }
@@ -61,7 +55,7 @@ _GenerateData( )
 // -------------------------------------------------------------------------
 template< class I >
 std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
-_DemangleOutput( itk::DataObject* image )
+_GD0( itk::DataObject* image )
 {
   return(
     this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >(
@@ -88,13 +82,7 @@ _RealGD( itk::DataObject* image )
   _OP out_val = _OP( this->m_Parameters.GetValueAsReal( "OutsideValue" ) );
 
   // Configure filter
-  _F* filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-  if( filter == NULL )
-  {
-    this->m_RealProcessObject = _F::New( );
-    filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-
-  } // fi
+  _F* filter = this->_CreateITK< _F >( );
   filter->SetInput( dynamic_cast< I* >( image ) );
   filter->SetLowerThreshold( lower_val );
   filter->SetUpperThreshold( upper_val );
@@ -107,7 +95,7 @@ _RealGD( itk::DataObject* image )
     this->GetOutput< cpPlugins::Interface::Image >( 0 );
   if( out != NULL )
   {
-    out->SetITKImage< O >( filter->GetOutput( ) );
+    out->SetITK< O >( filter->GetOutput( ) );
     return( "" );
   }
   else
index 74a970f49d56100a4101c14d7dae37f0773329cf..4658f9d23f094dd43bf8174d33e2ce650088bbc0 100644 (file)
@@ -33,7 +33,7 @@ namespace cpPlugins
       virtual std::string _GenerateData( );
 
       template< class I >
-        inline std::string _DemangleOutput( itk::DataObject* image );
+        inline std::string _GD0( itk::DataObject* image );
 
       template< class I, class O >
         inline std::string _RealGD( itk::DataObject* image );
index 0ae95d51673527840f7336efe16563744cb247ad..32a7c5a3b1e3ad1af7c1a1cdb69d52df5ba279ca 100644 (file)
@@ -5,25 +5,10 @@
 #include <vtkCutter.h>
 #include <vtkProperty.h>
 
-// -------------------------------------------------------------------------
-vtkAlgorithm* cpPlugins::BasicFilters::Cutter::
-GetVTKAlgorithm( )
-{
-  return( this->m_Algorithm );
-}
-
-// -------------------------------------------------------------------------
-const vtkAlgorithm* cpPlugins::BasicFilters::Cutter::
-GetVTKAlgorithm( ) const
-{
-  return( this->m_Algorithm );
-}
-
 // -------------------------------------------------------------------------
 cpPlugins::BasicFilters::Cutter::
 Cutter( )
-  : Superclass( ),
-    m_Algorithm( NULL )
+  : Superclass( )
 {
   this->m_ClassName = "cpPlugins::BasicFilters::Cutter";
   this->m_ClassCategory = "MeshToMeshFilter";
@@ -39,8 +24,6 @@ Cutter( )
 cpPlugins::BasicFilters::Cutter::
 ~Cutter( )
 {
-  if( this->m_Algorithm != NULL )
-    this->m_Algorithm->Delete( );
 }
 
 // -------------------------------------------------------------------------
@@ -55,20 +38,16 @@ _GenerateData( )
   if( function == NULL )
     return( "Cutter: Input data 1 is not a valid implicit function." );
 
-  if( this->m_Algorithm != NULL )
-    this->m_Algorithm->Delete( );
-
-  vtkCutter* cutter = vtkCutter::New( );
-  cutter->SetInputData( mesh->GetVTKMesh( ) );
-  cutter->SetCutFunction( function->GetVTKImplicitFunction( ) );
+  vtkCutter* cutter = this->_CreateVTK< vtkCutter >( );
+  cutter->SetInputData( mesh->GetVTK< vtkPolyData >( ) );
+  cutter->SetCutFunction( function->GetVTK< vtkImplicitFunction >( ) );
   cutter->GenerateTrianglesOff( );
-  this->m_Algorithm = cutter;
+  cutter->Update( );
 
   // Execute filter
-  this->m_Algorithm->Update( );
   cpPlugins::Interface::Mesh* out =
     this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
-  out->SetVTKMesh( this->m_Algorithm->GetOutput( ) );
+  out->SetVTK( cutter->GetOutput( ) );
 
   return( "" );
 }
index 8887adc133227fff485eb142efa8fc02a446c3ec..52438a723b4fe7ee750984889ceeb16eee58a937 100644 (file)
@@ -4,9 +4,6 @@
 #include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
-class vtkAlgorithm;
-class vtkPolyDataAlgorithm;
-
 namespace cpPlugins
 {
   namespace BasicFilters
@@ -26,10 +23,6 @@ namespace cpPlugins
       itkNewMacro( Self );
       itkTypeMacro( Cutter, cpPluginsInterfaceMeshToMeshFilter );
 
-    public:
-      virtual vtkAlgorithm* GetVTKAlgorithm( );
-      virtual const vtkAlgorithm* GetVTKAlgorithm( ) const;
-
     protected:
       Cutter( );
       virtual ~Cutter( );
@@ -40,9 +33,6 @@ namespace cpPlugins
       // Purposely not implemented
       Cutter( const Self& );
       Self& operator=( const Self& );
-
-    protected:
-      vtkPolyDataAlgorithm* m_Algorithm;
     };
 
     // ---------------------------------------------------------------------
index e061017b328f68fddf64bc8cbafefc8bdecf0b2a..cca186c79f44bc03ebeefc8733a4d247f2203bd5 100644 (file)
@@ -9,8 +9,7 @@
 // -------------------------------------------------------------------------
 cpPlugins::BasicFilters::MarchingCubes::
 MarchingCubes( )
-  : Superclass( ),
-    m_Algorithm( NULL )
+  : Superclass( )
 {
   this->m_ClassName = "cpPlugins::BasicFilters::MarchingCubes";
   this->m_ClassCategory = "ImageToMeshFilter";
@@ -28,8 +27,6 @@ MarchingCubes( )
 cpPlugins::BasicFilters::MarchingCubes::
 ~MarchingCubes( )
 {
-  if( this->m_Algorithm != NULL )
-    this->m_Algorithm->Delete( );
 }
 
 // -------------------------------------------------------------------------
@@ -41,40 +38,39 @@ _GenerateData( )
     this->GetInput< cpPlugins::Interface::Image >( 0 );
   if( image == NULL )
     return( "MarchingCubes: Input data is not a valid image." );
-  vtkImageData* vtk_image = image->GetVTKImageData( );
+  vtkImageData* vtk_image = image->GetVTK< vtkImageData >( );
   if( vtk_image == NULL )
     return( "MarchingCubes: Input does not have a valid VTK conversion." );
 
-  if( this->m_Algorithm != NULL )
-    this->m_Algorithm->Delete( );
-
   std::vector< double > values;
   this->m_Parameters.GetValueAsRealList( values, "Thresholds" );
+  vtkPolyData* pd = NULL;
   if( vtk_image->GetDataDimension( ) == 2 )
   {
-    vtkMarchingSquares* ms = vtkMarchingSquares::New( );
+    vtkMarchingSquares* ms = this->_CreateVTK< vtkMarchingSquares >( );
     ms->SetInputData( vtk_image );
     for( unsigned int i = 0; i < values.size( ); ++i )
       ms->SetValue( i, values[ i ] );
-    this->m_Algorithm = ms;
+    ms->Update( );
+    pd = ms->GetOutput( );
   }
   else if( vtk_image->GetDataDimension( ) == 3 )
   {
-    vtkMarchingCubes* mc = vtkMarchingCubes::New( );
+    vtkMarchingCubes* mc = this->_CreateVTK< vtkMarchingCubes >( );
     mc->ComputeNormalsOff( );
     mc->SetInputData( vtk_image );
     for( unsigned int i = 0; i < values.size( ); ++i )
       mc->SetValue( i, values[ i ] );
-    this->m_Algorithm = mc;
+    mc->Update( );
+    pd = mc->GetOutput( );
   }
   else
     return( "MarchingCubes: Input data does not have a valid dimension." );
 
   // Execute filter
-  this->m_Algorithm->Update( );
   cpPlugins::Interface::Mesh* out =
     this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
-  out->SetVTKMesh( this->m_Algorithm->GetOutput( ) );
+  out->SetVTK( pd );
   return( "" );
 }
 
index a5790e9ac157024c76eed4bca67b71ef48263820..3f9c22d6022f5cf57f5f14bb3012d26ca081b28a 100644 (file)
@@ -4,8 +4,6 @@
 #include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
-class vtkPolyDataAlgorithm;
-
 namespace cpPlugins
 {
   namespace BasicFilters
@@ -35,9 +33,6 @@ namespace cpPlugins
       // Purposely not implemented
       MarchingCubes( const Self& );
       Self& operator=( const Self& );
-
-    protected:
-      vtkPolyDataAlgorithm* m_Algorithm;
     };
 
     // ---------------------------------------------------------------------
index d806506352ac0a058055739e00b5ac84cc2d9ca4..df145b871727f5af048b248a6dff02e86d3f2477 100644 (file)
@@ -39,15 +39,9 @@ _GenerateData( )
 
   itk::DataObject* itk_image = NULL;
   std::string r = "";
-  cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    2, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    3, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    4, image, itk_image, r, _DemangleOutput
-    );
+  cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllScalarTypes( 4, image, itk_image, r, _GD0 );
   else r = "MedianImageFilter: Input image type not supported.";
   return( r );
 }
@@ -55,7 +49,7 @@ _GenerateData( )
 // -------------------------------------------------------------------------
 template< class I >
 std::string cpPlugins::BasicFilters::MedianImageFilter::
-_DemangleOutput( itk::DataObject* image )
+_GD0( itk::DataObject* image )
 {
   return(
     this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >(
@@ -77,16 +71,9 @@ _RealGD( itk::DataObject* image )
   rad_val.Fill( this->m_Parameters.GetValueAsUint( "Radius" ) );
 
   // Configure filter
-  _F* filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-  if( filter == NULL )
-  {
-    this->m_RealProcessObject = _F::New( );
-    filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-
-  } // fi
+  _F* filter = this->_CreateITK< _F >( );
   filter->SetInput( dynamic_cast< I* >( image ) );
   filter->SetRadius( rad_val );
-
   filter->Update( );
 
   // Connect output
@@ -94,7 +81,7 @@ _RealGD( itk::DataObject* image )
     this->GetOutput< cpPlugins::Interface::Image >( 0 );
   if( out != NULL )
   {
-    out->SetITKImage< O >( filter->GetOutput( ) );
+    out->SetITK< O >( filter->GetOutput( ) );
     return( "" );
   }
   else
index 8b3cbf7538ccf872b1af90233d1de71924581d06..ea2bb61031b92b58f0b081d15e6ba56e078f2856 100644 (file)
@@ -33,7 +33,7 @@ namespace cpPlugins
       virtual std::string _GenerateData( );
 
       template< class I >
-        inline std::string _DemangleOutput( itk::DataObject* image );
+        inline std::string _GD0( itk::DataObject* image );
 
       template< class I, class O >
         inline std::string _RealGD( itk::DataObject* image );
index 6e0d36fa29b72d8ee354129fbf3c45f82df53f0d..de924a67b9da78b90c68a2de89ef1984a8cf2a84 100644 (file)
@@ -43,15 +43,9 @@ _GenerateData( )
 
   itk::DataObject* itk_image = NULL;
   std::string r = "";
-  cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    2, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    3, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
-    4, image, itk_image, r, _DemangleOutput
-    );
+  cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllScalarTypes( 4, image, itk_image, r, _GD0 );
   else r = "OtsuThresholdImageFilter: Input image type not supported.";
   return( r );
 }
@@ -59,7 +53,7 @@ _GenerateData( )
 // -------------------------------------------------------------------------
 template< class I >
 std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
-_DemangleOutput( itk::DataObject* image )
+_GD0( itk::DataObject* image )
 {
   return(
     this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >(
@@ -83,13 +77,7 @@ _RealGD( itk::DataObject* image )
   _OP out_val = _OP( this->m_Parameters.GetValueAsReal( "OutsideValue" ) );
 
   // Configure filter
-  _F* filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-  if( filter == NULL )
-  {
-    this->m_RealProcessObject = _F::New( );
-    filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-
-  } // fi
+  _F* filter = this->_CreateITK< _F >( );
   filter->SetInput( dynamic_cast< I* >( image ) );
   filter->SetNumberOfHistogramBins( bins );
   filter->SetInsideValue( in_val );
@@ -101,7 +89,7 @@ _RealGD( itk::DataObject* image )
     this->GetOutput< cpPlugins::Interface::Image >( 0 );
   if( out != NULL )
   {
-    out->SetITKImage< O >( filter->GetOutput( ) );
+    out->SetITK< O >( filter->GetOutput( ) );
     return( "" );
   }
   else
index 6a112d0d4cb8adf3973ebdb433cfe8a4f2b2be15..b717062f980f76e0b3326c4e658e362f2728fb16 100644 (file)
@@ -21,7 +21,10 @@ namespace cpPlugins
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( OtsuThresholdImageFilter, cpPluginsInterfaceImageToImageFilter );
+      itkTypeMacro(
+        OtsuThresholdImageFilter,
+        cpPluginsInterfaceImageToImageFilter
+        );
 
     protected:
       OtsuThresholdImageFilter( );
@@ -30,7 +33,7 @@ namespace cpPlugins
       virtual std::string _GenerateData( );
 
       template< class I >
-        inline std::string _DemangleOutput( itk::DataObject* image );
+        inline std::string _GD0( itk::DataObject* image );
 
       template< class I, class O >
         inline std::string _RealGD( itk::DataObject* image );
index 7f5b1fc8f923860d20694910bab28c39c0368127..38cec311f0dde0506660f91708a626f2c6635e5a 100644 (file)
@@ -29,25 +29,6 @@ cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 {
 }
 
-// -------------------------------------------------------------------------
-#define cpPlugins_Plugins_RGBImageToOtherChannelsFilter( P, D, I, O, r, f ) \
-  cpPlugins_Image_Input_Demangle( P< char >, D, I, O, r, f );           \
-  else cpPlugins_Image_Input_Demangle( P< short >, D, I, O, r, f );     \
-  else cpPlugins_Image_Input_Demangle( P< int >, D, I, O, r, f );       \
-  else cpPlugins_Image_Input_Demangle( P< long >, D, I, O, r, f );      \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    P< unsigned char >, D, I, O, r, f                                   \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    P< unsigned short >, D, I, O, r, f                                  \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    P< unsigned int >, D, I, O, r, f                                    \
-    );                                                                  \
-  else cpPlugins_Image_Input_Demangle(                                  \
-    P< unsigned long >, D, I, O, r, f                                   \
-    )
-
 // -------------------------------------------------------------------------
 std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _GenerateData( )
@@ -59,15 +40,9 @@ _GenerateData( )
 
   itk::DataObject* itk_image = NULL;
   std::string r = "";
-  cpPlugins_Plugins_RGBImageToOtherChannelsFilter(
-    itk::RGBPixel, 2, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Plugins_RGBImageToOtherChannelsFilter(
-    itk::RGBPixel, 3, image, itk_image, r, _DemangleOutput
-    );
-  else cpPlugins_Plugins_RGBImageToOtherChannelsFilter(
-    itk::RGBPixel, 4, image, itk_image, r, _DemangleOutput
-    );
+  cpPlugins_Image_Demangle_AllRGBTypes( 2, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllRGBTypes( 3, image, itk_image, r, _GD0 );
+  else cpPlugins_Image_Demangle_AllRGBTypes( 4, image, itk_image, r, _GD0 );
   else r = "RGBImageToOtherChannelsFilter: Input image type not supported.";
   return( r );
 }
@@ -75,7 +50,7 @@ _GenerateData( )
 // -------------------------------------------------------------------------
 template< class I >
 std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
-_DemangleOutput( itk::DataObject* image )
+_GD0( itk::DataObject* image )
 {
   typedef typename I::PixelType _P;
 
@@ -107,13 +82,7 @@ _RealGD( itk::DataObject* image )
     _F;
 
   // Configure filter
-  _F* filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-  if( filter == NULL )
-  {
-    this->m_RealProcessObject = _F::New( );
-    filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-
-  } // fi
+  _F* filter = this->_CreateITK< _F >( );
   filter->SetInput( dynamic_cast< I* >( image ) );
   filter->Update( );
 
@@ -122,7 +91,7 @@ _RealGD( itk::DataObject* image )
     this->GetOutput< cpPlugins::Interface::Image >( 0 );
   if( out != NULL )
   {
-    out->SetITKImage< _O >( filter->GetOutput( ) );
+    out->SetITK< _O >( filter->GetOutput( ) );
     return( "" );
   }
   else
index 6d215f1ff840e1d1395ec079881fcf987bde703a..bb559c8d5753eeb898cd429bf7e8e1149f3e8c54 100644 (file)
@@ -33,7 +33,7 @@ namespace cpPlugins
       virtual std::string _GenerateData( );
 
       template< class I >
-        inline std::string _DemangleOutput( itk::DataObject* image );
+        inline std::string _GD0( itk::DataObject* image );
 
       template< class I, class C >
         inline std::string _RealGD( itk::DataObject* image );
index 4b1d365f59e9c96729b7eb826c5631914e42e633..fec094476ad212fc25a3b08bf0c4eca793dc745c 100644 (file)
@@ -368,25 +368,17 @@ _RealGD( const TStringList& names )
   {
     // Read single image
     typedef itk::ImageFileReader< I > _SR;
-    _SR* reader =
-      dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
-    if( reader == NULL )
-    {
-      this->m_RealProcessObject = _SR::New( );
-      reader =
-        dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
-
-    } // fi
+    _SR* reader = this->_CreateITK< _SR >( );
     reader->SetFileName( names[ 0 ] );
     try
     {
       reader->Update( );
-      out->SetITKImage< I >( reader->GetOutput( ) );
+      out->SetITK< I >( reader->GetOutput( ) );
     }
     catch( itk::ExceptionObject& err )
     {
       r = "ImageReader: " + std::string( err.GetDescription( ) );
-      out->SetITKImage< I >( NULL );
+      out->SetITK< I >( NULL );
 
     } // yrt
   }
@@ -398,29 +390,19 @@ _RealGD( const TStringList& names )
       ordered_names.insert( names[ i ] );
 
     typedef itk::ImageSeriesReader< I > _MR;
-    _MR* reader =
-      dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
-    if( reader == NULL )
-    {
-      this->m_RealProcessObject = _MR::New( );
-      reader =
-        dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
-
-    } // fi
+    _MR* reader = this->_CreateITK< _MR >( );
     std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
     for( ; fnIt != ordered_names.end( ); ++fnIt )
-    {
       reader->AddFileName( *fnIt );
-    }
     try
     {
       reader->Update( );
-      out->SetITKImage< I >( reader->GetOutput( ) );
+      out->SetITK< I >( reader->GetOutput( ) );
     }
     catch( itk::ExceptionObject& err )
     {
       r = "ImageReader: " + std::string( err.GetDescription( ) );
-      out->SetITKImage< I >( NULL );
+      out->SetITK< I >( NULL );
 
     } // yrt
   }
index 6a0de2ed09dc730cdeab376e3c7ce3c9684e7b43..3330e681bc0b679fb4844411bcba95dd507e64d4 100644 (file)
@@ -34,23 +34,13 @@ _GenerateData( )
 
   itk::DataObject* itk_image = NULL;
   std::string r = "";
-  cpPlugins_Image_Input_Demangle_Dimension_AllTypes(
-    2, image, itk_image, r, _RealGD
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllTypes(
-    3, image, itk_image, r, _RealGD
-    );
-  else cpPlugins_Image_Input_Demangle_Dimension_AllTypes(
-    4, image, itk_image, r, _RealGD
-    );
-#ifndef _WIN32 // win32: Nested loops error ????
-  else cpPlugins_Image_Input_Demangle(
-    itk::DiffusionTensor3D< float >, 3, image, itk_image, r, _RealGD
-    );
-  else cpPlugins_Image_Input_Demangle(
-    itk::DiffusionTensor3D< double >, 3, image, itk_image, r, _RealGD
-    );
-#endif // _WIN32
+
+  cpPlugins_Image_Demangle_AllTypes( 2, image, itk_image, r, _RealGD );
+  else cpPlugins_Image_Demangle_AllTypes( 3, image, itk_image, r, _RealGD );
+  else cpPlugins_Image_Demangle_AllTypes( 4, image, itk_image, r, _RealGD );
+  else cpPlugins_VectorImage_Demangle_AllTypes( 2, image, itk_image, r, _RealGD );
+  else cpPlugins_VectorImage_Demangle_AllTypes( 3, image, itk_image, r, _RealGD );
+  else cpPlugins_VectorImage_Demangle_AllTypes( 4, image, itk_image, r, _RealGD );
   else r = "ImageWriter: Input image type not supported.";
 
   return( r );
@@ -61,17 +51,11 @@ template< class I >
 std::string cpPlugins::IO::ImageWriter::
 _RealGD( itk::DataObject* image )
 {
-  typedef itk::ImageFileWriter< I > _W;
-  
   // Get filename
   std::string fname = this->m_Parameters.GetValueAsString( "FileName" );
-  _W* writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
-  if( writer == NULL )
-  {
-    this->m_RealProcessObject = _W::New( );
-    writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
 
-  } // fi
+  typedef itk::ImageFileWriter< I > _W;
+  _W* writer = this->_CreateITK< _W >( );
   writer->SetFileName( fname );
   writer->SetInput( dynamic_cast< I* >( image ) );
   try
index b8da8a36f1e582502cb5d07bbaea85327ee6529b..e6bba2bd4045ef4e3d2fb2df571ebf7042ae4e5d 100644 (file)
@@ -46,8 +46,7 @@ ExecConfigurationDialog( QWidget* parent )
 // -------------------------------------------------------------------------
 cpPlugins::IO::MeshReader::
 MeshReader( )
-  : Superclass( ),
-    m_Reader( NULL )
+  : Superclass( )
 {
   this->m_ClassName = "cpPlugins::IO::MeshReader";
   this->m_ClassCategory = "MeshReader";
@@ -68,8 +67,6 @@ MeshReader( )
 cpPlugins::IO::MeshReader::
 ~MeshReader( )
 {
-  if( this->m_Reader != NULL )
-    this->m_Reader = NULL;
 }
 
 // -------------------------------------------------------------------------
@@ -109,18 +106,14 @@ _GD1( )
   Parameters::TString fname =
     this->m_Parameters.GetValueAsString( "FileName" );
 
-  if( this->m_Reader != NULL )
-    this->m_Reader->Delete( );
-
-  vtkPolyDataReader* pdr = vtkPolyDataReader::New( );
-  this->m_Reader = pdr;
+  vtkPolyDataReader* pdr = this->_CreateVTK< vtkPolyDataReader >( );
   pdr->SetFileName( fname.c_str( ) );
   pdr->Update( );
 
   cpPlugins::Interface::Mesh* out =
     this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
   if( out != NULL )
-    out->SetVTKMesh( pdr->GetOutput( ) );
+    out->SetVTK( pdr->GetOutput( ) );
   else
     return( "MeshReader: output not correctly created." );
   return( "" );
index f66e07cf0449ddeb912b02acbab8c98956f663d0..5f721d203c47935ac9344333e6719fc0b9a013d7 100644 (file)
@@ -44,9 +44,6 @@ namespace cpPlugins
       // Purposely not implemented
       MeshReader( const Self& );
       Self& operator=( const Self& );
-
-    protected:
-      vtkDataReader* m_Reader;
     };
 
     // ---------------------------------------------------------------------
index ade28b87e5b8b85e8d8952ac6e358443151a047d..ee8b6668d904bb2402036b89bf80d06406df4baa 100644 (file)
@@ -8,8 +8,7 @@
 // -------------------------------------------------------------------------
 cpPlugins::IO::MeshWriter::
 MeshWriter( )
-  : Superclass( ),
-    m_Writer( NULL )
+  : Superclass( )
 {
   this->m_ClassName = "cpPlugins::IO::MeshWriter";
   this->m_ClassCategory = "MeshWriter";
@@ -24,8 +23,6 @@ MeshWriter( )
 cpPlugins::IO::MeshWriter::
 ~MeshWriter( )
 {
-  if( this->m_Writer != NULL )
-    this->m_Writer->Delete( );
 }
 
 // -------------------------------------------------------------------------
@@ -36,16 +33,12 @@ _GenerateData( )
     this->GetInput< cpPlugins::Interface::Mesh >( 0 );
   if( mesh == NULL )
     return( "MeshWriter: No input mesh." );
-  vtkPolyData* i = mesh->GetVTKMesh( );
+  vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );
   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;
+  vtkPolyDataWriter* pdw = this->_CreateVTK< vtkPolyDataWriter >( );
   pdw->SetInputData( i );
   pdw->SetFileName( fname.c_str( ) );
   pdw->Update( );
index cd776f61b7db07bbb9397afc65e264fda0009eb8..db13601e8739362b78e76a392f2a053804f78d69 100644 (file)
@@ -35,9 +35,6 @@ namespace cpPlugins
       // Purposely not implemented
       MeshWriter( const Self& );
       Self& operator=( const Self& );
-
-    protected:
-      vtkDataWriter* m_Writer;
     };
 
     // ---------------------------------------------------------------------