]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/ImageReader.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / ImageReader.cxx
index 24399718c9e5477f8c6a45fb6461abe95e5e0570..25bdc7ae43280419528a881e3e252ccc0b75b13c 100644 (file)
@@ -1,21 +1,8 @@
 #include <cpPlugins/Plugins/ImageReader.h>
 #include <cpPlugins/Interface/Image.h>
 
-#include <complex>
 #include <set>
 
-#define ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-
-#include <itkCovariantVector.h>
-#include <itkDiffusionTensor3D.h>
-#include <itkPoint.h>
-#include <itkRGBPixel.h>
-#include <itkRGBAPixel.h>
-#include <itkSymmetricSecondRankTensor.h>
-#include <itkVector.h>
-
-#undef ITK_MANUAL_INSTANTIATION
 #include <itkImageFileReader.h>
 #include <itkImageSeriesReader.h>
 
@@ -66,7 +53,6 @@ _GenerateData( )
       {
         switch( io->GetNumberOfDimensions( ) )
         {
-        case 1: r = this->_GD0< 1 >( io, names ); break;
         case 2: r = this->_GD0< 2 >( io, names ); break;
         case 3: r = this->_GD0< 3 >( io, names ); break;
         case 4: r = this->_GD0< 4 >( io, names ); break;
@@ -283,9 +269,6 @@ _GD0( itk::ImageIOBase* io, const TStringList& names )
   {
     switch( D )
     {
-    case 1:
-      r = this->_RealGD< itk::Offset< 1 >, 1 >( names );
-      break;
     case 2:
       r = this->_RealGD< itk::Offset< 2 >, 2 >( names );
       break;
@@ -436,12 +419,22 @@ _RealGD( const TStringList& names )
     try
     {
       reader->Update( );
-      this->m_Outputs[ 0 ]->SetITKDataObject( reader->GetOutput( ) );
+      cpPlugins::Interface::Image* out =
+        this->_Output< cpPlugins::Interface::Image >( 0 );
+      if( out != NULL )
+        out->SetITKImage< _I >( reader->GetOutput( ) );
+      else
+        r = "ImageReader: output not correctly created.";
     }
     catch( itk::ExceptionObject& err )
     {
       r = "ImageReader: " + std::string( err.GetDescription( ) );
-      this->m_Outputs[ 0 ]->SetITKDataObject( NULL );
+      cpPlugins::Interface::Image* out =
+        this->_Output< cpPlugins::Interface::Image >( 0 );
+      if( out != NULL )
+        out->SetITKImage< _I >( NULL );
+      else
+        r = "ImageReader: output not correctly created.";
 
     } // yrt
   }
@@ -468,12 +461,22 @@ _RealGD( const TStringList& names )
     try
     {
       reader->Update( );
-      this->m_Outputs[ 0 ]->SetITKDataObject( reader->GetOutput( ) );
+      cpPlugins::Interface::Image* out =
+        this->_Output< cpPlugins::Interface::Image >( 0 );
+      if( out != NULL )
+        out->SetITKImage< _I >( reader->GetOutput( ) );
+      else
+        r = "ImageReader: output not correctly created.";
     }
     catch( itk::ExceptionObject& err )
     {
       r = "ImageReader: " + std::string( err.GetDescription( ) );
-      this->m_Outputs[ 0 ]->SetITKDataObject( NULL );
+      cpPlugins::Interface::Image* out =
+        this->_Output< cpPlugins::Interface::Image >( 0 );
+      if( out != NULL )
+        out->SetITKImage< _I >( NULL );
+      else
+        r = "ImageReader: output not correctly created.";
 
     } // yrt
   }