]> Creatis software - cpPlugins.git/commitdiff
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 30 Sep 2015 21:50:41 +0000 (16:50 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 30 Sep 2015 21:50:41 +0000 (16:50 -0500)
43 files changed:
CMakeLists.txt
appli/CMakeLists.txt
appli/ImageMPR/ImageMPR.cxx
appli/ImageMPR/ImageMPR.h
appli/bash/CMakeLists.txt [new file with mode: 0644]
appli/bash/cpPlugins_createHost.cxx [new file with mode: 0644]
appli/examples/CMakeLists.txt
appli/examples/example_LoadPlugins.cxx
appli/examples/example_ReadWriteImage.cxx
lib/cpExtensions/Visualization/ImageInteractorStyle.cxx
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpExtensions/Visualization/ImageSliceActors.h
lib/cpExtensions/Visualization/MPRActors.cxx
lib/cpExtensions/Visualization/MPRActors.h
lib/cpExtensions/Visualization/MPRObjects.cxx
lib/cpExtensions/Visualization/MPRObjects.h
lib/cpPlugins/Interface/CMakeLists.txt
lib/cpPlugins/Interface/Instances_itkImage.cxx
lib/cpPlugins/Interface/Instances_itkVectorImage.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/Macros.h
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx [moved from lib/cpPlugins/Plugins/BinaryThresholdImageFilter.cxx with 90% similarity]
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h [moved from lib/cpPlugins/Plugins/BinaryThresholdImageFilter.h with 90% similarity]
lib/cpPlugins/Plugins/BasicFilters/CMakeLists.txt [new file with mode: 0644]
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx [moved from lib/cpPlugins/Plugins/MarchingCubes.cxx with 90% similarity]
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h [moved from lib/cpPlugins/Plugins/MarchingCubes.h with 89% similarity]
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx [moved from lib/cpPlugins/Plugins/MedianImageFilter.cxx with 87% similarity]
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h [moved from lib/cpPlugins/Plugins/MedianImageFilter.h with 90% similarity]
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx [moved from lib/cpPlugins/Plugins/OtsuThresholdImageFilter.cxx with 88% similarity]
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h [moved from lib/cpPlugins/Plugins/OtsuThresholdImageFilter.h with 90% similarity]
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx [moved from lib/cpPlugins/Plugins/RGBImageToOtherChannelsFilter.cxx with 91% similarity]
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h [moved from lib/cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h with 90% similarity]
lib/cpPlugins/Plugins/CMakeLists.txt
lib/cpPlugins/Plugins/Host.cxx [deleted file]
lib/cpPlugins/Plugins/IO/CMakeLists.txt [new file with mode: 0644]
lib/cpPlugins/Plugins/IO/ImageReader.cxx [new file with mode: 0644]
lib/cpPlugins/Plugins/IO/ImageReader.h [moved from lib/cpPlugins/Plugins/ImageReader.h with 88% similarity]
lib/cpPlugins/Plugins/IO/ImageWriter.cxx [moved from lib/cpPlugins/Plugins/ImageWriter.cxx with 90% similarity]
lib/cpPlugins/Plugins/IO/ImageWriter.h [moved from lib/cpPlugins/Plugins/ImageWriter.h with 91% similarity]
lib/cpPlugins/Plugins/IO/MeshReader.cxx [moved from lib/cpPlugins/Plugins/MeshReader.cxx with 89% similarity]
lib/cpPlugins/Plugins/IO/MeshReader.h [moved from lib/cpPlugins/Plugins/MeshReader.h with 92% similarity]
lib/cpPlugins/Plugins/IO/MeshWriter.cxx [moved from lib/cpPlugins/Plugins/MeshWriter.cxx with 87% similarity]
lib/cpPlugins/Plugins/IO/MeshWriter.h [moved from lib/cpPlugins/Plugins/MeshWriter.h with 91% similarity]
lib/cpPlugins/Plugins/ImageReader.cxx [deleted file]

index 83c4b843c7568a621d7a3c7fb8228d59d2cd736c..d1ed48acf920919462f47ef3eb936f4dfab48f51 100644 (file)
@@ -50,6 +50,12 @@ ENDIF(BUILD_SHARED_LIBRARIES)
 # Prepare header to build shared libs (windows)
 INCLUDE(GenerateExportHeader)
 
+# Find boost
+FIND_PACKAGE(Boost 1.30 COMPONENTS filesystem system REQUIRED)
+IF(Boost_FOUND)
+  INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
+ENDIF(Boost_FOUND)
+
 # Find ITK and VTK
 FIND_PACKAGE(ITK REQUIRED)
 FIND_PACKAGE(VTK REQUIRED)
index 7ca64d43ccc1308a2fce1060d3c872859574e387..2568ba0471039e5e1a052802f4e5ac4bd8673d57 100644 (file)
@@ -1,3 +1,7 @@
+SUBDIRS(
+  bash
+  )
+
 IF(BUILD_EXAMPLES)
   SUBDIRS(
     examples
index f9a7934562c921846f4aea4cc7ba7a3010997c9b..f9613cb9819b87332bda13b5eff45f4fd9b63912 100644 (file)
@@ -1,8 +1,6 @@
 #include "ImageMPR.h"
 #include "ui_ImageMPR.h"
 
-#include <cpPlugins/Interface/ParametersQtDialog.h>
-
 #include <vtkProperty.h>
 #include <vtkRenderWindow.h>
 
@@ -59,7 +57,7 @@ ImageMPR::ImageMPR( QWidget* parent )
   // Start: load all disponible plugins
   this->_LoadPlugins(
     std::string( PLUGIN_PREFIX ) +
-    std::string( "cpPlugins." ) +
+    std::string( "cpPluginsIO." ) +
     std::string( PLUGIN_EXT )
     );
 }
@@ -86,17 +84,12 @@ _LoadPlugins( const std::string& filename )
   this->m_ImageWriterClass = "";
   this->m_MeshReaderClass = "";
   this->m_MeshWriterClass = "";
-  this->m_ImageToImageFilters.clear( );
-  this->m_ImageToMeshFilters.clear( );
+  this->m_UI->MenuImageToImage->clear( );
+  this->m_UI->MenuImageToMesh->clear( );
 
-  this->m_Plugins.UnloadAll( );
   if( !( this->m_Plugins.Load( filename ) ) )
-  {
-    this->m_Plugins.UnloadAll( );
     return( false );
 
-  } // fi
-
   typedef TPluginsInterface::TClasses _TClasses;
   _TClasses::const_iterator cIt = this->m_Plugins.GetClasses( ).begin( );
   for( ; cIt != this->m_Plugins.GetClasses( ).end( ); ++cIt )
@@ -115,7 +108,6 @@ _LoadPlugins( const std::string& filename )
       this->m_MeshWriterClass = name;
     else if( category == "ImageToImageFilter" )
     {
-      this->m_ImageToImageFilters.insert( name );
       QAction* action =
         this->m_UI->MenuImageToImage->addAction( QString( name.c_str( ) ) );
       QObject::connect(
@@ -125,7 +117,6 @@ _LoadPlugins( const std::string& filename )
     }
     else if( category == "ImageToMeshFilter" )
     {
-      this->m_ImageToMeshFilters.insert( name );
       QAction* action =
         this->m_UI->MenuImageToMesh->addAction( QString( name.c_str( ) ) );
       QObject::connect(
@@ -142,6 +133,50 @@ _LoadPlugins( const std::string& filename )
   return( true );
 }
 
+// -------------------------------------------------------------------------
+std::string ImageMPR::
+_LoadImage( TPluginImage::Pointer& image, const QStringList& names )
+{
+  // Block application
+  QApplication::setOverrideCursor( Qt::WaitCursor );
+  this->setEnabled( false );
+
+  std::string ret = "";
+  image = NULL;
+
+  // Get a reader from loaded plugins
+  TPluginFilter::Pointer reader =
+    this->m_Plugins.CreateProcessObject( this->m_ImageReaderClass );
+  if( reader.IsNotNull( ) )
+  {
+    // Configure reader
+    TParameters params = reader->GetDefaultParameters( );
+    QStringList::const_iterator qIt = names.begin( );
+    for( ; qIt != names.end( ); ++qIt )
+      params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
+    params.SetValueAsBool( "VectorType", false );
+    reader->SetParameters( params );
+
+    // Execute and get error message, if any
+    ret = reader->Update( );
+
+    // Assign fresh image, if any
+    if( ret == "" )
+    {
+      image = reader->GetOutput< TPluginImage >( 0 );
+      reader->DisconnectOutputs( );
+
+    } // fi
+  }
+  else
+    ret = "No suitable reader object found in loaded plugins.";
+  
+  // Finish reading
+  QApplication::restoreOverrideCursor( );
+  this->setEnabled( true );
+  return( ret );
+}
+
 // -------------------------------------------------------------------------
 void ImageMPR::
 _triggered_actionOpenPlugins( )
@@ -179,50 +214,25 @@ _triggered_actionOpenInputImage( )
   if( !( dialog.exec( ) ) )
     return;
   
-  this->m_InputImage = NULL;
-
-  // Get a reader from plugins
-  TPluginFilter::Pointer reader =
-    this->m_Plugins.CreateProcessObject( this->m_ImageReaderClass );
-
-  // Configure reader
-  TParameters reader_params = reader->GetDefaultParameters( );
-  QStringList q_fnames = dialog.selectedFiles( );
-  QStringList::const_iterator qIt = q_fnames.begin( );
-  for( ; qIt != q_fnames.end( ); ++qIt )
-    reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
-  reader->SetParameters( reader_params );
-
-  // Execute and get error message, if any
-  QApplication::setOverrideCursor( Qt::WaitCursor );
-  this->setEnabled( false );
-  std::string err = reader->Update( );
-  QApplication::restoreOverrideCursor( );
-  this->setEnabled( true );
-
-  // Assign fresh image, if any
+  // Read image
+  std::string err =
+    this->_LoadImage( this->m_InputImage, dialog.selectedFiles( ) );
   if( err == "" )
   {
-    this->m_InputImage = reader->GetOutput< TPluginImage >( 0 );
-    reader->DisconnectOutputs( );
-    if( this->m_InputImage.IsNotNull( ) )
+    vtkImageData* vtk_id = this->m_InputImage->GetVTKImageData( );
+    if( vtk_id != NULL )
     {
-      vtkImageData* vtk_id = this->m_InputImage->GetVTKImageData( );
-      if( vtk_id != NULL )
-      {
-        this->m_MPRObjects->SetImage( vtk_id );
-        this->m_MPRObjects->ActivateInteractors( );
-        this->m_MPRObjects->ResetCameras( );
-        this->m_MPRObjects->RenderAll( );
-      }
-      else
-        QMessageBox::critical(
-          this,
-          tr( "Error message" ),
-          tr( "Read image does not have a valid VTK converter." )
-          );
-
-    } // fi
+      this->m_MPRObjects->SetImage( vtk_id );
+      this->m_MPRObjects->ActivateInteractors( );
+      this->m_MPRObjects->ResetCameras( );
+      this->m_MPRObjects->RenderAll( );
+    }
+    else
+      QMessageBox::critical(
+        this,
+        tr( "Error message" ),
+        tr( "Read image does not have a valid VTK converter." )
+        );
   }
   else
     QMessageBox::critical(
@@ -236,6 +246,17 @@ _triggered_actionOpenInputImage( )
 void ImageMPR::
 _triggered_actionOpenSegmentation( )
 {
+  if( this->m_InputImage.IsNull( ) )
+  {
+    QMessageBox::critical(
+      this,
+      tr( "Error message" ),
+      tr( "Before reading a segmentation, first load a raw image." )
+      );
+    return;
+
+  } // fi
+
   // Show dialog and check if it was accepted
   QFileDialog dialog( this );
   dialog.setFileMode( QFileDialog::ExistingFiles );
@@ -247,51 +268,23 @@ _triggered_actionOpenSegmentation( )
   if( !( dialog.exec( ) ) )
     return;
   
-  this->m_InputImage = NULL;
-
-  // Get a reader from plugins
-  TPluginFilter::Pointer reader =
-    this->m_Plugins.CreateProcessObject( this->m_ImageReaderClass );
-
-  // Configure reader
-  TParameters reader_params = reader->GetDefaultParameters( );
-  QStringList q_fnames = dialog.selectedFiles( );
-  QStringList::const_iterator qIt = q_fnames.begin( );
-  for( ; qIt != q_fnames.end( ); ++qIt )
-    reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
-  reader->SetParameters( reader_params );
-
-  // Execute and get error message, if any
-  QApplication::setOverrideCursor( Qt::WaitCursor );
-  this->setEnabled( false );
-  std::string err = reader->Update( );
-  QApplication::restoreOverrideCursor( );
-  this->setEnabled( true );
-
-  // Assign fresh image, if any
+  // Read image
+  std::string err =
+    this->_LoadImage( this->m_InputSegmentation, dialog.selectedFiles( ) );
   if( err == "" )
   {
-    this->m_InputSegmentation = reader->GetOutput< TPluginImage >( 0 );
-    reader->DisconnectOutputs( );
-    if( this->m_InputSegmentation.IsNotNull( ) )
+    vtkImageData* vtk_id = this->m_InputSegmentation->GetVTKImageData( );
+    if( vtk_id != NULL )
     {
-      vtkImageData* vtk_id = this->m_InputSegmentation->GetVTKImageData( );
-      if( vtk_id != NULL )
-      {
-        /*
-          this->m_MPRObjects->SetImage( vtk_id );
-          this->m_MPRObjects->ResetCameras( );
-          this->m_MPRObjects->RenderAll( );
-        */
-      }
-      else
-        QMessageBox::critical(
-          this,
-          tr( "Error message" ),
-          tr( "Read image does not have a valid VTK converter." )
-          );
-
-    } // fi
+      this->m_MPRObjects->AddAuxiliaryImage( vtk_id );
+      this->m_MPRObjects->RenderAll( );
+    }
+    else
+      QMessageBox::critical(
+        this,
+        tr( "Error message" ),
+        tr( "Read image does not have a valid VTK converter." )
+        );
   }
   else
     QMessageBox::critical(
@@ -305,6 +298,7 @@ _triggered_actionOpenSegmentation( )
 void ImageMPR::
 _triggered_actionOpenInputPolyData( )
 {
+  /*
   // Show dialog and check if it was accepted
   QFileDialog dialog( this );
   dialog.setFileMode( QFileDialog::ExistingFile );
@@ -366,12 +360,14 @@ _triggered_actionOpenInputPolyData( )
       tr( "Error reading mesh" ),
       tr( err.c_str( ) )
       );
+  */
 }
 
 // -------------------------------------------------------------------------
 void ImageMPR::
 _triggered_actionImageToImage( )
 {
+  /*
   if( this->m_InputImage.IsNull( ) )
     return;
 
@@ -411,12 +407,14 @@ _triggered_actionImageToImage( )
       tr( "Error executing filter" ),
       tr( err.c_str( ) )
       );
+  */
 }
 
 // -------------------------------------------------------------------------
 void ImageMPR::
 _triggered_actionImageToMesh( )
 {
+  /*
   if( this->m_InputImage.IsNull( ) )
     return;
 
@@ -458,6 +456,7 @@ _triggered_actionImageToMesh( )
       tr( "Error executing filter" ),
       tr( err.c_str( ) )
       );
+      */
 }
 
 // eof - $RCSfile$
index 1b568051e9f8f5b06f76fa5a8c5698a3b1ede21e..cf3e5c1b5f3695955396cb7ad45331a8f1fec5a6 100644 (file)
@@ -1,9 +1,7 @@
 #ifndef __IMAGEMPR__H__
 #define __IMAGEMPR__H__
 
-// Standard stuff
-#include <map>
-#include <set>
+#include <vector>
 
 // Qt stuff
 #include <QMainWindow>
@@ -42,7 +40,6 @@ public:
   typedef cpPlugins::Interface::ProcessObject TPluginFilter;
   typedef cpPlugins::Interface::Parameters    TParameters;
 
-  typedef std::set< std::string > TStringContainer;
   typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
 
 public:
@@ -51,6 +48,9 @@ public:
 
 protected:
   bool _LoadPlugins( const std::string& filename );
+  std::string _LoadImage(
+    TPluginImage::Pointer& image, const QStringList& names
+    );
 
 private slots:
   void _triggered_actionOpenPlugins( );
@@ -71,8 +71,6 @@ private:
   std::string m_ImageWriterClass;
   std::string m_MeshReaderClass;
   std::string m_MeshWriterClass;
-  TStringContainer m_ImageToImageFilters;
-  TStringContainer m_ImageToMeshFilters;
 
   // Real data
   TPluginImage::Pointer m_InputImage;
diff --git a/appli/bash/CMakeLists.txt b/appli/bash/CMakeLists.txt
new file mode 100644 (file)
index 0000000..33785d1
--- /dev/null
@@ -0,0 +1,15 @@
+## =========================
+## = Command line programs =
+## =========================
+
+SET(
+  BASH_PROGRAMS
+  cpPlugins_createHost
+  )
+
+FOREACH(prog ${BASH_PROGRAMS}) 
+  ADD_EXECUTABLE(${prog} ${prog}.cxx)
+  TARGET_LINK_LIBRARIES(${prog} ${Boost_LIBRARIES})
+ENDFOREACH(prog)
+
+## eof - $RCSfile$
diff --git a/appli/bash/cpPlugins_createHost.cxx b/appli/bash/cpPlugins_createHost.cxx
new file mode 100644 (file)
index 0000000..0914cca
--- /dev/null
@@ -0,0 +1,59 @@
+#include <fstream>
+#include <iostream>
+#include <string>
+
+#include <boost/filesystem/path.hpp>
+
+int main( int argc, char* argv[] )
+{
+  // Open file
+  if( argc < 4 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " output_code namespace filter1 filter2 ..."
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::ofstream output_code( argv[ 1 ] );
+  if( !output_code )
+  {
+    std::cerr
+      << "Could not open file \"" << argv[ 1 ] << "\" for writing"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+
+  output_code << "#include <Pluma/Connector.hpp>" << std::endl;
+  for( int i = 3; i < argc; ++i )
+    output_code << "#include \"" << argv[ i ] << "\"" << std::endl;
+  output_code
+    << std::endl
+    << "PLUMA_CONNECTOR" << std::endl
+    << "bool connect( pluma::Host& host )" << std::endl
+    << "{" << std::endl
+    << "  using namespace " << argv[ 2 ] << ";" << std::endl;
+
+  for( int i = 3; i < argc; ++i )
+  {
+    boost::filesystem::path p( argv[ i ] );
+    output_code
+      << "  host.add( new "
+      << p.stem( ).generic_string( )
+      << "Provider( ) );"
+      << std::endl;
+
+  } // rof
+
+  output_code
+    << "  return( true );" << std::endl
+    << "}" << std::endl;
+
+  // Finish
+  output_code.close( );
+  return( 0 );
+}
+
+// eof - $RCSfile$
index d7e157911476bfb870e4d389934bef5f85d17b66..8d8a49fa3680a2d0968dd7e0731293df9824387f 100644 (file)
@@ -8,14 +8,14 @@ SET(
   example_TestParameters
   example_LoadPlugins
   example_ReadWriteImage
-  example_MarchingCubes
-  example_OtsuFilter
-  example_RGBImageToHSVChannels
-  example_RGBImageToYPbPrChannels
+  ##example_MarchingCubes
+  ##example_OtsuFilter
+  ##example_RGBImageToHSVChannels
+  ##example_RGBImageToYPbPrChannels
   ## example_ReadImageSeriesWriteImage
   ## example_ReadQuadEdgeMesh
   ## example_RenderQuadEdgeMesh
-  example_MPR
+  ##example_MPR
   )
 
 
index e46a5db137487004897407233402a412596aa6b4..d090d38318e718f877c5726f5f28ff3affa85d46 100644 (file)
@@ -7,30 +7,30 @@ int main( int argc, char* argv[] )
 {
   if( argc < 2 )
   {
-    std::cerr << "Usage: " << argv[ 0 ] << " plugins_file" << std::endl;
+    std::cerr << "Usage: " << argv[ 0 ] << " plugins_file(s)" << std::endl;
     return( 1 );
 
   } // fi
-  std::string plugins_file = argv[ 1 ];
 
   // Create interface
   typedef cpPlugins::Interface::Interface TInterface;
   typedef TInterface::TClasses            TClasses;
 
   TInterface plugins;
-  if( !plugins.Load( plugins_file ) )
-  {
-    std::cerr << "Error loading plugins file." << std::endl;
-    return( 1 );
+  for( int i = 1; i < argc; ++i )
+    if( !plugins.Load( argv[ i ] ) )
+      std::cerr
+        << "Error loading plugins file \""
+        << argv[ i ] << "\""
+        << std::endl;
 
-  } // fi
-  
   std::cout << "---------------------------------------------" << std::endl;
   std::cout << "Loaded classes:" << std::endl;
   TClasses::const_iterator cIt = plugins.GetClasses( ).begin( );
   for( ; cIt != plugins.GetClasses( ).end( ); ++cIt )
     std::cout << "  := " << cIt->first << std::endl;
   std::cout << "---------------------------------------------" << std::endl;
+
   return( 0 );
 }
 
index 5f01b44bc569247dfaaa3f222fdc354bb55a9b7e..b051277e30cad06e532e62495f19a39c56153899 100644 (file)
@@ -4,9 +4,16 @@
 
 #include <cpPlugins/Interface/Interface.h>
 #include <cpPlugins/Interface/ProcessObject.h>
-
 #include <cpPlugins/Interface/Image.h>
 
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Interface     TInterface;
+typedef cpPlugins::Interface::ProcessObject TProcessObject;
+typedef cpPlugins::Interface::DataObject    TDataObject;
+typedef cpPlugins::Interface::Parameters    TParameters;
+typedef TInterface::TClasses                TClasses;
+
+// -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
 {
   if( argc < 4 )
@@ -20,8 +27,6 @@ int main( int argc, char* argv[] )
   } // fi
 
   // Create interface
-  typedef cpPlugins::Interface::Interface TInterface;
-  typedef TInterface::TClasses            TClasses;
   TInterface plugins;
   if( !plugins.Load( argv[ 1 ] ) )
   {
@@ -31,21 +36,16 @@ int main( int argc, char* argv[] )
   } // fi
 
   // Create objects
-  typedef cpPlugins::Interface::ProcessObject TProcessObject;
-  typedef cpPlugins::Interface::DataObject    TDataObject;
-  typedef cpPlugins::Interface::Parameters    TParameters;
-  cpPlugins::Interface::ProcessObject::Pointer reader, writer;
-  reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
-  if( reader.IsNull( ) )
+  TProcessObject::Pointer reader, writer;
+  reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+  writer = plugins.CreateProcessObject( "cpPlugins::IO::ImageWriter" );
+  if( reader.IsNull( ) || writer.IsNull( ) )
   {
-    std::cerr << "No suitable reader found in plugins." << std::endl;
-    return( 1 );
-
-  } // fi
-  writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" );
-  if( writer.IsNull( ) )
-  {
-    std::cerr << "No suitable writer found in plugins." << std::endl;
+    std::cerr
+      << "No suitable reader found in plugins." << std::endl
+      << "Reader: " << reader.GetPointer( ) << std::endl
+      << "Writer: " << writer.GetPointer( ) << std::endl
+      << std::endl;
     return( 1 );
 
   } // fi
index ab3fee37ca5406985b43cb651b2b7c521002d90c..b784808ede8fbff1b1a0ff37e3402a7018724748 100644 (file)
@@ -402,8 +402,8 @@ WindowLevel( )
       this->WindowLevelCurrentPosition[ 1 ]
       ) / double( size[ 1 ] );
 
-    double w = this->WindowLevelInitial[ 0 ] * ( double( 1 ) + sw );
-    double l = this->WindowLevelInitial[ 1 ] * ( double( 1 ) + sl );
+    double w = this->WindowLevelInitial[ 0 ] + ( sw * 1000.0 );
+    double l = this->WindowLevelInitial[ 1 ] + ( sl * 1000.0 );
     double minw = this->m_MPRActors->GetMinWindow( 0 );
     double maxw = this->m_MPRActors->GetMaxWindow( 0 );
     double minl = this->m_MPRActors->GetMinLevel( 0 );
@@ -414,8 +414,7 @@ WindowLevel( )
     if( l < minl ) l = minl;
     if( maxl < l ) l = maxl;
 
-    this->m_MPRActors->SetWindow( 0, w );
-    this->m_MPRActors->SetLevel( 0, l );
+    this->m_MPRActors->SetWindowLevel( 0, w, l );
     this->Interactor->Render( );
     this->_RenderAssociateInteractors( );
   }
index 52be1f1ddeb099e82990b032f4e002038356c40b..ef55f5463bacf96bb4475edb98d6b1679178ade3 100644 (file)
@@ -22,62 +22,22 @@ New( )
 void cpExtensions::Visualization::ImageSliceActors::
 AddInputConnection( vtkAlgorithmOutput* aout, int axis )
 {
-  unsigned int nImages = this->SliceMappers.size( );
-
   vtkSmartPointer< vtkImageSliceMapper > mapper =
     vtkSmartPointer< vtkImageSliceMapper >::New( );
   this->SliceMappers.push_back( mapper );
   mapper->SetInputConnection( aout );
-  mapper->SetOrientation(
-    ( nImages == 0 )? axis: this->SliceMappers[ 0 ]->GetOrientation( )
-    );
-  mapper->Update( );
-  
-  vtkSmartPointer< vtkImageActor > actor =
-    vtkSmartPointer< vtkImageActor >::New( );
-  this->ImageActors.push_back( actor );
-  actor->SetMapper( mapper );
-  actor->Modified( );
-
-  if( nImages == 0 )
-  {
-    this->AddItem( this->TextActor );
-    this->AddItem( this->PlaneActor );
-
-  } // fi
-  this->AddItem( actor );
-  this->Modified( );
+  this->_ConfigureNewInput( axis );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 AddInputData( vtkImageData* data, int axis )
 {
-  unsigned int nImages = this->SliceMappers.size( );
-
   vtkSmartPointer< vtkImageSliceMapper > mapper =
     vtkSmartPointer< vtkImageSliceMapper >::New( );
   this->SliceMappers.push_back( mapper );
   mapper->SetInputData( data );
-  mapper->SetOrientation(
-    ( nImages == 0 )? axis: this->SliceMappers[ 0 ]->GetOrientation( )
-    );
-  mapper->Update( );
-
-  vtkSmartPointer< vtkImageActor > actor =
-    vtkSmartPointer< vtkImageActor >::New( );
-  this->ImageActors.push_back( actor );
-  actor->SetMapper( mapper );
-  actor->Modified( );
-
-  if( nImages == 0 )
-  {
-    this->AddItem( this->TextActor );
-    this->AddItem( this->PlaneActor );
-
-  } // fi
-  this->AddItem( actor );
-  this->Modified( );
+  this->_ConfigureNewInput( axis );
 }
 
 // -------------------------------------------------------------------------
@@ -190,6 +150,34 @@ GetPlaneActor( ) const
   return( this->PlaneActor );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+SetInterpolate( bool v )
+{
+  if( this->Interpolate != v )
+  {
+    for( unsigned int i = 0; i < this->ImageActors.size( ); ++i )
+      this->ImageActors[ i ]->SetInterpolate( v );
+    this->Interpolate = v;
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+InterpolateOn( )
+{
+  this->SetInterpolate( true );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+InterpolateOff( )
+{
+  this->SetInterpolate( false );
+}
+
 // -------------------------------------------------------------------------
 double* cpExtensions::Visualization::ImageSliceActors::
 GetDisplayBounds( ) const
@@ -204,7 +192,12 @@ GetDisplayBounds( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 GetDisplayBounds( double bounds[ 6 ] ) const
 {
-  if( this->ImageActors.size( ) > 0 )
+  if( this->ImageActors.size( ) == 0 )
+  {
+    bounds[ 0 ] = bounds[ 2 ] = bounds[ 4 ] = double( -1 );
+    bounds[ 1 ] = bounds[ 3 ] = bounds[ 5 ] = double( -1 );
+  }
+  else
     this->ImageActors[ 0 ]->GetDisplayBounds( bounds );
 }
 
@@ -347,7 +340,7 @@ SetSliceNumber( const int& slice )
   this->PlaneSource->Modified( );
   this->PlaneMapper->Modified( );
   this->PlaneActor->Modified( );
-  this->Modified( );
+  this->UpdateText( );
 }
 
 // -------------------------------------------------------------------------
@@ -374,10 +367,35 @@ UpdateText( )
   this->Modified( );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+UpdateText( const double& w, const double& l )
+{
+  if( this->SliceMappers.size( ) > 0 )
+  {
+    char axis;
+    int axId = this->SliceMappers[ 0 ]->GetOrientation( );
+    if     ( axId == 0 ) axis = 'X';
+    else if( axId == 1 ) axis = 'Y';
+    else if( axId == 2 ) axis = 'Z';
+
+    std::sprintf(
+      this->TextBuffer, "Axis: %c (%d) | W/L (%.2f/%.2f)",
+      axis, this->SliceMappers[ 0 ]->GetSliceNumber( ), w, l
+      );
+  }
+  else
+    this->TextBuffer[ 0 ] = '\0';
+  this->TextActor->SetInput( this->TextBuffer );
+  this->TextActor->Modified( );
+  this->Modified( );
+}
+
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::ImageSliceActors::
 ImageSliceActors( )
-  : Superclass( )
+  : Superclass( ),
+    Interpolate( false )
 {
   this->Clear( );
 }
@@ -388,4 +406,39 @@ cpExtensions::Visualization::ImageSliceActors::
 {
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_ConfigureNewInput( int axis )
+{
+  unsigned int nImages = this->ImageActors.size( );
+
+  // Configure mapper
+  vtkImageSliceMapper* mapper = this->SliceMappers[ nImages ];
+  if( nImages == 0 )
+    mapper->SetOrientation( axis );
+  else
+    mapper->SetOrientation( this->SliceMappers[ 0 ]->GetOrientation( ) );
+  mapper->Update( );
+
+  // Create actor
+  vtkSmartPointer< vtkImageActor > actor =
+    vtkSmartPointer< vtkImageActor >::New( );
+  this->ImageActors.push_back( actor );
+  actor->SetMapper( mapper );
+  actor->SetInterpolate( this->Interpolate );
+  actor->Modified( );
+
+  if( nImages == 0 )
+  {
+    this->AddItem( this->TextActor );
+    this->AddItem( this->PlaneActor );
+
+  } // fi
+  this->AddItem( actor );
+
+  if( nImages > 1 )
+    this->SetSliceNumber( this->GetSliceNumber( ) );
+  this->Modified( );
+}
+
 // eof - $RCSfile$
index 0e1fdae463622b857a0c655b4da8ca9ee0919df8..90b9ff018f4ed2d75a0ced687465dd42ad20a9a8 100644 (file)
@@ -50,6 +50,10 @@ namespace cpExtensions
       vtkActor* GetPlaneActor( );
       const vtkActor* GetPlaneActor( ) const;
 
+      void SetInterpolate( bool v );
+      void InterpolateOn( );
+      void InterpolateOff( );
+
       double* GetDisplayBounds( ) const;
       void GetDisplayBounds( double bounds[ 6 ] ) const;
 
@@ -59,11 +63,14 @@ namespace cpExtensions
       int GetSliceNumberMaxValue( ) const;
       void SetSliceNumber( const int& slice );
       void UpdateText( );
+      void UpdateText( const double& w, const double& l );
 
     protected:
       ImageSliceActors( );
       virtual ~ImageSliceActors( );
 
+      void _ConfigureNewInput( int axis );
+
     private:
       // Purposely not implemented
       ImageSliceActors( const Self& );
@@ -73,6 +80,7 @@ namespace cpExtensions
       // Multiple actors
       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
+      bool Interpolate;
 
       // Unique objects
       vtkSmartPointer< vtkPolyData >       PlaneSource;
index 90fdb7d83c7f68842d4d356191b61bdeedbe03c0..54e689afab091f6f9317c2f3e708c223ce8f3687 100644 (file)
@@ -1,8 +1,11 @@
 #include <cpExtensions/Visualization/MPRActors.h>
 
+#include <cmath>
+
 #include <vtkAlgorithmOutput.h>
 #include <vtkImageData.h>
 #include <vtkInformation.h>
+#include <vtkLookupTable.h>
 #include <vtkOutlineSource.h>
 #include <vtkProperty.h>
 #include <vtkRenderer.h>
@@ -40,6 +43,7 @@ AddInputConnection( vtkAlgorithmOutput* aout )
     this->ImageMaps[ 0 ]->SetInputConnection( aout );
     this->SetLookupTableToWindowLevel( 0 );
     this->_Update( 0 );
+    this->ResetWindowLevel( 0 );
     return( 0 );
   }
   else
@@ -64,7 +68,9 @@ AddInputConnection( vtkAlgorithmOutput* aout )
         vtkSmartPointer< vtkImageMapToColors >::New( )
         );
       this->ImageMaps[ N ]->SetInputConnection( aout );
-      this->SetLookupTableToWindowLevel( N );
+      this->SetLookupTableToColor(
+        N, double( 1 ), double( 0 ), double( 0 )
+        );
       this->_Update( N );
       return( N );
     }
@@ -87,6 +93,7 @@ AddInputData( vtkImageData* image )
     this->ImageMaps[ 0 ]->SetInputData( image );
     this->SetLookupTableToWindowLevel( 0 );
     this->_Update( 0 );
+    this->ResetWindowLevel( 0 );
     return( 0 );
   }
   else
@@ -107,7 +114,9 @@ AddInputData( vtkImageData* image )
         vtkSmartPointer< vtkImageMapToColors >::New( )
         );
       this->ImageMaps[ N ]->SetInputData( image );
-      this->SetLookupTableToWindowLevel( N );
+      this->SetLookupTableToColor(
+        N, double( 1 ), double( 0 ), double( 0 )
+        );
       this->_Update( N );
       return( N );
     }
@@ -196,6 +205,15 @@ PopDataFrom(
     w->RemoveActor( this->ImageOutlineActor );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+LinkInteractors( )
+{
+  this->_Update( 0 );
+  this->_Update( 1 );
+  this->_Update( 2 );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
 SetLookupTable( unsigned int i, vtkScalarsToColors* lut )
@@ -345,6 +363,27 @@ SetLevel( unsigned int i, const double& l )
   } // fi
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+SetWindowLevel( unsigned int i, const double& w, const double& l )
+{
+  vtkWindowLevelLookupTable* lut =
+    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( i ) );
+  if( lut != NULL )
+  {
+    lut->SetWindow( w );
+    lut->SetLevel( l );
+    lut->Build( );
+    this->ImageMaps[ i ]->Modified( );
+
+    for( unsigned int j = 0; j < 3; ++j )
+      this->Slices[ 0 ][ j ]->UpdateText( w, l );
+
+    this->Modified( );
+
+  } // fi
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
 ResetWindowLevel( unsigned int i )
@@ -357,6 +396,8 @@ ResetWindowLevel( unsigned int i )
     double r[ 2 ];
     image->GetScalarRange( r );
     lut->SetTableRange( r );
+    lut->SetWindow( r[ 1 ] - r[ 0 ] );
+    lut->SetLevel( ( r[ 1 ] + r[ 0 ] ) / double( 2 ) );
     lut->Build( );
     this->ImageMaps[ i ]->Modified( );
     this->Modified( );
@@ -364,6 +405,64 @@ ResetWindowLevel( unsigned int i )
   } // fi
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+SetLookupTableToColor(
+  unsigned int i, const double& r, const double& g, const double& b
+  )
+{
+  static const double _0 = double( 0 );
+  static const double _1 = double( 1 );
+  static const double _2 = double( 2 );
+  static const double _4 = double( 4 );
+  static const double _6 = double( 6 );
+  static const double _OPACITY = double( 0.6 );
+
+  // Check if the input has been configured
+  vtkImageData* image = this->_Image( i );
+  if( image == NULL )
+    return;
+
+  double range[ 2 ];
+  image->GetScalarRange( range );
+
+  // Get HSV from display color
+  double cmax = ( r > g )? r: g; cmax = ( b > cmax )? b: cmax;
+  double cmin = ( r < g )? r: g; cmin = ( b < cmin )? b: cmin;
+  double d = cmax - cmin;
+
+  double saturation = ( std::fabs( cmax ) > _0 )? d / cmax: _0;
+  double value = cmax;
+  double hue = _0;
+  if( d > _0 )
+  {
+    if( r == cmax )
+      hue = std::fmod( ( g - b ) / d, _6 );
+    else if( g == cmax )
+      hue = ( ( b - r ) / d ) + _2;
+    else if( b == cmax )
+      hue = ( ( r - g ) / d ) + _4;
+    hue *= _1 / _6;
+    
+  } // fi
+
+  // Define new lookup table
+  vtkSmartPointer< vtkLookupTable > lut =
+    vtkSmartPointer< vtkLookupTable >::New( );
+  lut->SetScaleToLinear( );
+  lut->SetAboveRangeColor( _0, _0, _0, _0 );
+  lut->SetBelowRangeColor( _0, _0, _0, _0 );
+  lut->SetNanColor( _0, _0, _0, _0 );
+  lut->SetTableRange( range[ 0 ], range[ 1 ] );
+  lut->SetAlphaRange( _0, _OPACITY );
+  lut->SetHueRange( _0, hue );
+  lut->SetSaturationRange( _0, saturation );
+  lut->SetValueRange( _0, value );
+  lut->Build( );
+
+  this->SetLookupTable( i, lut );
+}
+
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::MPRActors::
 GetSliceNumberMinValue( const int& axis ) const
@@ -464,7 +563,9 @@ _Image( unsigned int i ) const
     vtkAlgorithm* algo = this->ImageMaps[ i ]->GetInputAlgorithm( );
     vtkInformation* info = algo->GetOutputInformation( 0 );
     return(
-      vtkImageData::SafeDownCast( info->Get( vtkDataObject::DATA_OBJECT( ) ) )
+      vtkImageData::SafeDownCast(
+        info->Get( vtkDataObject::DATA_OBJECT( ) )
+        )
       );
   }
   else
@@ -490,6 +591,16 @@ _Update( unsigned int i )
         );
       this->Slices[ j ][ k ]->UpdateText( );
 
+      // Add all of slice's props
+      this->Slices[ j ][ k ]->InitTraversal( );
+      vtkProp* prop = this->Slices[ j ][ k ]->GetNextProp( );
+      while( prop != NULL )
+      {
+        this->AddItem( prop );
+        prop = this->Slices[ j ][ k ]->GetNextProp( );
+
+      } // elihw
+
     } // rof
 
   } // rof
index 0aafebef6f5ab227410ac9b594e32dfdda72edde..d0de6e01df60b5559ec60a77c7cfc21807ee30a2 100644 (file)
@@ -41,11 +41,6 @@ namespace cpExtensions
       int AddInputConnection( vtkAlgorithmOutput* aout );
       int AddInputData( vtkImageData* image );
 
-      /*
-        void SetInputConnection( vtkAlgorithmOutput* aout );
-        void SetInputData( vtkImageData* image );
-      */
-
       void PushDataInto(
         vtkRenderer* x,
         vtkRenderer* y,
@@ -58,12 +53,7 @@ namespace cpExtensions
         vtkRenderer* z,
         vtkRenderer* w
         );
-      void LinkInteractors( )
-        {
-          this->_Update( 0 );
-          this->_Update( 1 );
-          this->_Update( 2 );
-        }
+      void LinkInteractors( );
 
       // Lookup table methods
       void SetLookupTable( unsigned int i, vtkScalarsToColors* lut );
@@ -79,8 +69,17 @@ namespace cpExtensions
       double GetLevel( unsigned int i ) const;
       void SetWindow( unsigned int i, const double& w );
       void SetLevel( unsigned int i, const double& l );
+      void SetWindowLevel( unsigned int i, const double& w, const double& l );
       void ResetWindowLevel( unsigned int i );
 
+      // Color lookup table
+      void SetLookupTableToColor(
+        unsigned int i,
+        const double& r = double( 1 ),
+        const double& g = double( 0 ),
+        const double& b = double( 0 )
+        );
+
       // Slice access
       int GetSliceNumberMinValue( const int& axis ) const;
       int GetSliceNumberMaxValue( const int& axis ) const;
index aaadf31b1b61ede9daff48099bb27613b232f87f..914c46de29d47490ec867cd2a4e527f65c4ef483 100644 (file)
@@ -1,5 +1,9 @@
 #include <cpExtensions/Visualization/MPRObjects.h>
 
+#include <cmath>
+#include <vtkImageData.h>
+#include <vtkLookupTable.h>
+
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::MPRObjects*
 cpExtensions::Visualization::MPRObjects::
@@ -54,20 +58,33 @@ SetImage( vtkImageData* image )
     this->m_Renderers[ 3 ]
     );
 
-  // Correct cameras positions
-  /* TODO
-     vtkCamera* zCam = this->m_Renderers[ 2 ]->GetActiveCamera( );
-     zCam->SetViewUp( 0, -1, 0 );
-     zCam->SetPosition( 0, 0, -1 );
-     zCam->SetFocalPoint( 0, 0, 0 );
-  */
-
   // First rendering
   this->m_MPRActors->ResetSlices( );
   this->ResetCameras( );
   this->RenderAll( );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+AddAuxiliaryImage( vtkImageData* image )
+{
+  // Try to add new image
+  int id = this->m_MPRActors->AddInputData( image );
+  if( id < 0 )
+    return;
+
+  // Push everything on renderers
+  this->m_MPRActors->PushDataInto(
+    this->m_Renderers[ 0 ],
+    this->m_Renderers[ 1 ],
+    this->m_Renderers[ 2 ],
+    this->m_Renderers[ 3 ]
+    );
+
+  // Rendering
+  this->RenderAll( );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRObjects::
 ActivateInteractors( )
index a348e91513d15c4379091677f4621ee48f3041f1..1a8135012044c928cd02d9af8171e60a879597b1 100644 (file)
@@ -35,6 +35,7 @@ namespace cpExtensions
         vtkRenderWindow* wz, vtkRenderWindow* w3D
         );
       void SetImage( vtkImageData* image );
+      void AddAuxiliaryImage( vtkImageData* image );
       void ActivateInteractors( );
 
       void ResetCamera( const int& id );
index 6d73928e24f27ea70b172cc1029df327c70674f9..a3990cc02c4b674d6d93e77bb94a7a4ef6f7ec27 100644 (file)
@@ -44,11 +44,12 @@ SET(
 
 SET(
   LIB_SOURCES_CXX
+  Instances_itkImage.cxx
+  Instances_itkVectorImage.cxx
+  Instances_itkMesh.cxx
   BaseProcessObjects.cxx
   DataObject.cxx
   Image.cxx
-  Instances_itkImage.cxx
-  Instances_itkMesh.cxx
   Interface.cxx
   Mesh.cxx
   Object.cxx
index 8fadae00bd0e3ff5c5d78e618ff933da14e09430..b9229dd4849ea8f9b05c99b27755e301cfe40945 100644 (file)
 #include <itkVector.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_Export( T, D )                                  \
-  cpPlugins_TEMPLATE_EXPORT(                                            \
-    2(class cpPlugins_Interface_EXPORT itk::Image< T, D >)              \
+#define cpPlugins_ITKImage_Export( T, D )                       \
+  cpPlugins_TEMPLATE_EXPORT(                                    \
+    2(class cpPlugins_Interface_EXPORT itk::Image< T, D >)      \
     )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Export( T, D )                               \
+#define cpPlugins_ITKArrayImage_Export( A, T, DA, DI )                  \
   cpPlugins_TEMPLATE_EXPORT(                                            \
-    2(                                                                  \
-      class cpPlugins_Interface_EXPORT                                  \
-      itk::ImageToVTKImageFilter< itk::Image< T, D > >                  \
-      )                                                                 \
+    3(class cpPlugins_Interface_EXPORT itk::Image< A< T, DA >, DI >)    \
     )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Export( A, T, DA, DI )                     \
-  cpPlugins_TEMPLATE_EXPORT(                                            \
-    3(                                                                  \
-      class cpPlugins_Interface_EXPORT                                  \
-      itk::Image< itk::A< T, DA >, DI >                                 \
-      )                                                                 \
-    )
+#define cpPlugins_ITKImage_AllDims_Export( T )  \
+  cpPlugins_ITKImage_Export( T, 2 );            \
+  cpPlugins_ITKImage_Export( T, 3 );            \
+  cpPlugins_ITKImage_Export( T, 4 )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Export( A, T, DA, DI )                  \
-  cpPlugins_TEMPLATE_EXPORT(                                            \
-    3(                                                                  \
-      class cpPlugins_Interface_EXPORT                                  \
-      itk::ImageToVTKImageFilter< itk::Image< itk::A< T, DA >, DI > >   \
-      )                                                                 \
+#define cpPlugins_ITKArrayImage_AllDims_Export( A, T )  \
+  cpPlugins_ITKArrayImage_Export( A, T, 2, 2 );         \
+  cpPlugins_ITKArrayImage_Export( A, T, 3, 3 );         \
+  cpPlugins_ITKArrayImage_Export( A, T, 4, 4 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VTKImage_Export( T, D )               \
+  cpPlugins_TEMPLATE_EXPORT(                            \
+    2(                                                  \
+      class cpPlugins_Interface_EXPORT                  \
+      itk::ImageToVTKImageFilter< itk::Image< T, D > >  \
+      )                                                 \
     )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Image_Export_AllDimensions( T )       \
-  cpPlugins_Image_Export( T, 2 );                       \
-  cpPlugins_Image_Export( T, 3 );                       \
-  cpPlugins_Image_Export( T, 4 )
+#define cpPlugins_VTKArrayImage_Export( A, T, DA, DI )                  \
+  cpPlugins_TEMPLATE_EXPORT(                                            \
+    3(class                                                             \
+      cpPlugins_Interface_EXPORT                                        \
+      itk::ImageToVTKImageFilter< itk::Image< A< T, DA >, DI > >)       \
+    )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Export_AllDimensions( T )       \
-  cpPlugins_VTKImage_Export( T, 2 );                       \
+#define cpPlugins_VTKImage_AllDims_Export( T )  \
+  cpPlugins_VTKImage_Export( T, 2 );            \
   cpPlugins_VTKImage_Export( T, 3 )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Export_AllDimensions( A, T )             \
-  cpPlugins_ImageArray_Export( A, T, 2, 2 );                          \
-  cpPlugins_ImageArray_Export( A, T, 3, 3 );                          \
-  cpPlugins_ImageArray_Export( A, T, 4, 4 )
+#define cpPlugins_VTKArrayImage_AllDims_Export( A, T )  \
+  cpPlugins_VTKArrayImage_Export( A, T, 2, 2 );         \
+  cpPlugins_VTKArrayImage_Export( A, T, 3, 3 )
 
 // -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Export_AllDimensions( A, T )            \
-  cpPlugins_VTKImageArray_Export( A, T, 2, 2 );                         \
-  cpPlugins_VTKImageArray_Export( A, T, 3, 3 )
-
+#define cpPlugins_Image_Export( T, D )          \
+  cpPlugins_ITKImage_Export( T, D );            \
+  cpPlugins_VTKImage_Export( T, D )             \
+  
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_AllDims_Export( T )     \
+  cpPlugins_ITKImage_AllDims_Export( T );       \
+  cpPlugins_VTKImage_AllDims_Export( T )        \
+  
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_AllDims_Export( A, T )     \
+  cpPlugins_ITKArrayImage_AllDims_Export( A, T );       \
+  cpPlugins_VTKArrayImage_AllDims_Export( A, T )        \
+  
+// -------------------------------------------------------------------------
+// ITK-VTK base clases
 // -------------------------------------------------------------------------
-// ITK base clases
-cpPlugins_Image_Export_AllDimensions( char );
-cpPlugins_Image_Export_AllDimensions( short );
-cpPlugins_Image_Export_AllDimensions( int );
-cpPlugins_Image_Export_AllDimensions( long );
-cpPlugins_Image_Export_AllDimensions( unsigned char );
-cpPlugins_Image_Export_AllDimensions( unsigned short );
-cpPlugins_Image_Export_AllDimensions( unsigned int );
-cpPlugins_Image_Export_AllDimensions( unsigned long );
-cpPlugins_Image_Export_AllDimensions( float );
-cpPlugins_Image_Export_AllDimensions( double );
-
-cpPlugins_Image_Export_AllDimensions( std::complex< float > );
-cpPlugins_Image_Export_AllDimensions( std::complex< double > );
-
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< float > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< double > );
-
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< float > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< double > );
-
-cpPlugins_ImageArray_Export_AllDimensions( Vector, float );
-cpPlugins_ImageArray_Export_AllDimensions( Vector, double );
-
-cpPlugins_ImageArray_Export_AllDimensions( CovariantVector, float );
-cpPlugins_ImageArray_Export_AllDimensions( CovariantVector, double );
-
-cpPlugins_ImageArray_Export_AllDimensions( Point, float );
-cpPlugins_ImageArray_Export_AllDimensions( Point, double );
-
-cpPlugins_ImageArray_Export_AllDimensions(
-  SymmetricSecondRankTensor, float
-  );
-cpPlugins_ImageArray_Export_AllDimensions(
-  SymmetricSecondRankTensor, double
-  );
-
-cpPlugins_Image_Export( itk::DiffusionTensor3D< float >, 3 );
-cpPlugins_Image_Export( itk::DiffusionTensor3D< double >, 3 );
-cpPlugins_Image_Export( itk::DiffusionTensor3D< float >, 4 );
-cpPlugins_Image_Export( itk::DiffusionTensor3D< double >, 4 );
-cpPlugins_Image_Export( itk::Offset< 2 >, 2 );
-cpPlugins_Image_Export( itk::Offset< 3 >, 3 );
-cpPlugins_Image_Export( itk::Offset< 4 >, 4 );
 
+cpPlugins_Image_AllDims_Export( char );
+cpPlugins_Image_AllDims_Export( short );
+cpPlugins_Image_AllDims_Export( int );
+cpPlugins_Image_AllDims_Export( long );
+cpPlugins_Image_AllDims_Export( unsigned char );
+cpPlugins_Image_AllDims_Export( unsigned short );
+cpPlugins_Image_AllDims_Export( unsigned int );
+cpPlugins_Image_AllDims_Export( unsigned long );
+cpPlugins_Image_AllDims_Export( float );
+cpPlugins_Image_AllDims_Export( double );
+
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< float > );
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< double > );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, double );
+
+// -------------------------------------------------------------------------
+// ITK-only base clases
 // -------------------------------------------------------------------------
-// ITK<->VTK base clases
-cpPlugins_VTKImage_Export_AllDimensions( char );
-cpPlugins_VTKImage_Export_AllDimensions( short );
-cpPlugins_VTKImage_Export_AllDimensions( int );
-cpPlugins_VTKImage_Export_AllDimensions( long );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned char );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned short );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned int );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned long );
-cpPlugins_VTKImage_Export_AllDimensions( float );
-cpPlugins_VTKImage_Export_AllDimensions( double );
-
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< long > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned long > );
-
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< long > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned long > );
-
-cpPlugins_VTKImageArray_Export_AllDimensions( Vector, float );
-cpPlugins_VTKImageArray_Export_AllDimensions( Vector, double );
-
-cpPlugins_VTKImageArray_Export_AllDimensions( CovariantVector, float );
-cpPlugins_VTKImageArray_Export_AllDimensions( CovariantVector, double );
-
-cpPlugins_VTKImageArray_Export_AllDimensions( Point, float );
-cpPlugins_VTKImageArray_Export_AllDimensions( Point, double );
-
-cpPlugins_VTKImageArray_Export_AllDimensions(
-  SymmetricSecondRankTensor, float
-  );
-cpPlugins_VTKImageArray_Export_AllDimensions(
-  SymmetricSecondRankTensor, double
-  );
-
-cpPlugins_VTKImage_Export( itk::DiffusionTensor3D< float >, 3 );
-cpPlugins_VTKImage_Export( itk::DiffusionTensor3D< double >, 3 );
+
+cpPlugins_ITKImage_AllDims_Export( std::complex< float > );
+cpPlugins_ITKImage_AllDims_Export( std::complex< double > );
+
+cpPlugins_ITKImage_Export( itk::Offset< 2 >, 2 );
+cpPlugins_ITKImage_Export( itk::Offset< 3 >, 3 );
+cpPlugins_ITKImage_Export( itk::Offset< 4 >, 4 );
 
 // eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/Instances_itkVectorImage.cxx b/lib/cpPlugins/Interface/Instances_itkVectorImage.cxx
new file mode 100644 (file)
index 0000000..3db15c6
--- /dev/null
@@ -0,0 +1,100 @@
+#include <cpPlugins/Interface/Macros.h>
+
+#include <complex>
+
+#include <itkVectorImage.h>
+
+#include <itkCovariantVector.h>
+#include <itkDiffusionTensor3D.h>
+#include <itkPoint.h>
+#include <itkRGBPixel.h>
+#include <itkRGBAPixel.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkVector.h>
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Export( T, D )                                  \
+  cpPlugins_TEMPLATE_EXPORT(                                            \
+    2(class cpPlugins_Interface_EXPORT itk::VectorImage< T, D >)        \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_Export( A, T, DA, DI )                     \
+  cpPlugins_TEMPLATE_EXPORT(                                            \
+    3(class                                                             \
+      cpPlugins_Interface_EXPORT                                        \
+      itk::VectorImage< A< T, DA >, DI >)                               \
+    )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_AllDims_Export( T )  \
+  cpPlugins_Image_Export( T, 2 );            \
+  cpPlugins_Image_Export( T, 3 );            \
+  cpPlugins_Image_Export( T, 4 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_AllDims_Export( A, T )     \
+  cpPlugins_ArrayImage_Export( A, T, 2, 2 );            \
+  cpPlugins_ArrayImage_Export( A, T, 3, 3 );            \
+  cpPlugins_ArrayImage_Export( A, T, 4, 4 )
+
+// -------------------------------------------------------------------------
+// ITK-VTK base clases
+// -------------------------------------------------------------------------
+
+cpPlugins_Image_AllDims_Export( char );
+cpPlugins_Image_AllDims_Export( short );
+cpPlugins_Image_AllDims_Export( int );
+cpPlugins_Image_AllDims_Export( long );
+cpPlugins_Image_AllDims_Export( unsigned char );
+cpPlugins_Image_AllDims_Export( unsigned short );
+cpPlugins_Image_AllDims_Export( unsigned int );
+cpPlugins_Image_AllDims_Export( unsigned long );
+cpPlugins_Image_AllDims_Export( float );
+cpPlugins_Image_AllDims_Export( double );
+
+cpPlugins_Image_AllDims_Export( std::complex< float > );
+cpPlugins_Image_AllDims_Export( std::complex< double > );
+
+cpPlugins_Image_Export( itk::Offset< 2 >, 2 );
+cpPlugins_Image_Export( itk::Offset< 3 >, 3 );
+cpPlugins_Image_Export( itk::Offset< 4 >, 4 );
+
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< float > );
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< double > );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, double );
+
+// eof - $RCSfile$
index 0a6bd60553ee5381f475f4de4d8f2a3dca8e4046..c85cd0c160f3efec4ed0ed482fccdf8fcc3da3dc 100644 (file)
 #define cpPlugins_TEMPLATE_IMPORT( X )          \
   extern template cpPlugins_TEMPLATE_##X;
 
-/* TODO
-   #define cpPlugins_EXPORT_TEMPLATE( E, c, T )                 \
-   cpPlugins_TEMPLATE_##c( cpPlugins_TEMPLATE_EXPORT, E, T )
-   #define cpPlugins_IMPORT_TEMPLATE( E, c, T )                 \
-   cpPlugins_TEMPLATE_##c( cpPlugins_TEMPLATE_IMPORT, E, T )
-*/
-
 #endif // __CPPLUGINS__INTERFACE__MACROS__H__
 
 // eof - $RCSfile$
similarity index 90%
rename from lib/cpPlugins/Plugins/BinaryThresholdImageFilter.cxx
rename to lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx
index 65195e200d0372c84fcee34c3e3b807dbcefe71d..d3d541e8527652d7bafebc8623b9c42ea650e246 100644 (file)
@@ -1,14 +1,14 @@
-#include <cpPlugins/Plugins/BinaryThresholdImageFilter.h>
+#include "BinaryThresholdImageFilter.h"
 #include <cpPlugins/Interface/Image.h>
 
 #include <itkBinaryThresholdImageFilter.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::BinaryThresholdImageFilter::
+cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 BinaryThresholdImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BinaryThresholdImageFilter";
+  this->m_ClassName = "cpPlugins::BasicFilters::BinaryThresholdImageFilter";
   this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
@@ -38,13 +38,13 @@ BinaryThresholdImageFilter( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::BinaryThresholdImageFilter::
+cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 ~BinaryThresholdImageFilter( )
 {
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::BinaryThresholdImageFilter::
+std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 _GenerateData( )
 {
   cpPlugins::Interface::Image* image =
@@ -69,7 +69,7 @@ _GenerateData( )
 
 // -------------------------------------------------------------------------
 template< class I >
-std::string cpPlugins::Plugins::BinaryThresholdImageFilter::
+std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 _DemangleOutput( itk::DataObject* image )
 {
   return(
@@ -81,7 +81,7 @@ _DemangleOutput( itk::DataObject* image )
 
 // -------------------------------------------------------------------------
 template< class I, class O >
-inline std::string cpPlugins::Plugins::BinaryThresholdImageFilter::
+inline std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 _RealGD( itk::DataObject* image )
 {
   typedef itk::BinaryThresholdImageFilter< I, O > _F;
similarity index 90%
rename from lib/cpPlugins/Plugins/BinaryThresholdImageFilter.h
rename to lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h
index d108fb233b2756a7feb3f478bcd3cc56b7182779..b41015102473d38b54cad4e3add0c1adf4f093ad 100644 (file)
@@ -1,16 +1,16 @@
 #ifndef __CPPLUGINS__PLUGINS__BINARYTHRESHOLDIMAGEFILTER__H__
 #define __CPPLUGINS__PLUGINS__BINARYTHRESHOLDIMAGEFILTER__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace BasicFilters
   {
     /**
      */
-    class cpPlugins_EXPORT BinaryThresholdImageFilter
+    class cpPluginsBasicFilters_EXPORT BinaryThresholdImageFilter
       : public cpPlugins::Interface::ImageToImageFilter
     {
     public:
diff --git a/lib/cpPlugins/Plugins/BasicFilters/CMakeLists.txt b/lib/cpPlugins/Plugins/BasicFilters/CMakeLists.txt
new file mode 100644 (file)
index 0000000..820b54d
--- /dev/null
@@ -0,0 +1,56 @@
+SET(LIBRARY_NAME cpPluginsBasicFilters)
+
+## ===============
+## = Source code =
+## ===============
+
+FILE(GLOB LIB_HEADERS_H   "*.h")
+FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_SOURCES_C   "*.c")
+FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+## =====================
+## = Compilation rules =
+## =====================
+
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${LIBRARY_NAME}_Host.cxx
+  DEPENDS ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIB_HEADERS_H} ${LIB_HEADERS_HPP} ${LIB_HEADERS_HXX}
+  COMMAND ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIBRARY_NAME}_Host.cxx cpPlugins::BasicFilters ${LIB_HEADERS_H}
+  )
+
+ADD_LIBRARY(
+  ${LIBRARY_NAME}
+  SHARED
+  ${LIBRARY_NAME}_Host.cxx
+  ${LIB_SOURCES_C}
+  ${LIB_SOURCES_CPP}
+  ${LIB_SOURCES_CXX}
+  )
+GENERATE_EXPORT_HEADER(
+  ${LIBRARY_NAME}
+  BASE_NAME ${LIBRARY_NAME}
+  EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
+  EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/BasicFilters/${LIBRARY_NAME}_Export.h
+  STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
+  )
+TARGET_LINK_LIBRARIES(
+  ${LIBRARY_NAME}
+  cpPlugins_Interface
+  cpExtensions
+  )
+
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+  TARGETS ${LIBRARY_NAME}
+  RUNTIME DESTINATION bin
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib/static
+  )
+
+## eof - $RCSfile$
similarity index 90%
rename from lib/cpPlugins/Plugins/MarchingCubes.cxx
rename to lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx
index 94af090e1c2831d1cf09d5bb1818037d4e9b1078..38f7dbc848c987daa95e1b45a69fe58d1cdc7275 100644 (file)
@@ -1,4 +1,4 @@
-#include <cpPlugins/Plugins/MarchingCubes.h>
+#include "MarchingCubes.h"
 #include <cpPlugins/Interface/Image.h>
 #include <cpPlugins/Interface/Mesh.h>
 
@@ -7,12 +7,12 @@
 #include <vtkMarchingSquares.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MarchingCubes::
+cpPlugins::BasicFilters::MarchingCubes::
 MarchingCubes( )
   : Superclass( ),
     m_Algorithm( NULL )
 {
-  this->m_ClassName = "cpPlugins::MarchingCubes";
+  this->m_ClassName = "cpPlugins::BasicFilters::MarchingCubes";
   this->m_ClassCategory = "ImageToMeshFilter";
 
   this->SetNumberOfInputs( 1 );
@@ -25,7 +25,7 @@ MarchingCubes( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MarchingCubes::
+cpPlugins::BasicFilters::MarchingCubes::
 ~MarchingCubes( )
 {
   if( this->m_Algorithm != NULL )
@@ -33,7 +33,7 @@ cpPlugins::Plugins::MarchingCubes::
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MarchingCubes::
+std::string cpPlugins::BasicFilters::MarchingCubes::
 _GenerateData( )
 {
   // Get input
similarity index 89%
rename from lib/cpPlugins/Plugins/MarchingCubes.h
rename to lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h
index b675bba69ac30c217df5f5539cf8e44f8895884e..a5790e9ac157024c76eed4bca67b71ef48263820 100644 (file)
@@ -1,18 +1,18 @@
 #ifndef __CPPLUGINS__PLUGINS__MARCHINGCUBES__H__
 #define __CPPLUGINS__PLUGINS__MARCHINGCUBES__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 class vtkPolyDataAlgorithm;
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace BasicFilters
   {
     /**
      */
-    class cpPlugins_EXPORT MarchingCubes
+    class cpPluginsBasicFilters_EXPORT MarchingCubes
       : public cpPlugins::Interface::ImageToMeshFilter
     {
     public:
similarity index 87%
rename from lib/cpPlugins/Plugins/MedianImageFilter.cxx
rename to lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
index e2079677270de494a6f38a9a230f44f43dd681ba..53a9d28c5d9a867e83ede882be432df25c3a34e5 100644 (file)
@@ -1,14 +1,14 @@
-#include <cpPlugins/Plugins/MedianImageFilter.h>
+#include "MedianImageFilter.h"
 #include <cpPlugins/Interface/Image.h>
 
 #include <itkMedianImageFilter.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MedianImageFilter::
+cpPlugins::BasicFilters::MedianImageFilter::
 MedianImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::MedianImageFilter";
+  this->m_ClassName = "cpPlugins::BasicFilters::MedianImageFilter";
   this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
@@ -23,13 +23,13 @@ MedianImageFilter( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MedianImageFilter::
+cpPlugins::BasicFilters::MedianImageFilter::
 ~MedianImageFilter( )
 {
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MedianImageFilter::
+std::string cpPlugins::BasicFilters::MedianImageFilter::
 _GenerateData( )
 {
   cpPlugins::Interface::Image* image =
@@ -54,7 +54,7 @@ _GenerateData( )
 
 // -------------------------------------------------------------------------
 template< class I >
-std::string cpPlugins::Plugins::MedianImageFilter::
+std::string cpPlugins::BasicFilters::MedianImageFilter::
 _DemangleOutput( itk::DataObject* image )
 {
   return(
@@ -66,7 +66,7 @@ _DemangleOutput( itk::DataObject* image )
 
 // -------------------------------------------------------------------------
 template< class I, class O >
-inline std::string cpPlugins::Plugins::MedianImageFilter::
+inline std::string cpPlugins::BasicFilters::MedianImageFilter::
 _RealGD( itk::DataObject* image )
 {
   typedef itk::MedianImageFilter< I, O > _F;
similarity index 90%
rename from lib/cpPlugins/Plugins/MedianImageFilter.h
rename to lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h
index 3ee8db491db356c0ccfc54201a546acc88ae0385..a4d4679c29378ca2bb7a06d614108b376b167e29 100644 (file)
@@ -1,16 +1,16 @@
 #ifndef __CPPLUGINS__PLUGINS__MEDIANIMAGEFILTER__H__
 #define __CPPLUGINS__PLUGINS__MEDIANIMAGEFILTER__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace BasicFilters
   {
     /**
      */
-    class cpPlugins_EXPORT MedianImageFilter
+    class cpPluginsBasicFilters_EXPORT MedianImageFilter
       : public cpPlugins::Interface::ImageToImageFilter
     {
     public:
similarity index 88%
rename from lib/cpPlugins/Plugins/OtsuThresholdImageFilter.cxx
rename to lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
index dc6fd942f2c70a0f378352e94b435d4cb49e9dae..6e0d36fa29b72d8ee354129fbf3c45f82df53f0d 100644 (file)
@@ -1,14 +1,14 @@
-#include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
+#include "OtsuThresholdImageFilter.h"
 #include <cpPlugins/Interface/Image.h>
 
 #include <itkOtsuThresholdImageFilter.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::OtsuThresholdImageFilter::
+cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 OtsuThresholdImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::OtsuThresholdImageFilter";
+  this->m_ClassName = "cpPlugins::BasicFilters::OtsuThresholdImageFilter";
   this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
@@ -27,13 +27,13 @@ OtsuThresholdImageFilter( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::OtsuThresholdImageFilter::
+cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 ~OtsuThresholdImageFilter( )
 {
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
+std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 _GenerateData( )
 {
   cpPlugins::Interface::Image* image =
@@ -58,7 +58,7 @@ _GenerateData( )
 
 // -------------------------------------------------------------------------
 template< class I >
-std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
+std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 _DemangleOutput( itk::DataObject* image )
 {
   return(
@@ -70,7 +70,7 @@ _DemangleOutput( itk::DataObject* image )
 
 // -------------------------------------------------------------------------
 template< class I, class O >
-inline std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
+inline std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 _RealGD( itk::DataObject* image )
 {
   typedef itk::OtsuThresholdImageFilter< I, O > _F;
similarity index 90%
rename from lib/cpPlugins/Plugins/OtsuThresholdImageFilter.h
rename to lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h
index 3d35287ec24b15e4a5de2cd888f44a878b98d6fe..6a112d0d4cb8adf3973ebdb433cfe8a4f2b2be15 100644 (file)
@@ -1,16 +1,16 @@
 #ifndef __CPPLUGINS__PLUGINS__OTSUTHRESHOLDIMAGEFILTER__H__
 #define __CPPLUGINS__PLUGINS__OTSUTHRESHOLDIMAGEFILTER__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace BasicFilters
   {
     /**
      */
-    class cpPlugins_EXPORT OtsuThresholdImageFilter
+    class cpPluginsBasicFilters_EXPORT OtsuThresholdImageFilter
       : public cpPlugins::Interface::ImageToImageFilter
     {
     public:
similarity index 91%
rename from lib/cpPlugins/Plugins/RGBImageToOtherChannelsFilter.cxx
rename to lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
index 6cc0d1ca96a45eba1b813aeb3f00fd2464912d44..7f5b1fc8f923860d20694910bab28c39c0368127 100644 (file)
@@ -1,4 +1,4 @@
-#include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
+#include "RGBImageToOtherChannelsFilter.h"
 #include <cpPlugins/Interface/Image.h>
 
 #include <cpExtensions/Algorithms/RGBImageToOtherChannelsFilter.h>
@@ -7,13 +7,13 @@
 #include <cpExtensions/Algorithms/RGBToYPbPrFunction.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 RGBImageToOtherChannelsFilter( )
   : Superclass( )
 {
   typedef cpPlugins::Interface::Parameters TParameters;
 
-  this->m_ClassName = "cpPlugins::RGBImageToOtherChannelsFilter";
+  this->m_ClassName = "cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter";
   this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
@@ -24,7 +24,7 @@ RGBImageToOtherChannelsFilter( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 ~RGBImageToOtherChannelsFilter( )
 {
 }
@@ -49,7 +49,7 @@ cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
     )
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _GenerateData( )
 {
   cpPlugins::Interface::Image* image =
@@ -74,7 +74,7 @@ _GenerateData( )
 
 // -------------------------------------------------------------------------
 template< class I >
-std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _DemangleOutput( itk::DataObject* image )
 {
   typedef typename I::PixelType _P;
@@ -98,7 +98,7 @@ _DemangleOutput( itk::DataObject* image )
 
 // -------------------------------------------------------------------------
 template< class I, class C >
-std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _RealGD( itk::DataObject* image )
 {
   typedef itk::Image< itk::RGBPixel< double >, I::ImageDimension > _O;
similarity index 90%
rename from lib/cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h
rename to lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h
index 0ccb16cf7b225c212f24be87b1a3af8e5d617baa..6d215f1ff840e1d1395ec079881fcf987bde703a 100644 (file)
@@ -1,16 +1,16 @@
 #ifndef __CPPLUGINS__PLUGINS__RGBIMAGETOOTHERCHANNELSFILTER__H__
 #define __CPPLUGINS__PLUGINS__RGBIMAGETOOTHERCHANNELSFILTER__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace BasicFilters
   {
     /**
      */
-    class cpPlugins_EXPORT RGBImageToOtherChannelsFilter
+    class cpPluginsBasicFilters_EXPORT RGBImageToOtherChannelsFilter
       : public cpPlugins::Interface::ImageToImageFilter
     {
     public:
index d908e42381522f7b20c88317362cf6aaf677b418..477f5007fe29127c8203e2b8d6d3f9e7e712f2e3 100644 (file)
@@ -1,49 +1,61 @@
-SET(LIBRARY_NAME cpPlugins)
-
-## ===============
-## = Source code =
-## ===============
-
-FILE(GLOB LIB_HEADERS_H   "*.h")
-FILE(GLOB LIB_HEADERS_HPP "*.hpp")
-FILE(GLOB LIB_HEADERS_HXX "*.hxx")
-FILE(GLOB LIB_SOURCES_C   "*.c")
-FILE(GLOB LIB_SOURCES_CPP "*.cpp")
-FILE(GLOB LIB_SOURCES_CXX "*.cxx")
-
-## =====================
-## = Compilation rules =
-## =====================
-
-ADD_LIBRARY(
-  ${LIBRARY_NAME}
-  SHARED
-  ${LIB_SOURCES_C}
-  ${LIB_SOURCES_CPP}
-  ${LIB_SOURCES_CXX}
-  )
-GENERATE_EXPORT_HEADER(
-  ${LIBRARY_NAME}
-  BASE_NAME ${LIBRARY_NAME}
-  EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
-  EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/Plugins/${LIBRARY_NAME}_Export.h
-  STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
-  )
-TARGET_LINK_LIBRARIES(
-  ${LIBRARY_NAME}
-  cpExtensions
-  cpPlugins_Interface
+SUBDIRS(
+  IO
+  BasicFilters
   )
 
-## ========================
-## -- Installation rules --
-## ========================
+# SET(LIBRARY_NAME cpPlugins)
 
-INSTALL(
-  TARGETS ${LIBRARY_NAME}
-  RUNTIME DESTINATION bin
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib/static
-  )
+# ## ===============
+# ## = Source code =
+# ## ===============
+
+# FILE(GLOB LIB_HEADERS_H   "*.h")
+# FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+# FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+# FILE(GLOB LIB_SOURCES_C   "*.c")
+# FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+# FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+# ## =====================
+# ## = Compilation rules =
+# ## =====================
+
+# ADD_CUSTOM_COMMAND(
+#   OUTPUT ${LIBRARY_NAME}_Host.cxx
+#   DEPENDS ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIB_HEADERS_H} ${LIB_HEADERS_HPP} ${LIB_HEADERS_HXX}
+#   COMMAND ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIBRARY_NAME}_Host.cxx cpPlugins::Plugins ${LIB_HEADERS_H}
+#   )
+
+# ADD_LIBRARY(
+#   ${LIBRARY_NAME}
+#   SHARED
+#   ${LIBRARY_NAME}_Host.cxx
+#   ${LIB_SOURCES_C}
+#   ${LIB_SOURCES_CPP}
+#   ${LIB_SOURCES_CXX}
+#   )
+# GENERATE_EXPORT_HEADER(
+#   ${LIBRARY_NAME}
+#   BASE_NAME ${LIBRARY_NAME}
+#   EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
+#   EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/Plugins/${LIBRARY_NAME}_Export.h
+#   STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
+#   )
+# TARGET_LINK_LIBRARIES(
+#   ${LIBRARY_NAME}
+#   cpExtensions
+#   cpPlugins_Interface
+#   )
+
+# ## ========================
+# ## -- Installation rules --
+# ## ========================
+
+# INSTALL(
+#   TARGETS ${LIBRARY_NAME}
+#   RUNTIME DESTINATION bin
+#   LIBRARY DESTINATION lib
+#   ARCHIVE DESTINATION lib/static
+#   )
 
-## eof - $RCSfile$
+# ## eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/Host.cxx b/lib/cpPlugins/Plugins/Host.cxx
deleted file mode 100644 (file)
index e16e01e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <Pluma/Connector.hpp>
-#include <cpPlugins/Plugins/ImageReader.h>
-#include <cpPlugins/Plugins/ImageWriter.h>
-#include <cpPlugins/Plugins/MeshReader.h>
-#include <cpPlugins/Plugins/MeshWriter.h>
-#include <cpPlugins/Plugins/MarchingCubes.h>
-#include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
-#include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
-#include <cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h>
-#include <cpPlugins/Plugins/BinaryThresholdImageFilter.h>
-#include <cpPlugins/Plugins/MedianImageFilter.h>
-
-/// TODO: doc
-PLUMA_CONNECTOR
-bool connect( pluma::Host& host )
-{
-  using namespace cpPlugins::Plugins;
-
-  host.add( new ImageReaderProvider( ) );
-  host.add( new ImageWriterProvider( ) );
-  host.add( new MeshReaderProvider( ) );
-  host.add( new MeshWriterProvider( ) );
-  host.add( new MarchingCubesProvider( ) );
-  host.add( new OtsuThresholdImageFilterProvider( ) );
-  host.add( new RGBImageToOtherChannelsFilterProvider( ) );
-  host.add( new SecondRankDiffusionTensorToPolyDataProvider( ) );
-  host.add( new BinaryThresholdImageFilterProvider( ) );
-  host.add( new MedianImageFilterProvider( ) );
-
-  return( true );
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/IO/CMakeLists.txt b/lib/cpPlugins/Plugins/IO/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f1a7a46
--- /dev/null
@@ -0,0 +1,55 @@
+SET(LIBRARY_NAME cpPluginsIO)
+
+## ===============
+## = Source code =
+## ===============
+
+FILE(GLOB LIB_HEADERS_H   "*.h")
+FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_SOURCES_C   "*.c")
+FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+## =====================
+## = Compilation rules =
+## =====================
+
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${LIBRARY_NAME}_Host.cxx
+  DEPENDS ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIB_HEADERS_H} ${LIB_HEADERS_HPP} ${LIB_HEADERS_HXX}
+  COMMAND ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIBRARY_NAME}_Host.cxx cpPlugins::IO ${LIB_HEADERS_H}
+  )
+
+ADD_LIBRARY(
+  ${LIBRARY_NAME}
+  SHARED
+  ${LIBRARY_NAME}_Host.cxx
+  ${LIB_SOURCES_C}
+  ${LIB_SOURCES_CPP}
+  ${LIB_SOURCES_CXX}
+  )
+GENERATE_EXPORT_HEADER(
+  ${LIBRARY_NAME}
+  BASE_NAME ${LIBRARY_NAME}
+  EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
+  EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/IO/${LIBRARY_NAME}_Export.h
+  STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
+  )
+TARGET_LINK_LIBRARIES(
+  ${LIBRARY_NAME}
+  cpPlugins_Interface
+  )
+
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+  TARGETS ${LIBRARY_NAME}
+  RUNTIME DESTINATION bin
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib/static
+  )
+
+## eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.cxx b/lib/cpPlugins/Plugins/IO/ImageReader.cxx
new file mode 100644 (file)
index 0000000..38739df
--- /dev/null
@@ -0,0 +1,396 @@
+#include "ImageReader.h"
+#include <cpPlugins/Interface/Image.h>
+
+#include <set>
+
+#include <itkImageFileReader.h>
+#include <itkImageSeriesReader.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::IO::ImageReader::
+ImageReader( )
+  : Superclass( )
+{
+  this->m_ClassName = "cpPlugins::IO::ImageReader";
+  this->m_ClassCategory = "ImageReader";
+
+  this->SetNumberOfOutputs( 1 );
+  this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+
+  using namespace cpPlugins::Interface;
+  this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
+  this->m_DefaultParameters.Configure( Parameters::Bool, "VectorType" );
+  this->m_DefaultParameters.SetValueAsBool( "VectorType", false );
+  this->m_Parameters = this->m_DefaultParameters;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::IO::ImageReader::
+~ImageReader( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::IO::ImageReader::
+_GenerateData( )
+{
+  // Get filenames
+  TStringList names;
+  this->m_Parameters.GetValueAsStringList( names, "FileNames" );
+
+  std::string r = "";
+  if( names.size( ) >= 1 )
+  {
+    // Guess image properties
+    itk::ImageIOBase::Pointer io =
+      itk::ImageIOFactory::CreateImageIO(
+        names[ 0 ].c_str( ),
+        itk::ImageIOFactory::ReadMode
+        );
+    if( io.IsNotNull( ) )
+    {
+      io->SetFileName( names[ 0 ] );
+      io->ReadImageInformation( );
+      if( names.size( ) >= 1 )
+      {
+        switch( io->GetNumberOfDimensions( ) )
+        {
+        case 2: r = this->_GD0< 2 >( io, names ); break;
+        case 3: r = this->_GD0< 3 >( io, names ); break;
+        case 4: r = this->_GD0< 4 >( io, names ); break;
+        default:
+          r = "ImageReader: Image dimension not supported.";
+          break;
+        } // hctiws
+
+      } // fi
+    }
+    else
+      r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\"";
+  }
+  else
+    r = "No image files given";
+  return( r );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int D >
+std::string cpPlugins::IO::ImageReader::
+_GD0( itk::ImageIOBase* io, const TStringList& names )
+{
+  itk::ImageIOBase::IOComponentType ct = io->GetComponentType( );
+  itk::ImageIOBase::IOPixelType pt = io->GetPixelType( );
+  std::string r = "";
+
+  if( pt == itk::ImageIOBase::SCALAR )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::UCHAR:
+      r = this->_GD1< unsigned char, D >( names );
+      break;
+    case itk::ImageIOBase::CHAR:
+      r = this->_GD1< char, D >( names );
+      break;
+    case itk::ImageIOBase::USHORT:
+      r = this->_GD1< unsigned short, D >( names );
+      break;
+    case itk::ImageIOBase::SHORT:
+      r = this->_GD1< short, D >( names );
+      break;
+    case itk::ImageIOBase::UINT:
+      r = this->_GD1< unsigned int, D >( names );
+      break;
+    case itk::ImageIOBase::INT:
+      r = this->_GD1< int, D >( names );
+      break;
+    case itk::ImageIOBase::ULONG:
+      r = this->_GD1< unsigned long, D >( names );
+      break;
+    case itk::ImageIOBase::LONG:
+      r = this->_GD1< long, D >( names );
+      break;
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< float, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< double, D >( names );
+      break;
+    default:
+      r = "ImageReader: Scalar pixel type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::RGB )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::UCHAR:
+      r = this->_GD1< itk::RGBPixel< unsigned char >, D >( names );
+      break;
+    case itk::ImageIOBase::CHAR:
+      r = this->_GD1< itk::RGBPixel< char >, D >( names );
+      break;
+    case itk::ImageIOBase::USHORT:
+      r = this->_GD1< itk::RGBPixel< unsigned short >, D >( names );
+      break;
+    case itk::ImageIOBase::SHORT:
+      r = this->_GD1< itk::RGBPixel< short >, D >( names );
+      break;
+    case itk::ImageIOBase::UINT:
+      r = this->_GD1< itk::RGBPixel< unsigned int >, D >( names );
+      break;
+    case itk::ImageIOBase::INT:
+      r = this->_GD1< itk::RGBPixel< int >, D >( names );
+      break;
+    case itk::ImageIOBase::ULONG:
+      r = this->_GD1< itk::RGBPixel< unsigned long >, D >( names );
+      break;
+    case itk::ImageIOBase::LONG:
+      r = this->_GD1< itk::RGBPixel< long >, D >( names );
+      break;
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< itk::RGBPixel< float >, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< itk::RGBPixel< double >, D >( names );
+      break;
+    default:
+      r = "ImageReader: RGB pixel type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::RGBA )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::UCHAR:
+      r = this->_GD1< itk::RGBAPixel< unsigned char >, D >( names );
+      break;
+    case itk::ImageIOBase::CHAR:
+      r = this->_GD1< itk::RGBAPixel< char >, D >( names );
+      break;
+    case itk::ImageIOBase::USHORT:
+      r = this->_GD1< itk::RGBAPixel< unsigned short >, D >( names );
+      break;
+    case itk::ImageIOBase::SHORT:
+      r = this->_GD1< itk::RGBAPixel< short >, D >( names );
+      break;
+    case itk::ImageIOBase::UINT:
+      r = this->_GD1< itk::RGBAPixel< unsigned int >, D >( names );
+      break;
+    case itk::ImageIOBase::INT:
+      r = this->_GD1< itk::RGBAPixel< int >, D >( names );
+      break;
+    case itk::ImageIOBase::ULONG:
+      r = this->_GD1< itk::RGBAPixel< unsigned long >, D >( names );
+      break;
+    case itk::ImageIOBase::LONG:
+      r = this->_GD1< itk::RGBAPixel< long >, D >( names );
+      break;
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< itk::RGBAPixel< float >, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< itk::RGBAPixel< double >, D >( names );
+      break;
+    default:
+      r = "ImageReader: RGBA pixel type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::VECTOR )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< itk::Vector< float, D >, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< itk::Vector< double, D >, D >( names );
+      break;
+    default:
+      r = "ImageReader: Vector type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::POINT )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< itk::Point< float, D >, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< itk::Point< double, D >, D >( names );
+      break;
+    default:
+      r = "ImageReader: Point type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::COVARIANTVECTOR )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< itk::CovariantVector< float, D >, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< itk::CovariantVector< double, D >, D >( names );
+      break;
+    default:
+      r = "ImageReader: CovariantVector type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::FLOAT:
+      r =
+        this->_GD1< itk::SymmetricSecondRankTensor< float, D >, D >(
+          names
+          );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r =
+        this->_GD1< itk::SymmetricSecondRankTensor< double, D >, D >(
+          names
+          );
+      break;
+    default:
+      r = "ImageReader: Vector type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< itk::DiffusionTensor3D< float >, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< itk::DiffusionTensor3D< double >, D >( names );
+      break;
+    default:
+      r = "ImageReader: Diffusion tensor type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::COMPLEX )
+  {
+    switch( ct )
+    {
+    case itk::ImageIOBase::FLOAT:
+      r = this->_GD1< std::complex< float >, D >( names );
+      break;
+    case itk::ImageIOBase::DOUBLE:
+      r = this->_GD1< std::complex< double >, D >( names );
+      break;
+    default:
+      r = "ImageReader: Complex type not supported.";
+      break;
+    } // hctiws
+  }
+  else if( pt == itk::ImageIOBase::OFFSET )
+    r = this->_GD1< itk::Offset< D >, D >( names );
+  else
+    r = "ImageReader: Image pixel type not yet supported.";
+  /* TODO
+     itk::ImageIOBase::FIXEDARRAY
+     itk::ImageIOBase::MATRIX
+  */
+  return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+std::string cpPlugins::IO::ImageReader::
+_GD1( const TStringList& names )
+{
+  if( this->m_Parameters.GetValueAsBool( "VectorType" ) )
+    return( this->_RealGD< itk::VectorImage< P, D > >( names ) );
+  else
+    return( this->_RealGD< itk::Image< P, D > >( names ) );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string cpPlugins::IO::ImageReader::
+_RealGD( const TStringList& names )
+{
+  cpPlugins::Interface::Image* out =
+    this->GetOutput< cpPlugins::Interface::Image >( 0 );
+  if( out == NULL )
+    return( "ImageReader: No output object properly created." );
+
+  std::string r = "";
+  if( names.size( ) == 1 )
+  {
+    // 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
+    reader->SetFileName( names[ 0 ] );
+    try
+    {
+      reader->Update( );
+      out->SetITKImage< I >( reader->GetOutput( ) );
+    }
+    catch( itk::ExceptionObject& err )
+    {
+      r = "ImageReader: " + std::string( err.GetDescription( ) );
+      out->SetITKImage< I >( NULL );
+
+    } // yrt
+  }
+  else if( names.size( ) > 1 )
+  {
+    // Read image series
+    std::set< std::string > ordered_names;
+    for( unsigned int i = 0; i < names.size( ); ++i )
+      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
+    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( ) );
+    }
+    catch( itk::ExceptionObject& err )
+    {
+      r = "ImageReader: " + std::string( err.GetDescription( ) );
+      out->SetITKImage< I >( NULL );
+
+    } // yrt
+  }
+  else
+    r = "ImageReader: No image files given";
+  return( r );
+}
+
+// eof - $RCSfile$
similarity index 88%
rename from lib/cpPlugins/Plugins/ImageReader.h
rename to lib/cpPlugins/Plugins/IO/ImageReader.h
index 1bcf6aec5fff1c8c327894c3dd450dbd818444ae..803e5f81189ef745767708e121d707893c802c41 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <vector>
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 namespace itk
@@ -13,11 +13,11 @@ namespace itk
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace IO
   {
     /**
      */
-    class cpPlugins_EXPORT ImageReader
+    class cpPluginsIO_EXPORT ImageReader
       : public cpPlugins::Interface::ImageSource
     {
     public:
@@ -44,6 +44,9 @@ namespace cpPlugins
         std::string _GD0( itk::ImageIOBase* io, const TStringList& names );
 
       template< class P, unsigned int D >
+        std::string _GD1( const TStringList& names );
+
+      template< class I >
         std::string _RealGD( const TStringList& names );
 
     private:
similarity index 90%
rename from lib/cpPlugins/Plugins/ImageWriter.cxx
rename to lib/cpPlugins/Plugins/IO/ImageWriter.cxx
index 59dbe83795e526d3f4f041e8a3d75725e20a216b..6a0de2ed09dc730cdeab376e3c7ce3c9684e7b43 100644 (file)
@@ -1,14 +1,14 @@
-#include <cpPlugins/Plugins/ImageWriter.h>
+#include "ImageWriter.h"
 #include <cpPlugins/Interface/Image.h>
 
 #include <itkImageFileWriter.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageWriter::
+cpPlugins::IO::ImageWriter::
 ImageWriter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::ImageWriter";
+  this->m_ClassName = "cpPlugins::IO::ImageWriter";
   this->m_ClassCategory = "ImageWriter";
   this->SetNumberOfInputs( 1 );
 
@@ -18,13 +18,13 @@ ImageWriter( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageWriter::
+cpPlugins::IO::ImageWriter::
 ~ImageWriter( )
 {
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageWriter::
+std::string cpPlugins::IO::ImageWriter::
 _GenerateData( )
 {
   cpPlugins::Interface::Image* image =
@@ -58,7 +58,7 @@ _GenerateData( )
 
 // -------------------------------------------------------------------------
 template< class I >
-std::string cpPlugins::Plugins::ImageWriter::
+std::string cpPlugins::IO::ImageWriter::
 _RealGD( itk::DataObject* image )
 {
   typedef itk::ImageFileWriter< I > _W;
similarity index 91%
rename from lib/cpPlugins/Plugins/ImageWriter.h
rename to lib/cpPlugins/Plugins/IO/ImageWriter.h
index 4fc04f5a34545eb862e2093c1ad6077d6fa580e3..9c3b0ceebaadfb50c4093acdd5af8838fd3cb1b9 100644 (file)
@@ -1,16 +1,16 @@
 #ifndef __CPPLUGINS__PLUGINS__IMAGEWRITER__H__
 #define __CPPLUGINS__PLUGINS__IMAGEWRITER__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace IO
   {
     /**
      */
-    class cpPlugins_EXPORT ImageWriter
+    class cpPluginsIO_EXPORT ImageWriter
       : public cpPlugins::Interface::ImageSink
     {
     public:
similarity index 89%
rename from lib/cpPlugins/Plugins/MeshReader.cxx
rename to lib/cpPlugins/Plugins/IO/MeshReader.cxx
index 199325954b24e817bc063e99784bbec405cb5b7c..67069046163d768395fc55d2e23c5b8a871f6497 100644 (file)
@@ -1,16 +1,16 @@
-#include <cpPlugins/Plugins/MeshReader.h>
+#include "MeshReader.h"
 #include <cpPlugins/Interface/Mesh.h>
 
 #include <vtkPolyData.h>
 #include <vtkPolyDataReader.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshReader::
+cpPlugins::IO::MeshReader::
 MeshReader( )
   : Superclass( ),
     m_Reader( NULL )
 {
-  this->m_ClassName = "cpPlugins::MeshReader";
+  this->m_ClassName = "cpPlugins::IO::MeshReader";
   this->m_ClassCategory = "MeshReader";
 
   this->SetNumberOfOutputs( 1 );
@@ -26,7 +26,7 @@ MeshReader( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshReader::
+cpPlugins::IO::MeshReader::
 ~MeshReader( )
 {
   if( this->m_Reader != NULL )
@@ -34,7 +34,7 @@ cpPlugins::Plugins::MeshReader::
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MeshReader::
+std::string cpPlugins::IO::MeshReader::
 _GenerateData( )
 {
   using namespace cpPlugins::Interface;
@@ -49,7 +49,7 @@ _GenerateData( )
 
 // -------------------------------------------------------------------------
 template< unsigned int D >
-std::string cpPlugins::Plugins::MeshReader::
+std::string cpPlugins::IO::MeshReader::
 _GD0( )
 {
   using namespace cpPlugins::Interface;
@@ -62,7 +62,7 @@ _GD0( )
 
 // -------------------------------------------------------------------------
 template< class P, unsigned int D >
-std::string cpPlugins::Plugins::MeshReader::
+std::string cpPlugins::IO::MeshReader::
 _GD1( )
 {
   // Get filename
similarity index 92%
rename from lib/cpPlugins/Plugins/MeshReader.h
rename to lib/cpPlugins/Plugins/IO/MeshReader.h
index 394f6a80bfe652447a761d282aace6d75d974193..224cc039d935f7704b7545592c4e57e138b8ac5c 100644 (file)
@@ -1,18 +1,18 @@
 #ifndef __CPPLUGINS__PLUGINS__MESHREADER__H__
 #define __CPPLUGINS__PLUGINS__MESHREADER__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 class vtkDataReader;
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace IO
   {
     /**
      */
-    class cpPlugins_EXPORT MeshReader
+    class cpPluginsIO_EXPORT MeshReader
       : public cpPlugins::Interface::MeshSource
     {
     public:
similarity index 87%
rename from lib/cpPlugins/Plugins/MeshWriter.cxx
rename to lib/cpPlugins/Plugins/IO/MeshWriter.cxx
index 6cc7841982c87ce2fcb98d405783076dd9090bdb..ade28b87e5b8b85e8d8952ac6e358443151a047d 100644 (file)
@@ -1,4 +1,4 @@
-#include <cpPlugins/Plugins/MeshWriter.h>
+#include "MeshWriter.h"
 #include <cpPlugins/Interface/Mesh.h>
 
 #include <vtkSmartPointer.h>
@@ -6,12 +6,12 @@
 #include <vtkPolyDataWriter.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshWriter::
+cpPlugins::IO::MeshWriter::
 MeshWriter( )
   : Superclass( ),
     m_Writer( NULL )
 {
-  this->m_ClassName = "cpPlugins::MeshWriter";
+  this->m_ClassName = "cpPlugins::IO::MeshWriter";
   this->m_ClassCategory = "MeshWriter";
   this->SetNumberOfInputs( 1 );
 
@@ -21,7 +21,7 @@ MeshWriter( )
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshWriter::
+cpPlugins::IO::MeshWriter::
 ~MeshWriter( )
 {
   if( this->m_Writer != NULL )
@@ -29,7 +29,7 @@ cpPlugins::Plugins::MeshWriter::
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MeshWriter::
+std::string cpPlugins::IO::MeshWriter::
 _GenerateData( )
 {
   cpPlugins::Interface::Mesh* mesh =
similarity index 91%
rename from lib/cpPlugins/Plugins/MeshWriter.h
rename to lib/cpPlugins/Plugins/IO/MeshWriter.h
index d1fc2cc5b8637a8060e5f12ae74f460606465be6..cd776f61b7db07bbb9397afc65e264fda0009eb8 100644 (file)
@@ -1,18 +1,18 @@
 #ifndef __CPPLUGINS__PLUGINS__MESHWRITER__H__
 #define __CPPLUGINS__PLUGINS__MESHWRITER__H__
 
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
 #include <cpPlugins/Interface/BaseProcessObjects.h>
 
 class vtkDataWriter;
 
 namespace cpPlugins
 {
-  namespace Plugins
+  namespace IO
   {
     /**
      */
-    class cpPlugins_EXPORT MeshWriter
+    class cpPluginsIO_EXPORT MeshWriter
       : public cpPlugins::Interface::MeshSink
     {
     public:
diff --git a/lib/cpPlugins/Plugins/ImageReader.cxx b/lib/cpPlugins/Plugins/ImageReader.cxx
deleted file mode 100644 (file)
index 73611cb..0000000
+++ /dev/null
@@ -1,586 +0,0 @@
-#include <cpPlugins/Plugins/ImageReader.h>
-#include <cpPlugins/Interface/Image.h>
-
-#include <set>
-
-#include <itkImageFileReader.h>
-#include <itkImageSeriesReader.h>
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageReader::
-ImageReader( )
-  : Superclass( )
-{
-  this->m_ClassName = "cpPlugins::ImageReader";
-  this->m_ClassCategory = "ImageReader";
-
-  this->SetNumberOfOutputs( 1 );
-  this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
-
-  using namespace cpPlugins::Interface;
-  this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
-  this->m_Parameters = this->m_DefaultParameters;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageReader::
-~ImageReader( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageReader::
-_GenerateData( )
-{
-  // Get filenames
-  TStringList names;
-  this->m_Parameters.GetValueAsStringList( names, "FileNames" );
-
-  std::string r = "";
-  if( names.size( ) >= 1 )
-  {
-    // Guess image properties
-    itk::ImageIOBase::Pointer io =
-      itk::ImageIOFactory::CreateImageIO(
-        names[ 0 ].c_str( ),
-        itk::ImageIOFactory::ReadMode
-        );
-    if( io.IsNotNull( ) )
-    {
-      io->SetFileName( names[ 0 ] );
-      io->ReadImageInformation( );
-      if( names.size( ) >= 1 )
-      {
-        switch( io->GetNumberOfDimensions( ) )
-        {
-        case 2: r = this->_GD0< 2 >( io, names ); break;
-        case 3: r = this->_GD0< 3 >( io, names ); break;
-        case 4: r = this->_GD0< 4 >( io, names ); break;
-        default:
-          r = "ImageReader: Image dimension not supported.";
-          break;
-        } // hctiws
-
-      } // fi
-    }
-    else
-      r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\"";
-  }
-  else
-    r = "No image files given";
-  return( r );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::ImageReader::
-_GD0( itk::ImageIOBase* io, const TStringList& names )
-{
-  itk::ImageIOBase::IOComponentType ct = io->GetComponentType( );
-  itk::ImageIOBase::IOPixelType pt = io->GetPixelType( );
-  std::string r = "";
-
-  if( pt == itk::ImageIOBase::SCALAR )
-  {
-    switch( ct )
-    {
-    case itk::ImageIOBase::UCHAR:
-      r = this->_RealGD< unsigned char, D >( names );
-      break;
-    case itk::ImageIOBase::CHAR:
-      r = this->_RealGD< char, D >( names );
-      break;
-    case itk::ImageIOBase::USHORT:
-      r = this->_RealGD< unsigned short, D >( names );
-      break;
-    case itk::ImageIOBase::SHORT:
-      r = this->_RealGD< short, D >( names );
-      break;
-    case itk::ImageIOBase::UINT:
-      r = this->_RealGD< unsigned int, D >( names );
-      break;
-    case itk::ImageIOBase::INT:
-      r = this->_RealGD< int, D >( names );
-      break;
-    case itk::ImageIOBase::ULONG:
-      r = this->_RealGD< unsigned long, D >( names );
-      break;
-    case itk::ImageIOBase::LONG:
-      r = this->_RealGD< long, D >( names );
-      break;
-    case itk::ImageIOBase::FLOAT:
-      r = this->_RealGD< float, D >( names );
-      break;
-    case itk::ImageIOBase::DOUBLE:
-      r = this->_RealGD< double, D >( names );
-      break;
-    default:
-      r = "ImageReader: Scalar pixel type not supported.";
-      break;
-    } // hctiws
-  }
-  else if( pt == itk::ImageIOBase::RGB )
-  {
-    if( D == 2 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::UCHAR:
-        r = this->_RealGD< itk::RGBPixel< unsigned char >, 2 >( names );
-        break;
-      case itk::ImageIOBase::CHAR:
-        r = this->_RealGD< itk::RGBPixel< char >, 2 >( names );
-        break;
-      case itk::ImageIOBase::USHORT:
-        r = this->_RealGD< itk::RGBPixel< unsigned short >, 2 >( names );
-        break;
-      case itk::ImageIOBase::SHORT:
-        r = this->_RealGD< itk::RGBPixel< short >, 2 >( names );
-        break;
-      case itk::ImageIOBase::UINT:
-        r = this->_RealGD< itk::RGBPixel< unsigned int >, 2 >( names );
-        break;
-      case itk::ImageIOBase::INT:
-        r = this->_RealGD< itk::RGBPixel< int >, 2 >( names );
-        break;
-      case itk::ImageIOBase::ULONG:
-        r = this->_RealGD< itk::RGBPixel< unsigned long >, 2 >( names );
-        break;
-      case itk::ImageIOBase::LONG:
-        r = this->_RealGD< itk::RGBPixel< long >, 2 >( names );
-        break;
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::RGBPixel< float >, 2 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::RGBPixel< double >, 2 >( names );
-        break;
-      default:
-        r = "ImageReader: RGB pixel type not supported.";
-        break;
-      } // hctiws
-    }
-    else if( D == 3 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::UCHAR:
-        r = this->_RealGD< itk::RGBPixel< unsigned char >, 3 >( names );
-        break;
-      case itk::ImageIOBase::CHAR:
-        r = this->_RealGD< itk::RGBPixel< char >, 3 >( names );
-        break;
-      case itk::ImageIOBase::USHORT:
-        r = this->_RealGD< itk::RGBPixel< unsigned short >, 3 >( names );
-        break;
-      case itk::ImageIOBase::SHORT:
-        r = this->_RealGD< itk::RGBPixel< short >, 3 >( names );
-        break;
-      case itk::ImageIOBase::UINT:
-        r = this->_RealGD< itk::RGBPixel< unsigned int >, 3 >( names );
-        break;
-      case itk::ImageIOBase::INT:
-        r = this->_RealGD< itk::RGBPixel< int >, 3 >( names );
-        break;
-      case itk::ImageIOBase::ULONG:
-        r = this->_RealGD< itk::RGBPixel< unsigned long >, 3 >( names );
-        break;
-      case itk::ImageIOBase::LONG:
-        r = this->_RealGD< itk::RGBPixel< long >, 3 >( names );
-        break;
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::RGBPixel< float >, 3 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::RGBPixel< double >, 3 >( names );
-        break;
-      default:
-        r = "ImageReader: RGB pixel type not supported.";
-        break;
-      } // hctiws
-    }
-    else if( D == 4 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::UCHAR:
-        r = this->_RealGD< itk::RGBPixel< unsigned char >, 4 >( names );
-        break;
-      case itk::ImageIOBase::CHAR:
-        r = this->_RealGD< itk::RGBPixel< char >, 4 >( names );
-        break;
-      case itk::ImageIOBase::USHORT:
-        r = this->_RealGD< itk::RGBPixel< unsigned short >, 4 >( names );
-        break;
-      case itk::ImageIOBase::SHORT:
-        r = this->_RealGD< itk::RGBPixel< short >, 4 >( names );
-        break;
-      case itk::ImageIOBase::UINT:
-        r = this->_RealGD< itk::RGBPixel< unsigned int >, 4 >( names );
-        break;
-      case itk::ImageIOBase::INT:
-        r = this->_RealGD< itk::RGBPixel< int >, 4 >( names );
-        break;
-      case itk::ImageIOBase::ULONG:
-        r = this->_RealGD< itk::RGBPixel< unsigned long >, 4 >( names );
-        break;
-      case itk::ImageIOBase::LONG:
-        r = this->_RealGD< itk::RGBPixel< long >, 4 >( names );
-        break;
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::RGBPixel< float >, 4 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::RGBPixel< double >, 4 >( names );
-        break;
-      default:
-        r = "ImageReader: RGB pixel type not supported.";
-        break;
-      } // hctiws
-
-    } // fi
-  }
-  else if( pt == itk::ImageIOBase::RGBA )
-  {
-    if( D == 2 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::UCHAR:
-        r = this->_RealGD< itk::RGBAPixel< unsigned char >, 2 >( names );
-        break;
-      case itk::ImageIOBase::CHAR:
-        r = this->_RealGD< itk::RGBAPixel< char >, 2 >( names );
-        break;
-      case itk::ImageIOBase::USHORT:
-        r = this->_RealGD< itk::RGBAPixel< unsigned short >, 2 >( names );
-        break;
-      case itk::ImageIOBase::SHORT:
-        r = this->_RealGD< itk::RGBAPixel< short >, 2 >( names );
-        break;
-      case itk::ImageIOBase::UINT:
-        r = this->_RealGD< itk::RGBAPixel< unsigned int >, 2 >( names );
-        break;
-      case itk::ImageIOBase::INT:
-        r = this->_RealGD< itk::RGBAPixel< int >, 2 >( names );
-        break;
-      case itk::ImageIOBase::ULONG:
-        r = this->_RealGD< itk::RGBAPixel< unsigned long >, 2 >( names );
-        break;
-      case itk::ImageIOBase::LONG:
-        r = this->_RealGD< itk::RGBAPixel< long >, 2 >( names );
-        break;
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::RGBAPixel< float >, 2 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::RGBAPixel< double >, 2 >( names );
-        break;
-      default:
-        r = "ImageReader: RGBA pixel type not supported.";
-        break;
-      } // hctiws
-    }
-    else if( D == 3 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::UCHAR:
-        r = this->_RealGD< itk::RGBAPixel< unsigned char >, 3 >( names );
-        break;
-      case itk::ImageIOBase::CHAR:
-        r = this->_RealGD< itk::RGBAPixel< char >, 3 >( names );
-        break;
-      case itk::ImageIOBase::USHORT:
-        r = this->_RealGD< itk::RGBAPixel< unsigned short >, 3 >( names );
-        break;
-      case itk::ImageIOBase::SHORT:
-        r = this->_RealGD< itk::RGBAPixel< short >, 3 >( names );
-        break;
-      case itk::ImageIOBase::UINT:
-        r = this->_RealGD< itk::RGBAPixel< unsigned int >, 3 >( names );
-        break;
-      case itk::ImageIOBase::INT:
-        r = this->_RealGD< itk::RGBAPixel< int >, 3 >( names );
-        break;
-      case itk::ImageIOBase::ULONG:
-        r = this->_RealGD< itk::RGBAPixel< unsigned long >, 3 >( names );
-        break;
-      case itk::ImageIOBase::LONG:
-        r = this->_RealGD< itk::RGBAPixel< long >, 3 >( names );
-        break;
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::RGBAPixel< float >, 3 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::RGBAPixel< double >, 3 >( names );
-        break;
-      default:
-        r = "ImageReader: RGBA pixel type not supported.";
-        break;
-      } // hctiws
-    }
-    else if( D == 4 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::UCHAR:
-        r = this->_RealGD< itk::RGBAPixel< unsigned char >, 4 >( names );
-        break;
-      case itk::ImageIOBase::CHAR:
-        r = this->_RealGD< itk::RGBAPixel< char >, 4 >( names );
-        break;
-      case itk::ImageIOBase::USHORT:
-        r = this->_RealGD< itk::RGBAPixel< unsigned short >, 4 >( names );
-        break;
-      case itk::ImageIOBase::SHORT:
-        r = this->_RealGD< itk::RGBAPixel< short >, 4 >( names );
-        break;
-      case itk::ImageIOBase::UINT:
-        r = this->_RealGD< itk::RGBAPixel< unsigned int >, 4 >( names );
-        break;
-      case itk::ImageIOBase::INT:
-        r = this->_RealGD< itk::RGBAPixel< int >, 4 >( names );
-        break;
-      case itk::ImageIOBase::ULONG:
-        r = this->_RealGD< itk::RGBAPixel< unsigned long >, 4 >( names );
-        break;
-      case itk::ImageIOBase::LONG:
-        r = this->_RealGD< itk::RGBAPixel< long >, 4 >( names );
-        break;
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::RGBAPixel< float >, 4 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::RGBAPixel< double >, 4 >( names );
-        break;
-      default:
-        r = "ImageReader: RGBA pixel type not supported.";
-        break;
-      } // hctiws
-
-    } // fi
-  }
-  else if( pt == itk::ImageIOBase::OFFSET )
-  {
-    switch( D )
-    {
-    case 2:
-      r = this->_RealGD< itk::Offset< 2 >, 2 >( names );
-      break;
-    case 3:
-      r = this->_RealGD< itk::Offset< 3 >, 3 >( names );
-      break;
-    case 4:
-      r = this->_RealGD< itk::Offset< 4 >, 4 >( names );
-      break;
-    default:
-      r = "ImageReader: Offset pixel dimension not supported.";
-      break;
-    } // hctiws
-  }
-  else if( pt == itk::ImageIOBase::VECTOR )
-  {
-    switch( ct )
-    {
-    case itk::ImageIOBase::FLOAT:
-      r = this->_RealGD< itk::Vector< float, D >, D >( names );
-      break;
-    case itk::ImageIOBase::DOUBLE:
-      r = this->_RealGD< itk::Vector< double, D >, D >( names );
-      break;
-    default:
-      r = "ImageReader: Vector type not supported.";
-      break;
-    } // hctiws
-  }
-  else if( pt == itk::ImageIOBase::POINT )
-  {
-    switch( ct )
-    {
-    case itk::ImageIOBase::FLOAT:
-      r = this->_RealGD< itk::Point< float, D >, D >( names );
-      break;
-    case itk::ImageIOBase::DOUBLE:
-      r = this->_RealGD< itk::Point< double, D >, D >( names );
-      break;
-    default:
-      r = "ImageReader: Point type not supported.";
-      break;
-    } // hctiws
-  }
-  else if( pt == itk::ImageIOBase::COVARIANTVECTOR )
-  {
-    switch( ct )
-    {
-    case itk::ImageIOBase::FLOAT:
-      r = this->_RealGD< itk::CovariantVector< float, D >, D >( names );
-      break;
-    case itk::ImageIOBase::DOUBLE:
-      r = this->_RealGD< itk::CovariantVector< double, D >, D >( names );
-      break;
-    default:
-      r = "ImageReader: CovariantVector type not supported.";
-      break;
-    } // hctiws
-  }
-  else if( pt == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR )
-  {
-    switch( ct )
-    {
-    case itk::ImageIOBase::FLOAT:
-      r =
-        this->_RealGD< itk::SymmetricSecondRankTensor< float, D >, D >(
-          names
-          );
-      break;
-    case itk::ImageIOBase::DOUBLE:
-      r =
-        this->_RealGD< itk::SymmetricSecondRankTensor< double, D >, D >(
-          names
-          );
-      break;
-    default:
-      r = "ImageReader: Vector type not supported.";
-      break;
-    } // hctiws
-  }
-  else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D )
-  {
-    if( D == 3 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::DiffusionTensor3D< float >, 3 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::DiffusionTensor3D< double >, 3 >( names );
-        break;
-      default:
-        r = "ImageReader: Diffusion tensor type not supported.";
-        break;
-      } // hctiws
-    }
-    else if( D == 4 )
-    {
-      switch( ct )
-      {
-      case itk::ImageIOBase::FLOAT:
-        r = this->_RealGD< itk::DiffusionTensor3D< float >, 4 >( names );
-        break;
-      case itk::ImageIOBase::DOUBLE:
-        r = this->_RealGD< itk::DiffusionTensor3D< double >, 4 >( names );
-        break;
-      default:
-        r = "ImageReader: Diffusion tensor type not supported.";
-        break;
-      } // hctiws
-    }
-    else
-      r = "ImageReader: Diffusion tensor dimension not supported.";
-  }
-  else if( pt == itk::ImageIOBase::COMPLEX )
-  {
-    switch( ct )
-    {
-    case itk::ImageIOBase::FLOAT:
-      r = this->_RealGD< std::complex< float >, D >( names );
-      break;
-    case itk::ImageIOBase::DOUBLE:
-      r = this->_RealGD< std::complex< double >, D >( names );
-      break;
-    default:
-      r = "ImageReader: Complex type not supported.";
-      break;
-    } // hctiws
-  }
-  else
-    r = "ImageReader: Image pixel type not yet supported.";
-  /* TODO
-     itk::ImageIOBase::FIXEDARRAY
-     itk::ImageIOBase::MATRIX
-  */
-
-  return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::ImageReader::
-_RealGD( const TStringList& names )
-{
-  typedef itk::Image< P, D > _I;
-
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( 0 );
-  if( out == NULL )
-    return( "ImageReader: No output object properly created." );
-
-  std::string r = "";
-  if( names.size( ) == 1 )
-  {
-    // 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
-    reader->SetFileName( names[ 0 ] );
-    try
-    {
-      reader->Update( );
-      out->SetITKImage< _I >( reader->GetOutput( ) );
-    }
-    catch( itk::ExceptionObject& err )
-    {
-      r = "ImageReader: " + std::string( err.GetDescription( ) );
-      out->SetITKImage< _I >( NULL );
-
-    } // yrt
-  }
-  else if( names.size( ) > 1 )
-  {
-    // Read image series
-    std::set< std::string > ordered_names;
-    for( unsigned int i = 0; i < names.size( ); ++i )
-      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
-    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( ) );
-    }
-    catch( itk::ExceptionObject& err )
-    {
-      r = "ImageReader: " + std::string( err.GetDescription( ) );
-      out->SetITKImage< _I >( NULL );
-
-    } // yrt
-  }
-  else
-    r = "ImageReader: No image files given";
-  return( r );
-}
-
-// eof - $RCSfile$