for( ; cIt != end_cIt; ++cIt )
std::cout << "\t:= " << cIt->first << std::endl;
std::cout << "---------------------------------------------" << std::endl;
-
+
return( 0 );
}
#include <cpPlugins/Interface/Image.h>
+#define ITK_MANUAL_INSTANTIATION
#include <itkImage.h>
#include <itkRGBPixel.h>
#include <itkImageToVTKImageFilter.h>
--- /dev/null
+#include <itkImage.h>
+#include <itkRGBPixel.h>
+#include <itkImageToVTKImageFilter.h>
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Interface_Instance_itkImage( t, d ) \
+ template class itk::Image< t, d >; \
+ template class itk::Image< itk::RGBPixel< t >, d >
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Interface_Instance_itkImage2vtkImage( t, d ) \
+ template class itk::ImageToVTKImageFilter< itk::Image< t, d > >; \
+ template class \
+ itk::ImageToVTKImageFilter< itk::Image< itk::RGBPixel< t >, d > >
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Interface_Instance_All_itkImage( t, d ) \
+ cpPlugins_Interface_Instance_itkImage( t, d ); \
+ cpPlugins_Interface_Instance_itkImage2vtkImage( t, d )
+
+// -------------------------------------------------------------------------
+// Images without vtk conversion
+cpPlugins_Interface_Instance_itkImage( char, 1 );
+cpPlugins_Interface_Instance_itkImage( short, 1 );
+cpPlugins_Interface_Instance_itkImage( int, 1 );
+cpPlugins_Interface_Instance_itkImage( long, 1 );
+cpPlugins_Interface_Instance_itkImage( unsigned char, 1 );
+cpPlugins_Interface_Instance_itkImage( unsigned short, 1 );
+cpPlugins_Interface_Instance_itkImage( unsigned int, 1 );
+cpPlugins_Interface_Instance_itkImage( unsigned long, 1 );
+cpPlugins_Interface_Instance_itkImage( float, 1 );
+cpPlugins_Interface_Instance_itkImage( double, 1 );
+
+cpPlugins_Interface_Instance_itkImage( char, 4 );
+cpPlugins_Interface_Instance_itkImage( short, 4 );
+cpPlugins_Interface_Instance_itkImage( int, 4 );
+cpPlugins_Interface_Instance_itkImage( long, 4 );
+cpPlugins_Interface_Instance_itkImage( unsigned char, 4 );
+cpPlugins_Interface_Instance_itkImage( unsigned short, 4 );
+cpPlugins_Interface_Instance_itkImage( unsigned int, 4 );
+cpPlugins_Interface_Instance_itkImage( unsigned long, 4 );
+cpPlugins_Interface_Instance_itkImage( float, 4 );
+cpPlugins_Interface_Instance_itkImage( double, 4 );
+
+// -------------------------------------------------------------------------
+// Images with vtk conversion
+cpPlugins_Interface_Instance_All_itkImage( char, 2 );
+cpPlugins_Interface_Instance_All_itkImage( short, 2 );
+cpPlugins_Interface_Instance_All_itkImage( int, 2 );
+cpPlugins_Interface_Instance_All_itkImage( long, 2 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned char, 2 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned short, 2 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned int, 2 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned long, 2 );
+cpPlugins_Interface_Instance_All_itkImage( float, 2 );
+cpPlugins_Interface_Instance_All_itkImage( double, 2 );
+
+cpPlugins_Interface_Instance_All_itkImage( char, 3 );
+cpPlugins_Interface_Instance_All_itkImage( short, 3 );
+cpPlugins_Interface_Instance_All_itkImage( int, 3 );
+cpPlugins_Interface_Instance_All_itkImage( long, 3 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned char, 3 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned short, 3 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned int, 3 );
+cpPlugins_Interface_Instance_All_itkImage( unsigned long, 3 );
+cpPlugins_Interface_Instance_All_itkImage( float, 3 );
+cpPlugins_Interface_Instance_All_itkImage( double, 3 );
+
+// eof - $RCSfile$
#include <cpPlugins/Interface/ProcessObject.h>
-#include <cpPlugins/Interface/DataObject.h>
// -------------------------------------------------------------------------
cpPlugins::Interface::ProcessObject::
#include <itkDataObject.h>
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/Object.h>
+#include <cpPlugins/Interface/DataObject.h>
namespace cpPlugins
{
virtual void _DeleteOutputs( );
template< class O >
- void _MakeOutput( unsigned int idx )
- {
- if( idx >= this->m_Outputs.size( ) )
- return;
+ void _MakeOutput( unsigned int idx )
+ {
+ if( idx >= this->m_Outputs.size( ) )
+ return;
- if( !( this->m_OutputsDisconnected ) )
- if( this->m_Outputs[ idx ] != NULL )
- delete this->m_Outputs[ idx ];
+ if( !( this->m_OutputsDisconnected ) )
+ if( this->m_Outputs[ idx ] != NULL )
+ delete this->m_Outputs[ idx ];
- this->m_Outputs[ idx ] = new O( );
- }
+ this->m_Outputs[ idx ] = new O( );
+ this->m_Outputs[ idx ]->SetSource( this );
+ }
virtual std::string _GenerateData( ) = 0;
if( dIt == this->m_Parameters.end( ) )
dIt = this->m_DefaultParameters.find( "ImageDimension" );
- std::string ret = "itk::Image dimension not supported.";
- if ( dIt->second.second == "1" ) ret = this->_GenerateData0< 1 >( );
- else if( dIt->second.second == "2" ) ret = this->_GenerateData0< 2 >( );
- else if( dIt->second.second == "3" ) ret = this->_GenerateData0< 3 >( );
- else if( dIt->second.second == "4" ) ret = this->_GenerateData0< 4 >( );
+ std::string r = "itk::Image dimension not supported.";
+ if ( dIt->second.second == "1" ) r = this->_GD0< 1 >( );
+ else if( dIt->second.second == "2" ) r = this->_GD0< 2 >( );
+ else if( dIt->second.second == "3" ) r = this->_GD0< 3 >( );
+ else if( dIt->second.second == "4" ) r = this->_GD0< 4 >( );
- return( ret );
+ return( r );
}
// -------------------------------------------------------------------------
template< unsigned int D >
std::string cpPlugins::Plugins::ImageReader::
-_GenerateData0( )
+_GD0( )
{
TParameters::const_iterator tIt, cIt;
- // Get image pixelType
+ // Get image pixel type
tIt = this->m_Parameters.find( "PixelType" );
if( tIt == this->m_Parameters.end( ) )
tIt = this->m_DefaultParameters.find( "PixelType" );
if( cIt == this->m_Parameters.end( ) )
cIt = this->m_DefaultParameters.find( "IsColorImage" );
- std::string ret = "itk::Image pixel type not supported";
+ std::string r = "itk::Image pixel type not supported";
if( cIt->second.second == "0" )
{
if( tIt->second.second == "char" )
- ret = this->_GenerateData1< char, D >( );
+ r = this->_GD1< char, D >( );
else if( tIt->second.second == "short" )
- ret = this->_GenerateData1< short, D >( );
+ r = this->_GD1< short, D >( );
else if( tIt->second.second == "int" )
- ret = this->_GenerateData1< int, D >( );
+ r = this->_GD1< int, D >( );
else if( tIt->second.second == "long" )
- ret = this->_GenerateData1< long, D >( );
+ r = this->_GD1< long, D >( );
else if( tIt->second.second == "uchar" )
- ret = this->_GenerateData1< unsigned char, D >( );
+ r = this->_GD1< unsigned char, D >( );
else if( tIt->second.second == "ushort" )
- ret = this->_GenerateData1< unsigned short, D >( );
+ r = this->_GD1< unsigned short, D >( );
else if( tIt->second.second == "uint" )
- ret = this->_GenerateData1< unsigned int, D >( );
+ r = this->_GD1< unsigned int, D >( );
else if( tIt->second.second == "ulong" )
- ret = this->_GenerateData1< unsigned long, D >( );
+ r = this->_GD1< unsigned long, D >( );
else if( tIt->second.second == "float" )
- ret = this->_GenerateData1< float, D >( );
+ r = this->_GD1< float, D >( );
else if( tIt->second.second == "double" )
- ret = this->_GenerateData1< double, D >( );
+ r = this->_GD1< double, D >( );
}
else if( cIt->second.second == "1" )
{
if( tIt->second.second == "char" )
- ret = this->_GenerateData1< itk::RGBPixel< char >, D >( );
+ r = this->_GD1< itk::RGBPixel< char >, D >( );
else if( tIt->second.second == "short" )
- ret = this->_GenerateData1< itk::RGBPixel< short >, D >( );
+ r = this->_GD1< itk::RGBPixel< short >, D >( );
else if( tIt->second.second == "int" )
- ret = this->_GenerateData1< itk::RGBPixel< int >, D >( );
+ r = this->_GD1< itk::RGBPixel< int >, D >( );
else if( tIt->second.second == "long" )
- ret = this->_GenerateData1< itk::RGBPixel< long >, D >( );
+ r = this->_GD1< itk::RGBPixel< long >, D >( );
else if( tIt->second.second == "uchar" )
- ret = this->_GenerateData1< itk::RGBPixel< unsigned char >, D >( );
+ r = this->_GD1< itk::RGBPixel< unsigned char >, D >( );
else if( tIt->second.second == "ushort" )
- ret = this->_GenerateData1< itk::RGBPixel< unsigned short >, D >( );
+ r = this->_GD1< itk::RGBPixel< unsigned short >, D >( );
else if( tIt->second.second == "uint" )
- ret = this->_GenerateData1< itk::RGBPixel< unsigned int >, D >( );
+ r = this->_GD1< itk::RGBPixel< unsigned int >, D >( );
else if( tIt->second.second == "ulong" )
- ret = this->_GenerateData1< itk::RGBPixel< unsigned long >, D >( );
+ r = this->_GD1< itk::RGBPixel< unsigned long >, D >( );
else if( tIt->second.second == "float" )
- ret = this->_GenerateData1< itk::RGBPixel< float >, D >( );
+ r = this->_GD1< itk::RGBPixel< float >, D >( );
else if( tIt->second.second == "double" )
- ret = this->_GenerateData1< itk::RGBPixel< double >, D >( );
+ r = this->_GD1< itk::RGBPixel< double >, D >( );
} // fi
- return( ret );
+ return( r );
}
// -------------------------------------------------------------------------
template< class P, unsigned int D >
std::string cpPlugins::Plugins::ImageReader::
-_GenerateData1( )
+_GD1( )
{
TParameters::const_iterator fIt;
- // Get image pixelType
+ // Get filename
fIt = this->m_Parameters.find( "FileName" );
if( fIt == this->m_Parameters.end( ) )
fIt = this->m_DefaultParameters.find( "FileName" );
virtual std::string _GenerateData( );
template< unsigned int D >
- std::string _GenerateData0( );
+ std::string _GD0( );
template< class P, unsigned int D >
- std::string _GenerateData1( );
+ std::string _GD1( );
protected:
itk::ProcessObject::Pointer m_Reader;
#include <itkRGBPixel.h>
// -------------------------------------------------------------------------
-#define cpPlugins_Plugins_ImageWriter_Dimension( ret, d, dobj, func ) \
- if( dynamic_cast< itk::ImageBase< d >* >( dobj ) != NULL ) \
- ret = this->func< d >( )
+#define cpPlugins_ImageWriter_Dimension( r, d, o, f ) \
+ if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL ) \
+ r = this->f< d >( )
// -------------------------------------------------------------------------
-#define cpPlugins_Plugins_ImageWriter_Pixel( ret, p, d, dobj, func ) \
- if( dynamic_cast< itk::Image< p, d >* >( dobj ) != NULL ) \
- ret = this->func< p, d >( )
+#define cpPlugins_ImageWriter_Pixel( r, p, d, o, f ) \
+ if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL ) \
+ r = this->f< p, d >( )
// -------------------------------------------------------------------------
-#define cpPlugins_Plugins_ImageWriter_RGB( ret, p, d, dobj, func ) \
- if( dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( dobj ) != NULL ) \
- ret = this->func< itk::RGBPixel< p >, d >( )
+#define cpPlugins_ImageWriter_RGB( r, p, d, o, f ) \
+ if( \
+ dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \
+ ) \
+ r = this->f< itk::RGBPixel< p >, d >( )
// -------------------------------------------------------------------------
cpPlugins::Plugins::ImageWriter::
std::string cpPlugins::Plugins::ImageWriter::
_GenerateData( )
{
- itk::DataObject* dobj = this->_GetInput( 0 );
-
- std::string ret = "itk::Image dimension not supported.";
- cpPlugins_Plugins_ImageWriter_Dimension( ret, 1, dobj, _GenerateData0 );
- else cpPlugins_Plugins_ImageWriter_Dimension( ret, 2, dobj, _GenerateData0 );
- else cpPlugins_Plugins_ImageWriter_Dimension( ret, 3, dobj, _GenerateData0 );
- else cpPlugins_Plugins_ImageWriter_Dimension( ret, 4, dobj, _GenerateData0 );
-
- return( ret );
+ itk::DataObject* o = this->_GetInput( 0 );
+
+ std::string r = "itk::Image dimension not supported.";
+ cpPlugins_ImageWriter_Dimension( r, 1, o, _GD0 );
+ else cpPlugins_ImageWriter_Dimension( r, 2, o, _GD0 );
+ else cpPlugins_ImageWriter_Dimension( r, 3, o, _GD0 );
+ else cpPlugins_ImageWriter_Dimension( r, 4, o, _GD0 );
+ return( r );
}
// -------------------------------------------------------------------------
template< unsigned int D >
std::string cpPlugins::Plugins::ImageWriter::
-_GenerateData0( )
+_GD0( )
{
- itk::ImageBase< D >* img =
+ itk::ImageBase< D >* i =
dynamic_cast< itk::ImageBase< D >* >( this->_GetInput( 0 ) );
- std::string ret = "itk::Image pixel type not supported";
- cpPlugins_Plugins_ImageWriter_Pixel( ret, char, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, short, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, int, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, long, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, unsigned char, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, unsigned short, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, unsigned int, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, unsigned long, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, float, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_Pixel( ret, double, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, char, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, short, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, int, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, long, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, unsigned char, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, unsigned short, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, unsigned int, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, unsigned long, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, float, D, img, _GenerateData1 );
- else cpPlugins_Plugins_ImageWriter_RGB( ret, double, D, img, _GenerateData1 );
-
- return( ret );
+ std::string r = "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::
-_GenerateData1( )
+_GD1( )
{
typedef itk::Image< P, D > _TImage;
typedef itk::ImageFileWriter< _TImage > _TImageWriter;
virtual std::string _GenerateData( );
template< unsigned int D >
- std::string _GenerateData0( );
+ std::string _GD0( );
template< class P, unsigned int D >
- std::string _GenerateData1( );
+ std::string _GD1( );
protected:
itk::ProcessObject::Pointer m_Writer;
+++ /dev/null
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-
-// Explicit instantiations of most common itk-based image types
-
-template class itk::Image< char, 1 >;
-template class itk::Image< short, 1 >;
-template class itk::Image< int, 1 >;
-template class itk::Image< long, 1 >;
-template class itk::Image< unsigned char, 1 >;
-template class itk::Image< unsigned short, 1 >;
-template class itk::Image< unsigned int, 1 >;
-template class itk::Image< unsigned long, 1 >;
-template class itk::Image< float, 1 >;
-template class itk::Image< double, 1 >;
-template class itk::Image< itk::RGBPixel< char >, 1 >;
-template class itk::Image< itk::RGBPixel< short >, 1 >;
-template class itk::Image< itk::RGBPixel< int >, 1 >;
-template class itk::Image< itk::RGBPixel< long >, 1 >;
-template class itk::Image< itk::RGBPixel< unsigned char >, 1 >;
-template class itk::Image< itk::RGBPixel< unsigned short >, 1 >;
-template class itk::Image< itk::RGBPixel< unsigned int >, 1 >;
-template class itk::Image< itk::RGBPixel< unsigned long >, 1 >;
-template class itk::Image< itk::RGBPixel< float >, 1 >;
-template class itk::Image< itk::RGBPixel< double >, 1 >;
-
-template class itk::Image< char, 2 >;
-template class itk::Image< short, 2 >;
-template class itk::Image< int, 2 >;
-template class itk::Image< long, 2 >;
-template class itk::Image< unsigned char, 2 >;
-template class itk::Image< unsigned short, 2 >;
-template class itk::Image< unsigned int, 2 >;
-template class itk::Image< unsigned long, 2 >;
-template class itk::Image< float, 2 >;
-template class itk::Image< double, 2 >;
-template class itk::Image< itk::RGBPixel< char >, 2 >;
-template class itk::Image< itk::RGBPixel< short >, 2 >;
-template class itk::Image< itk::RGBPixel< int >, 2 >;
-template class itk::Image< itk::RGBPixel< long >, 2 >;
-template class itk::Image< itk::RGBPixel< unsigned char >, 2 >;
-template class itk::Image< itk::RGBPixel< unsigned short >, 2 >;
-template class itk::Image< itk::RGBPixel< unsigned int >, 2 >;
-template class itk::Image< itk::RGBPixel< unsigned long >, 2 >;
-template class itk::Image< itk::RGBPixel< float >, 2 >;
-template class itk::Image< itk::RGBPixel< double >, 2 >;
-
-template class itk::Image< char, 3 >;
-template class itk::Image< short, 3 >;
-template class itk::Image< int, 3 >;
-template class itk::Image< long, 3 >;
-template class itk::Image< unsigned char, 3 >;
-template class itk::Image< unsigned short, 3 >;
-template class itk::Image< unsigned int, 3 >;
-template class itk::Image< unsigned long, 3 >;
-template class itk::Image< float, 3 >;
-template class itk::Image< double, 3 >;
-template class itk::Image< itk::RGBPixel< char >, 3 >;
-template class itk::Image< itk::RGBPixel< short >, 3 >;
-template class itk::Image< itk::RGBPixel< int >, 3 >;
-template class itk::Image< itk::RGBPixel< long >, 3 >;
-template class itk::Image< itk::RGBPixel< unsigned char >, 3 >;
-template class itk::Image< itk::RGBPixel< unsigned short >, 3 >;
-template class itk::Image< itk::RGBPixel< unsigned int >, 3 >;
-template class itk::Image< itk::RGBPixel< unsigned long >, 3 >;
-template class itk::Image< itk::RGBPixel< float >, 3 >;
-template class itk::Image< itk::RGBPixel< double >, 3 >;
-
-template class itk::Image< char, 4 >;
-template class itk::Image< short, 4 >;
-template class itk::Image< int, 4 >;
-template class itk::Image< long, 4 >;
-template class itk::Image< unsigned char, 4 >;
-template class itk::Image< unsigned short, 4 >;
-template class itk::Image< unsigned int, 4 >;
-template class itk::Image< unsigned long, 4 >;
-template class itk::Image< float, 4 >;
-template class itk::Image< double, 4 >;
-template class itk::Image< itk::RGBPixel< char >, 4 >;
-template class itk::Image< itk::RGBPixel< short >, 4 >;
-template class itk::Image< itk::RGBPixel< int >, 4 >;
-template class itk::Image< itk::RGBPixel< long >, 4 >;
-template class itk::Image< itk::RGBPixel< unsigned char >, 4 >;
-template class itk::Image< itk::RGBPixel< unsigned short >, 4 >;
-template class itk::Image< itk::RGBPixel< unsigned int >, 4 >;
-template class itk::Image< itk::RGBPixel< unsigned long >, 4 >;
-template class itk::Image< itk::RGBPixel< float >, 4 >;
-template class itk::Image< itk::RGBPixel< double >, 4 >;
-
-// eof - $RCSfile$