+ itk::ImageBase< D >* i =
+ dynamic_cast< itk::ImageBase< D >* >( this->_GetInput( 0 ) );
+
+ std::string r = "cpPlugins::Plugins::ImageWriter: itk::Image pixel type not supported";
+ cpPlugins_ImageWriter_Pixel( r, char, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, short, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, int, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, long, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, unsigned char, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, unsigned short, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, unsigned int, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, unsigned long, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, float, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, double, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, char, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, short, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, int, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, long, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, unsigned char, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, unsigned short, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, unsigned int, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, unsigned long, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, float, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB( r, double, D, i, _GD1 );
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+std::string cpPlugins::Plugins::ImageWriter::
+_GD1( )
+{
+ typedef itk::Image< P, D > _TImage;
+ typedef itk::ImageFileWriter< _TImage > _TWriter;
+
+ TParameters::const_iterator fIt;
+
+ // Get image pixelType
+ fIt = this->m_Parameters.find( "FileName" );
+ if( fIt == this->m_Parameters.end( ) )
+ fIt = this->m_DefaultParameters.find( "FileName" );
+
+ _TWriter* writer =
+ dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) );
+ if( writer == NULL )
+ {
+ this->m_RealProcessObject = _TWriter::New( );
+ writer =
+ dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) );
+
+ } // fi
+ writer->SetFileName( fIt->second.second );
+ writer->SetInput( dynamic_cast< _TImage* >( this->_GetInput( 0 ) ) );
+ try
+ {
+ writer->Update( );
+ }
+ catch( itk::ExceptionObject& err )
+ {
+ return( err.GetDescription( ) );
+
+ } // yrt
+ return( "" );