#include <cpPlugins/Plugins/ImageWriter.h>
+#include <complex>
+
+#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 <itkImageFileWriter.h>
+
// -------------------------------------------------------------------------
cpPlugins::Plugins::ImageWriter::
ImageWriter( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::ImageWriter";
+ this->m_ClassCategory = "ImageWriter";
+ this->SetNumberOfInputs( 1 );
+
+ using namespace cpPlugins::Interface;
+ this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
+ this->m_Parameters = this->m_DefaultParameters;
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
std::string cpPlugins::Plugins::ImageWriter::
-GetClassName( ) const
+_GenerateData( )
+{
+ itk::DataObject* i = this->m_Inputs[ 0 ]->GetITKDataObject( );
+ return( this->_DemangleImageDimension( i ) );
+}
+
+// -------------------------------------------------------------------------
+namespace cpPlugins
{
- return( "cpPlugins::Plugins::ImageWriter" );
+ namespace Plugins
+ {
+ cpPlugins_Image_Demangle_Methods_Code( ImageWriter, _RealGD );
+ }
}
// -------------------------------------------------------------------------
-bool cpPlugins::Plugins::ImageWriter::
-Update( )
+template< class I >
+std::string cpPlugins::Plugins::ImageWriter::
+_RealGD( itk::DataObject* image )
{
- return( false );
+ typedef itk::ImageFileWriter< I > _W;
+
+ // Get filename
+ using namespace cpPlugins::Interface;
+ Parameters::TString fname =
+ this->m_Parameters.GetValueAsString( "FileName" );
+
+ _W* writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
+ if( writer == NULL )
+ {
+ this->m_RealProcessObject = _W::New( );
+ writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
+
+ } // fi
+ writer->SetFileName( fname );
+ writer->SetInput( dynamic_cast< I* >( image ) );
+ try
+ {
+ writer->Update( );
+ }
+ catch( itk::ExceptionObject& err )
+ {
+ return( "ImageWriter: " + std::string( err.GetDescription( ) ) );
+
+ } // yrt
+ return( "" );
}
// eof - $RCSfile$