1 #include <cpPlugins/Plugins/ImageWriter.h>
5 #define ITK_MANUAL_INSTANTIATION
8 #include <itkCovariantVector.h>
9 #include <itkDiffusionTensor3D.h>
11 #include <itkRGBPixel.h>
12 #include <itkRGBAPixel.h>
13 #include <itkSymmetricSecondRankTensor.h>
14 #include <itkVector.h>
16 #undef ITK_MANUAL_INSTANTIATION
17 #include <itkImageFileWriter.h>
19 // -------------------------------------------------------------------------
20 cpPlugins::Plugins::ImageWriter::
24 this->m_ClassName = "cpPlugins::ImageWriter";
25 this->m_ClassCategory = "ImageWriter";
26 this->SetNumberOfInputs( 1 );
28 using namespace cpPlugins::Interface;
29 this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
30 this->m_Parameters = this->m_DefaultParameters;
33 // -------------------------------------------------------------------------
34 cpPlugins::Plugins::ImageWriter::
39 // -------------------------------------------------------------------------
40 std::string cpPlugins::Plugins::ImageWriter::
43 itk::DataObject* i = this->m_Inputs[ 0 ]->GetITKDataObject( );
44 return( this->_DemangleImageDimension( i ) );
47 // -------------------------------------------------------------------------
52 cpPlugins_Image_Demangle_Methods_Code( ImageWriter, _RealGD );
56 // -------------------------------------------------------------------------
58 std::string cpPlugins::Plugins::ImageWriter::
59 _RealGD( itk::DataObject* image )
61 typedef itk::ImageFileWriter< I > _W;
64 using namespace cpPlugins::Interface;
65 Parameters::TString fname =
66 this->m_Parameters.GetValueAsString( "FileName" );
68 _W* writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
71 this->m_RealProcessObject = _W::New( );
72 writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
75 writer->SetFileName( fname );
76 writer->SetInput( dynamic_cast< I* >( image ) );
81 catch( itk::ExceptionObject& err )
83 return( "ImageWriter: " + std::string( err.GetDescription( ) ) );