SET(
EXAMPLES_PROGRAMS
- ## example_TestParameters
+ example_TestParameters
example_LoadPlugins
example_ReadWriteImage
example_MarchingCubes
example_OtsuFilter
+ example_RGBImageToHSVChannels
+ example_RGBImageToYPbPrChannels
## example_ReadImageSeriesWriteImage
## example_ReadQuadEdgeMesh
## example_RenderQuadEdgeMesh
- ## example_RGBImageToHSVChannels
- ## example_RGBImageToYPbPrChannels
## example_MPR
)
#include <string>
#include <cpPlugins/Interface/Interface.h>
-#include <cpPlugins/Interface/DataObject.h>
#include <cpPlugins/Interface/ProcessObject.h>
-// -------------------------------------------------------------------------
-typedef cpPlugins::Interface::Interface TInterface;
-typedef cpPlugins::Interface::DataObject TDataObject;
-typedef TInterface::TClasses TClasses;
-typedef cpPlugins::Interface::ProcessObject TProcessObject;
-typedef cpPlugins::Interface::Parameters TParameters;
-
-// -------------------------------------------------------------------------
-void SaveImage(
- TInterface& plugins, const std::string& fname, TDataObject* image
- )
-{
- TProcessObject::Pointer writer;
- writer = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageWriter" );
- if( writer.IsNull( ) )
- {
- std::cerr << "No suitable writer found in plugins." << std::endl;
- return;
-
- } // fi
-
- // Configure reader
- TParameters writer_params = writer->GetDefaultParameters( );
- writer_params.SetValueAsString( "FileName", fname );
- writer->SetParameters( writer_params );
-
- writer->SetInput( 0, image );
- std::string msg = writer->Update( );
- if( msg != "" )
- std::cerr << "ERROR: " << msg << std::endl;
-}
-
-// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
- if( argc < 8 )
+ if( argc < 4 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
<< " plugins_file"
- << " input_image"
- << " output_hue_image output_saturation_image output_value_image"
- << " dimensions pixel_type" << std::endl;
+ << " input_image output_image" << std::endl;
return( 1 );
} // fi
- std::string plugins_file = argv[ 1 ];
- std::string input_image_file = argv[ 2 ];
- std::string output_hue_image_file = argv[ 3 ];
- std::string output_saturation_image_file = argv[ 4 ];
- std::string output_value_image_file = argv[ 5 ];
- unsigned int dimensions = std::atoi( argv[ 6 ] );
- std::string pixel_type = argv[ 7 ];
// Create interface
-
+ typedef cpPlugins::Interface::Interface TInterface;
+ typedef TInterface::TClasses TClasses;
TInterface plugins;
- plugins.Load( plugins_file );
-
- // Create objects
- TProcessObject::Pointer reader;
- TProcessObject::Pointer filter;
-
- reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" );
- if( reader.IsNull( ) )
+ if( !plugins.Load( argv[ 1 ] ) )
{
- std::cerr << "No suitable reader found in plugins." << std::endl;
+ std::cerr << "Failed to load plugins." << std::endl;
return( 1 );
} // fi
- filter = plugins.CreateProcessObject( "cpPlugins::Plugins::RGBImageToHSVChannelsFilter" );
- if( filter.IsNull( ) )
+
+ // Create objects
+ typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::Parameters TParameters;
+ cpPlugins::Interface::ProcessObject::Pointer reader, writer, filter;
+ reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+ writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" );
+ filter = plugins.CreateProcessObject( "cpPlugins::RGBImageToOtherChannelsFilter");
+ if( reader.IsNull( ) || writer.IsNull( ) || filter.IsNull( ) )
{
- std::cerr << "No suitable filter found in plugins." << std::endl;
+ std::cerr << "No suitable objects found in plugins." << std::endl;
return( 1 );
} // fi
// Configure reader
TParameters reader_params = reader->GetDefaultParameters( );
- reader_params.AddValueToStringList( "FileNames", input_image_file );
- reader_params.SetValueAsString( "PixelType", pixel_type );
- reader_params.SetValueAsUint( "ImageDimension", dimensions );
- reader_params.SetValueAsUint( "IsColorImage", 1 );
+ for( int i = 2; i < argc - 1; ++i )
+ reader_params.AddValueToStringList( "FileNames", argv[ i ] );
reader->SetParameters( reader_params );
+ // Configure filter
+ TParameters filter_params = filter->GetDefaultParameters( );
+ filter_params.SetValueAsString( "OutChannel", "HSV" );
+ filter->SetParameters( filter_params );
+
+ // Configure writer
+ TParameters writer_params = writer->GetDefaultParameters( );
+ writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
+ writer->SetParameters( writer_params );
+
// Connect pipeline
filter->SetInput( 0, reader->GetOutput( 0 ) );
+ writer->SetInput( 0, filter->GetOutput( 0 ) );
- // Save outputs
- SaveImage( plugins, output_hue_image_file, filter->GetOutput( 0 ) );
- SaveImage( plugins, output_saturation_image_file, filter->GetOutput( 1 ) );
- SaveImage( plugins, output_value_image_file, filter->GetOutput( 2 ) );
+ // Execute pipeline
+ std::string err = writer->Update( );
+ if( err != "" )
+ {
+ std::cerr << "ERROR: " << err << std::endl;
+ return( 1 );
+ } // fi
return( 0 );
}
#include <string>
#include <cpPlugins/Interface/Interface.h>
-#include <cpPlugins/Interface/DataObject.h>
#include <cpPlugins/Interface/ProcessObject.h>
-// -------------------------------------------------------------------------
-typedef cpPlugins::Interface::Interface TInterface;
-typedef cpPlugins::Interface::DataObject TDataObject;
-typedef TInterface::TClasses TClasses;
-typedef cpPlugins::Interface::ProcessObject TProcessObject;
-typedef cpPlugins::Interface::Parameters TParameters;
-
-// -------------------------------------------------------------------------
-void SaveImage(
- TInterface& plugins, const std::string& fname, TDataObject* image
- )
-{
- TProcessObject::Pointer writer;
- writer = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageWriter" );
- if( writer.IsNull( ) )
- {
- std::cerr << "No suitable writer found in plugins." << std::endl;
- return;
-
- } // fi
-
- // Configure reader
- TParameters writer_params = writer->GetDefaultParameters( );
- writer_params.SetValueAsString( "FileName", fname );
- writer->SetParameters( writer_params );
-
- writer->SetInput( 0, image );
- std::string msg = writer->Update( );
- if( msg != "" )
- std::cerr << "ERROR: " << msg << std::endl;
-}
-
-// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
- if( argc < 8 )
+ if( argc < 4 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
<< " plugins_file"
- << " input_image"
- << " output_hue_image output_saturation_image output_value_image"
- << " dimensions pixel_type" << std::endl;
+ << " input_image output_image" << std::endl;
return( 1 );
} // fi
- std::string plugins_file = argv[ 1 ];
- std::string input_image_file = argv[ 2 ];
- std::string output_hue_image_file = argv[ 3 ];
- std::string output_saturation_image_file = argv[ 4 ];
- std::string output_value_image_file = argv[ 5 ];
- unsigned int dimensions = std::atoi( argv[ 6 ] );
- std::string pixel_type = argv[ 7 ];
// Create interface
-
+ typedef cpPlugins::Interface::Interface TInterface;
+ typedef TInterface::TClasses TClasses;
TInterface plugins;
- plugins.Load( plugins_file );
-
- // Create objects
- TProcessObject::Pointer reader;
- TProcessObject::Pointer filter;
-
- reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" );
- if( reader.IsNull( ) )
+ if( !plugins.Load( argv[ 1 ] ) )
{
- std::cerr << "No suitable reader found in plugins." << std::endl;
+ std::cerr << "Failed to load plugins." << std::endl;
return( 1 );
} // fi
- filter = plugins.CreateProcessObject( "cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter" );
- if( filter.IsNull( ) )
+
+ // Create objects
+ typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::Parameters TParameters;
+ cpPlugins::Interface::ProcessObject::Pointer reader, writer, filter;
+ reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+ writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" );
+ filter = plugins.CreateProcessObject( "cpPlugins::RGBImageToOtherChannelsFilter");
+ if( reader.IsNull( ) || writer.IsNull( ) || filter.IsNull( ) )
{
- std::cerr << "No suitable filter found in plugins." << std::endl;
+ std::cerr << "No suitable objects found in plugins." << std::endl;
return( 1 );
} // fi
// Configure reader
TParameters reader_params = reader->GetDefaultParameters( );
- reader_params.AddValueToStringList( "FileNames", input_image_file );
- reader_params.SetValueAsString( "PixelType", pixel_type );
- reader_params.SetValueAsUint( "ImageDimension", dimensions );
- reader_params.SetValueAsUint( "IsColorImage", 1 );
+ for( int i = 2; i < argc - 1; ++i )
+ reader_params.AddValueToStringList( "FileNames", argv[ i ] );
reader->SetParameters( reader_params );
- // Connect pipeline
+ // Configure filter
TParameters filter_params = filter->GetDefaultParameters( );
- filter_params.SetValueAsString( "OutputPixelType", "float" );
+ filter_params.SetValueAsString( "OutChannel", "YPbPr" );
filter->SetParameters( filter_params );
+
+ // Configure writer
+ TParameters writer_params = writer->GetDefaultParameters( );
+ writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
+ writer->SetParameters( writer_params );
+
+ // Connect pipeline
filter->SetInput( 0, reader->GetOutput( 0 ) );
+ writer->SetInput( 0, filter->GetOutput( 0 ) );
- // Save outputs
- SaveImage( plugins, output_hue_image_file, filter->GetOutput( 0 ) );
- SaveImage( plugins, output_saturation_image_file, filter->GetOutput( 1 ) );
- SaveImage( plugins, output_value_image_file, filter->GetOutput( 2 ) );
+ // Execute pipeline
+ std::string err = writer->Update( );
+ if( err != "" )
+ {
+ std::cerr << "ERROR: " << err << std::endl;
+ return( 1 );
+ } // fi
return( 0 );
}
#include <vnl/vnl_math.h>
#include <itkRGBPixel.h>
-#include <itkVector.h>
namespace cpExtensions
{
{
/**
*/
- template< class O >
+ template< class P >
struct RGBExtractFunction
{
- typedef RGBExtractFunction Self;
- typedef itk::Vector< O, 3 > TOutPixel;
+ typedef RGBExtractFunction Self;
+ typedef P TOutPixel;
+ typedef typename P::ValueType TValue;
template< class Tr, class Tg, class Tb >
- TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+ P operator()( const Tr& r, const Tg& g, const Tb& b ) const
{
- TOutPixel rgb;
- rgb[ 0 ] = O( r );
- rgb[ 1 ] = O( g );
- rgb[ 2 ] = O( b );
- return( rgb );
+ P out;
+ out[ 0 ] = TValue( r );
+ out[ 1 ] = TValue( g );
+ out[ 2 ] = TValue( b );
+ return( out );
}
template< class C >
itkNewMacro( Self );
itkTypeMacro( RGBImageToOtherChannelsFilter, itkImageToImageFilter );
- public:
- O* GetChannel1( );
- O* GetChannel2( );
- O* GetChannel3( );
-
- const O* GetChannel1( ) const;
- const O* GetChannel2( ) const;
- const O* GetChannel3( ) const;
-
- void GraftChannel1( O* c1 );
- void GraftChannel2( O* c2 );
- void GraftChannel3( O* c3 );
-
protected:
RGBImageToOtherChannelsFilter( );
virtual ~RGBImageToOtherChannelsFilter( );
#include <itkImageRegionIterator.h>
#include <itkImageRegionConstIterator.h>
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel1( )
-{
- return( this->GetOutput( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel2( )
-{
- return( this->GetOutput( 1 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel3( )
-{
- return( this->GetOutput( 2 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-const O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel1( ) const
-{
- if( this->GetNumberOfOutputs( ) > 0 )
- return(
- dynamic_cast< const O* >(
- this->itk::ProcessObject::GetOutput( 0 )
- )
- );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-const O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel2( ) const
-{
- if( this->GetNumberOfOutputs( ) > 1 )
- return(
- dynamic_cast< const O* >(
- this->itk::ProcessObject::GetOutput( 1 )
- )
- );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-const O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel3( ) const
-{
- if( this->GetNumberOfOutputs( ) > 2 )
- return(
- dynamic_cast< const O* >(
- this->itk::ProcessObject::GetOutput( 2 )
- )
- );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GraftChannel1( O* hue )
-{
- this->GraftNthOutput( 0, hue );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GraftChannel2( O* saturation )
-{
- this->GraftNthOutput( 1, saturation );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GraftChannel3( O* value )
-{
- this->GraftNthOutput( 2, value );
-}
-
// -------------------------------------------------------------------------
template< class I, class O, class C >
cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
: Superclass( )
{
this->SetNumberOfRequiredInputs( 1 );
- this->SetNumberOfRequiredOutputs( 3 );
- for( unsigned int i = 0; i < 3; i++ )
- {
- typename O::Pointer o = O::New( );
- this->SetNthOutput( i, o );
+ this->SetNumberOfRequiredOutputs( 1 );
- } // rof
+ typename O::Pointer o = O::New( );
+ this->SetNthOutput( 0, o );
}
// -------------------------------------------------------------------------
// typedef typename TInputPixel::ComponentType _TComponent;
typedef itk::ImageRegionConstIterator< I > _TInIt;
typedef itk::ImageRegionIterator< O > _TOutIt;
- typedef typename C::TOutPixel _TOutPixel;
_TInIt inIt( this->GetInput( ), region );
- _TOutIt hIt( this->GetChannel1( ), region );
- _TOutIt sIt( this->GetChannel2( ), region );
- _TOutIt vIt( this->GetChannel3( ), region );
+ _TOutIt outIt( this->GetOutput( ), region );
inIt.GoToBegin( );
- hIt.GoToBegin( );
- sIt.GoToBegin( );
- vIt.GoToBegin( );
- for( ; !inIt.IsAtEnd( ); ++inIt, ++hIt, ++sIt, ++vIt )
- {
- _TOutPixel other = this->Converter( inIt.Get( ) );
- hIt.Set( other[ 0 ] );
- sIt.Set( other[ 1 ] );
- vIt.Set( other[ 2 ] );
-
- } // rof
+ outIt.GoToBegin( );
+ for( ; !inIt.IsAtEnd( ); ++inIt, ++outIt )
+ outIt.Set( this->Converter( inIt.Get( ) ) );
}
#endif // __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__HXX__
#include <vnl/vnl_math.h>
#include <itkRGBPixel.h>
-#include <itkVector.h>
namespace cpExtensions
{
{
/**
*/
- template< class O >
+ template< class P >
struct RGBToHSVFunction
{
- typedef RGBToHSVFunction Self;
- typedef itk::Vector< O, 3 > TOutPixel;
+ typedef RGBToHSVFunction Self;
+ typedef P TOutPixel;
+ typedef typename P::ValueType TValue;
template< class Tr, class Tg, class Tb >
- TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+ P operator()( const Tr& r, const Tg& g, const Tb& b ) const
{
static const double mVal =
- double( std::numeric_limits< O >::max( ) );
+ double( std::numeric_limits< TValue >::max( ) );
static const double _0 = double( 0 );
static const double _1 = double( 1 );
static const double _2 = double( 2 );
static const double _3 = double( 3 );
static const double _2pi = _2 * double( vnl_math::pi );
- TOutPixel hsv;
+ P hsv;
double R = double( r );
double G = double( g );
if( A != _0 )
A = std::acos( ( RG + RB ) / ( _2 * A ) );
A /= _2pi;
- hsv[ 0 ] = O( mVal * ( ( G >= B )? A: _1 - A ) );
+ hsv[ 0 ] = TValue( mVal * ( ( G >= B )? A: _1 - A ) );
// Saturation
if( sRGB != _0 )
{
double C = ( G < R )? G: R;
C = ( B < C )? B: C;
- hsv[ 1 ] = O( mVal * ( _1 - ( ( _3 * C ) / sRGB ) ) );
+ hsv[ 1 ] = TValue( mVal * ( _1 - ( ( _3 * C ) / sRGB ) ) );
}
else
- hsv[ 1 ] = O( 0 );
+ hsv[ 1 ] = TValue( 0 );
// Value
- hsv[ 2 ] = O( sRGB / _3 );
+ hsv[ 2 ] = TValue( sRGB / _3 );
return( hsv );
}
+++ /dev/null
-// -------------------------------------------------------------------------
-// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
-// -------------------------------------------------------------------------
-
-#ifndef __CPEXTENSIONS__ALGORITHMS__RGBTORGBFUNCTION__H__
-#define __CPEXTENSIONS__ALGORITHMS__RGBTORGBFUNCTION__H__
-
-#include <itkRGBPixel.h>
-#include <itkMatrix.h>
-#include <itkVector.h>
-
-namespace cpExtensions
-{
- namespace Algorithms
- {
- /**
- */
- template< class O >
- struct RGBToRGBFunction
- {
- typedef RGBToRGBFunction Self;
- typedef itk::Vector< O, 3 > TOutPixel;
-
- template< class Tr, class Tg, class Tb >
- TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
- {
- TOutPixel rgb;
- rgb[ 0 ] = O( r );
- rgb[ 1 ] = O( g );
- rgb[ 2 ] = O( b );
- return( rgb );
- }
-
- template< class C >
- TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
- {
- return(
- this->operator()(
- rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
- )
- );
- }
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPEXTENSIONS__ALGORITHMS__RGBTORGBFUNCTION__H__
-
-// eof - $RCSfile$
{
/**
*/
- template< class O >
+ template< class P >
struct RGBToYPbPrFunction
{
- typedef RGBToYPbPrFunction Self;
- typedef itk::Vector< O, 3 > TOutPixel;
+ typedef RGBToYPbPrFunction Self;
+ typedef P TOutPixel;
+ typedef typename P::ValueType TValue;
template< class Tr, class Tg, class Tb >
- TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+ P operator()( const Tr& r, const Tg& g, const Tb& b ) const
{
- static const O M[] =
+ static const double M[] =
{
- O( 0.2990 ), O( 0.5870 ), O( 0.1140 ),
- O( -0.1687 ), O( -0.3313 ), O( 0.5000 ),
- O( 0.5000 ), O( -0.4187 ), O( -0.0813 )
+ double( 0.2990 ), double( 0.5870 ), double( 0.1140 ),
+ double( -0.1687 ), double( -0.3313 ), double( 0.5000 ),
+ double( 0.5000 ), double( -0.4187 ), double( -0.0813 )
};
- static const vnl_matrix< O > vM( M, 3, 3 );
- static const itk::Matrix< O, 3, 3 > iM( vM );
+ static const vnl_matrix< double > vM( M, 3, 3 );
+ static const itk::Matrix< double, 3, 3 > iM( vM );
- TOutPixel rgb;
- rgb[ 0 ] = O( r );
- rgb[ 1 ] = O( g );
- rgb[ 2 ] = O( b );
- return( iM * rgb );
+ itk::Vector< double, 3 > rgb;
+ rgb[ 0 ] = double( r );
+ rgb[ 1 ] = double( b );
+ rgb[ 2 ] = double( g );
+ rgb = iM * rgb;
+
+ P out;
+ out[ 0 ] = TValue( rgb[ 0 ] );
+ out[ 1 ] = TValue( rgb[ 1 ] );
+ out[ 2 ] = TValue( rgb[ 2 ] );
+ return( out );
}
template< class C >
else cpPlugins_Image_Input_Demangle( \
itk::RGBPixel< short >, D, I, O, r, f \
); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBPixel< int >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBPixel< long >, D, I, O, r, f \
+ ); \
else cpPlugins_Image_Input_Demangle( \
itk::RGBPixel< unsigned char >, D, I, O, r, f \
); \
else cpPlugins_Image_Input_Demangle( \
itk::RGBPixel< unsigned short >, D, I, O, r, f \
); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBPixel< unsigned int >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBPixel< unsigned long >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBPixel< float >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBPixel< double >, D, I, O, r, f \
+ ); \
else cpPlugins_Image_Input_Demangle( \
itk::RGBAPixel< char >, D, I, O, r, f \
); \
else cpPlugins_Image_Input_Demangle( \
itk::RGBAPixel< short >, D, I, O, r, f \
); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBAPixel< int >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBAPixel< long >, D, I, O, r, f \
+ ); \
else cpPlugins_Image_Input_Demangle( \
itk::RGBAPixel< unsigned char >, D, I, O, r, f \
); \
else cpPlugins_Image_Input_Demangle( \
itk::RGBAPixel< unsigned short >, D, I, O, r, f \
); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBAPixel< unsigned int >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBAPixel< unsigned long >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBAPixel< float >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ itk::RGBAPixel< double >, D, I, O, r, f \
+ ); \
else cpPlugins_Image_Input_Demangle( \
itk::Offset< D >, D, I, O, r, f \
); \
// -------------------------------------------------------------------------
// ITK base clases
+
+#ifndef cpPlugins_Interface_EXPORTS
+
cpPlugins_Image_Import_AllDimensions( char );
cpPlugins_Image_Import_AllDimensions( short );
cpPlugins_Image_Import_AllDimensions( int );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< unsigned short > );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< unsigned int > );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< unsigned long > );
+cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< float > );
+cpPlugins_VTKImage_Import_AllDimensions( itk::RGBPixel< double > );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< char > );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< short > );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< unsigned short > );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< unsigned int > );
cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< unsigned long > );
+cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< float > );
+cpPlugins_VTKImage_Import_AllDimensions( itk::RGBAPixel< double > );
cpPlugins_VTKImageArray_Import_AllDimensions( Vector, float );
cpPlugins_VTKImageArray_Import_AllDimensions( Vector, double );
cpPlugins_VTKImage_Import( itk::DiffusionTensor3D< float >, 3 );
cpPlugins_VTKImage_Import( itk::DiffusionTensor3D< double >, 3 );
+#endif // cpPlugins_Interface_EXPORTS
+
// -------------------------------------------------------------------------
template< class I >
void cpPlugins::Interface::Image::
cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned short > );
cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned int > );
cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned long > );
+cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< float > );
+cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< double > );
cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< char > );
cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< short > );
cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned short > );
cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned int > );
cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned long > );
+cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< float > );
+cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< double > );
cpPlugins_ImageArray_Export_AllDimensions( Vector, float );
cpPlugins_ImageArray_Export_AllDimensions( Vector, double );
)
// -------------------------------------------------------------------------
+
+#ifndef cpPlugins_Interface_EXPORTS
+
cpPlugins_Mesh_Import( Mesh, float, 2 );
cpPlugins_Mesh_Import( Mesh, double, 2 );
cpPlugins_Mesh_Import( Mesh, float, 3 );
cpPlugins_Mesh_Import( QuadEdgeMesh, float, 3 );
cpPlugins_Mesh_Import( QuadEdgeMesh, double, 3 );
+#endif // cpPlugins_Interface_EXPORTS
+
// -------------------------------------------------------------------------
template< class M >
void cpPlugins::Interface::Mesh::
#include <cpPlugins/Interface/ProcessObject.hxx>
-
-// -------------------------------------------------------------------------
-/* TODO
- #define cpPlugins_Image_Demangle_Methods( c ) \
- std::string _DemangleImageDimension( itk::DataObject* o ); \
- std::string _DemangleImagePixel( unsigned int d, itk::DataObject* o );
-
- // -------------------------------------------------------------------------
- #define cpPlugins_Image_Demangle_Methods_Code( c, f ) \
- std::string c::_DemangleImageDimension( itk::DataObject* o ) \
- { \
- std::string r = ""; \
- if( dynamic_cast< itk::ImageBase< 1 >* >( o ) != NULL ) \
- { \
- cpPlugins_Image_Array_Demangle( \
- itk::Vector, float, 1, 1, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Vector, double, 1, 1, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, float, 1, 1, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, double, 1, 1, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, float, 1, 1, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, double, 1, 1, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, float, 1, 1, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, double, 1, 1, o, f, r \
- ); \
- else r = this->_DemangleImagePixel( 1, o ); \
- } \
- else if( dynamic_cast< itk::ImageBase< 2 >* >( o ) != NULL ) \
- { \
- cpPlugins_Image_Demangle( \
- itk::RGBPixel< char >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< short >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< unsigned char >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< unsigned short >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< char >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< short >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< unsigned char >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< unsigned short >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Vector, float, 2, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Vector, double, 2, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, float, 2, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, double, 2, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, float, 2, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, double, 2, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, float, 2, 2, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, double, 2, 2, o, f, r \
- ); \
- else r = this->_DemangleImagePixel( 2, o ); \
- } \
- else if( dynamic_cast< itk::ImageBase< 3 >* >( o ) != NULL ) \
- { \
- cpPlugins_Image_Demangle( \
- itk::RGBPixel< char >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< short >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< unsigned char >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< unsigned short >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< char >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< short >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< unsigned char >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< unsigned short >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Vector, float, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Vector, double, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, float, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, double, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, float, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, double, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, float, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, double, 3, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::DiffusionTensor3D< float >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::DiffusionTensor3D< double >, 3, o, f, r \
- ); \
- else r = this->_DemangleImagePixel( 3, o ); \
- } \
- else if( dynamic_cast< itk::ImageBase< 4 >* >( o ) != NULL ) \
- { \
- cpPlugins_Image_Demangle( \
- itk::RGBPixel< char >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< short >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< unsigned char >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBPixel< unsigned short >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< char >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< short >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< unsigned char >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::RGBAPixel< unsigned short >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Vector, float, 4, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Vector, double, 4, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, float, 4, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::Point, double, 4, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, float, 4, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::CovariantVector, double, 4, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, float, 4, 4, o, f, r \
- ); \
- else cpPlugins_Image_Array_Demangle( \
- itk::SymmetricSecondRankTensor, double, 4, 4, o, f, r \
- ); \
- else r = this->_DemangleImagePixel( 4, o ); \
- } \
- else \
- r = \
- std::string( #c ) + \
- std::string( ": Image dimension not supported." ); \
- return( r ); \
- } \
- std::string c::_DemangleImagePixel( \
- unsigned int d, itk::DataObject* o \
- ) \
- { \
- std::string r = ""; \
- if( d == 1 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< float >, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< double >, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::Offset< 1 >, 1, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else if( d == 2 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< float >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< double >, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::Offset< 2 >, 2, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else if( d == 3 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< float >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< double >, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::Offset< 3 >, 3, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else if( d == 4 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< float >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- std::complex< double >, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- itk::Offset< 4 >, 4, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else \
- r = \
- std::string( #c ) + \
- std::string( ": Image dimension not supported." ); \
- return( r ); \
- }
-
- // -------------------------------------------------------------------------
- #define cpPlugins_Image_Demangle_Methods_Code_Only_Scalars( c, f ) \
- std::string c::_DemangleImageDimension( itk::DataObject* o ) \
- { \
- std::string r = ""; \
- if( dynamic_cast< itk::ImageBase< 1 >* >( o ) != NULL ) \
- r = this->_DemangleImagePixel( 1, o ); \
- else if( dynamic_cast< itk::ImageBase< 2 >* >( o ) != NULL ) \
- r = this->_DemangleImagePixel( 2, o ); \
- else if( dynamic_cast< itk::ImageBase< 3 >* >( o ) != NULL ) \
- r = this->_DemangleImagePixel( 3, o ); \
- else if( dynamic_cast< itk::ImageBase< 4 >* >( o ) != NULL ) \
- r = this->_DemangleImagePixel( 4, o ); \
- else \
- r = \
- std::string( #c ) + \
- std::string( ": Image dimension not supported." ); \
- return( r ); \
- } \
- std::string c::_DemangleImagePixel( \
- unsigned int d, itk::DataObject* o \
- ) \
- { \
- std::string r = ""; \
- if( d == 1 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 1, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 1, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else if( d == 2 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 2, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 2, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else if( d == 3 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 3, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 3, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else if( d == 4 ) \
- { \
- cpPlugins_Image_Demangle( \
- char, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- short, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- int, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- long, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned char, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned short, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned int, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- unsigned long, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- float, 4, o, f, r \
- ); \
- else cpPlugins_Image_Demangle( \
- double, 4, o, f, r \
- ); \
- else r = std::string( #c ) + std::string( ": Image type." ); \
- } \
- else \
- r = \
- std::string( #c ) + \
- std::string( ": Image dimension not supported." ); \
- return( r ); \
- }
-*/
-
#endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
// eof - $RCSfile$
## = Source code =
## ===============
-
-#FILE(GLOB LIB_HEADERS_H "*.h")
-#FILE(GLOB LIB_HEADERS_HPP "*.hpp")
-#FILE(GLOB LIB_HEADERS_HXX "*.hxx")
-#FILE(GLOB LIB_SOURCES_C "*.c")
-#FILE(GLOB LIB_SOURCES_CPP "*.cpp")
-#FILE(GLOB LIB_SOURCES_CXX "*.cxx")
-
-SET(
- LIB_HEADERS_H
- ImageReader.h
- #ImageWriter.h
- #MeshReader.h
- #MeshWriter.h
- #MarchingCubes.h
- #OtsuThresholdImageFilter.h
- )
-SET(
- LIB_SOURCES_CXX
- Host.cxx
- ImageReader.cxx
- #ImageWriter.cxx
- #MeshReader.cxx
- #MeshWriter.cxx
- #MarchingCubes.cxx
- #OtsuThresholdImageFilter.cxx
- )
+FILE(GLOB LIB_HEADERS_H "*.h")
+FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_SOURCES_C "*.c")
+FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_SOURCES_CXX "*.cxx")
## =====================
## = Compilation rules =
TARGET_LINK_LIBRARIES(
${LIBRARY_NAME}
cpPlugins_Interface
- #${ITK_LIBRARIES}
- #${VTK_LIBRARIES}
)
## ========================
#include <Pluma/Connector.hpp>
#include <cpPlugins/Plugins/ImageReader.h>
-/*
#include <cpPlugins/Plugins/ImageWriter.h>
#include <cpPlugins/Plugins/MeshReader.h>
#include <cpPlugins/Plugins/MeshWriter.h>
#include <cpPlugins/Plugins/MarchingCubes.h>
#include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
-*/
-/*
- #include <cpPlugins/Plugins/ImageSeriesReader.h>
- #include <cpPlugins/Plugins/MeshReader.h>
- #include <cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h>
- #include <cpPlugins/Plugins/RGBImageToYPbPrChannelsFilter.h>
-*/
-/// TODO: doc
+#include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
+/// TODO: doc
PLUMA_CONNECTOR
bool connect( pluma::Host& host )
{
using namespace cpPlugins::Plugins;
host.add( new ImageReaderProvider( ) );
- /*
host.add( new ImageWriterProvider( ) );
host.add( new MeshReaderProvider( ) );
host.add( new MeshWriterProvider( ) );
host.add( new MarchingCubesProvider( ) );
host.add( new OtsuThresholdImageFilterProvider( ) );
- */
-
- /*
- host.add( new ImageSeriesReaderProvider( ) );
- host.add( new MeshReaderProvider( ) );
- host.add( new PolyDataReaderProvider( ) );
- host.add( new RGBImageToHSVChannelsFilterProvider( ) );
- host.add( new RGBImageToYPbPrChannelsFilterProvider( ) );
- */
+ host.add( new RGBImageToOtherChannelsFilterProvider( ) );
return( true );
}
#include <cpPlugins/Plugins/ImageWriter.h>
#include <cpPlugins/Interface/Image.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>
// -------------------------------------------------------------------------
#include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
#include <cpPlugins/Interface/Image.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 <itkOtsuThresholdImageFilter.h>
// -------------------------------------------------------------------------
this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::Uint, "NumberOfHistogramBins" );
+ this->m_DefaultParameters.Configure(
+ Parameters::Uint, "NumberOfHistogramBins"
+ );
this->m_DefaultParameters.Configure( Parameters::Real, "InsideValue" );
this->m_DefaultParameters.Configure( Parameters::Real, "OutsideValue" );
this->m_DefaultParameters.SetValueAsUint( "NumberOfHistogramBins", 100 );
return( "OtsuThresholdImageFilter: output not correctly created." );
}
-// -------------------------------------------------------------------------
-/* TODO
- namespace cpPlugins
- {
- namespace Plugins
- {
- cpPlugins_Image_Demangle_Methods_Code_Only_Scalars(
- OtsuThresholdImageFilter, _DemangleInput
- );
- }
- }
-
- // -------------------------------------------------------------------------
- template< class I >
- std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
- _DemangleInput( itk::DataObject* image )
- {
- }
-
- // -------------------------------------------------------------------------
- template< class I, class O >
- std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
- _RealGD( itk::DataObject* image )
- {
- typedef itk::OtsuThresholdImageFilter< I, O > _F;
- typedef typename O::PixelType _OP;
-
- unsigned int bins = this->m_Parameters.GetValueAsUint( "NumberOfHistogramBins" );
- _OP in = _OP( this->m_Parameters.GetValueAsReal( "InsideValue" ) );
- _OP out = _OP( this->m_Parameters.GetValueAsReal( "OutsideValue" ) );
-
- _F* filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
- if( filter == NULL )
- {
- this->m_RealProcessObject = _F::New( );
- filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
- filter->SetInput( dynamic_cast< I* >( image ) );
- filter->SetNumberOfHistogramBins( bins );
- filter->SetInsideValue( in );
- filter->SetOutsideValue( out );
- filter->Update( );
- this->m_Outputs[ 0 ]->SetITKDataObject( filter->GetOutput( ) );
-
- return( "" );
- }
-*/
-
// eof - $RCSfile$
+++ /dev/null
-#include <cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h>
-#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Extensions/Algorithms/RGBImageToOtherChannelsFilter.h>
-#include <cpPlugins/Extensions/Algorithms/RGBToHSVFunction.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-#define cpPlugins_RGB2HSV_Dimension( r, d, o, f ) \
- if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL ) \
- r = this->f< d >( )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_RGB2HSV_RGB( r, p, d, o, f ) \
- if( \
- dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \
- ) \
- r = this->f< p, d >( )
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::RGBImageToHSVChannelsFilter::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::RGBImageToHSVChannelsFilter" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToHSVChannelsFilter::
-RGBImageToHSVChannelsFilter( )
- : Superclass( )
-{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 3 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 2 );
-
- this->m_DefaultParameters.Clear( );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToHSVChannelsFilter::
-~RGBImageToHSVChannelsFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::RGBImageToHSVChannelsFilter::
-_GenerateData( )
-{
- itk::DataObject* o = this->_GetInput( 0 );
-
- std::string r = "cpPlugins::Plugins::RGBImageToHSVChannelsFilter: itk::Image dimension not supported.";
- cpPlugins_RGB2HSV_Dimension( r, 1, o, _GD0 );
- else cpPlugins_RGB2HSV_Dimension( r, 2, o, _GD0 );
- else cpPlugins_RGB2HSV_Dimension( r, 3, o, _GD0 );
- else cpPlugins_RGB2HSV_Dimension( r, 4, o, _GD0 );
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::RGBImageToHSVChannelsFilter::
-_GD0( )
-{
- itk::ImageBase< D >* i =
- dynamic_cast< itk::ImageBase< D >* >( this->_GetInput( 0 ) );
-
- std::string r = "cpPlugins::Plugins::RGBImageToHSVChannelsFilter: itk::Image pixel type not supported";
- cpPlugins_RGB2HSV_RGB( r, char, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, short, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, int, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, long, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, unsigned char, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, unsigned short, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, unsigned int, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, unsigned long, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, float, D, i, _GD1 );
- else cpPlugins_RGB2HSV_RGB( r, double, D, i, _GD1 );
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::RGBImageToHSVChannelsFilter::
-_GD1( )
-{
- typedef itk::Image< itk::RGBPixel< P >, D > _TImage;
- typedef itk::Image< P, D > _TChannel;
- typedef cpPlugins::Extensions::Algorithms::RGBToHSVFunction< P > _TFunction;
- typedef cpPlugins::Extensions::Algorithms::
- RGBImageToOtherChannelsFilter< _TImage, _TChannel, _TFunction > _TFilter;
-
- // Filter creation
- _TFilter* filter =
- dynamic_cast< _TFilter* >( this->m_RealProcessObject.GetPointer( ) );
- if( filter == NULL )
- {
- this->m_RealProcessObject = _TFilter::New( );
- filter =
- dynamic_cast< _TFilter* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
- filter->SetInput( dynamic_cast< _TImage* >( this->_GetInput( 0 ) ) );
- filter->Update( );
-
- this->_SetOutput( 0, filter->GetChannel1( ) );
- this->_SetOutput( 1, filter->GetChannel2( ) );
- this->_SetOutput( 2, filter->GetChannel3( ) );
-
- return( "" );
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__PLUGINS__RGBIMAGETOHSVCHANNELSFILTER__H__
-#define __CPPLUGINS__PLUGINS__RGBIMAGETOHSVCHANNELSFILTER__H__
-
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/ImageToImageFilter.h>
-
-namespace cpPlugins
-{
- namespace Plugins
- {
- /**
- */
- class cpPlugins_EXPORT RGBImageToHSVChannelsFilter
- : public cpPlugins::Interface::ImageToImageFilter
- {
- public:
- typedef RGBImageToHSVChannelsFilter Self;
- typedef cpPlugins::Interface::ImageToImageFilter Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro(
- RGBImageToHSVChannelsFilter,
- cpPluginsInterfaceImageToImageFilter
- );
-
- public:
- virtual std::string GetClassName( ) const;
-
- protected:
- RGBImageToHSVChannelsFilter( );
- virtual ~RGBImageToHSVChannelsFilter( );
-
- virtual std::string _GenerateData( );
-
- template< unsigned int D >
- std::string _GD0( );
-
- template< class P, unsigned int D >
- std::string _GD1( );
-
- private:
- // Purposely not implemented
- RGBImageToHSVChannelsFilter( const Self& );
- Self& operator=( const Self& );
- };
-
- // ---------------------------------------------------------------------
- CPPLUGINS_INHERIT_PROVIDER( RGBImageToHSVChannelsFilter );
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__PLUGINS__RGBIMAGETOHSVCHANNELSFILTER__H__
-
-// eof - $RCSfile$
--- /dev/null
+#include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
+#include <cpPlugins/Interface/Image.h>
+
+#include <cpExtensions/Algorithms/RGBImageToOtherChannelsFilter.h>
+#include <cpExtensions/Algorithms/RGBExtractFunction.h>
+#include <cpExtensions/Algorithms/RGBToHSVFunction.h>
+#include <cpExtensions/Algorithms/RGBToYPbPrFunction.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+RGBImageToOtherChannelsFilter( )
+ : Superclass( )
+{
+ typedef cpPlugins::Interface::Parameters TParameters;
+
+ this->m_ClassName = "cpPlugins::RGBImageToOtherChannelsFilter";
+ this->m_ClassCategory = "ImageToImageFilter";
+ this->SetNumberOfInputs( 1 );
+ this->SetNumberOfOutputs( 1 );
+ this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+
+ this->m_DefaultParameters.Configure( TParameters::String, "OutChannel" );
+ this->m_Parameters = this->m_DefaultParameters;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+~RGBImageToOtherChannelsFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Plugins_RGBImageToOtherChannelsFilter( P, D, I, O, r, f ) \
+ cpPlugins_Image_Input_Demangle( P< char >, D, I, O, r, f ); \
+ else cpPlugins_Image_Input_Demangle( P< short >, D, I, O, r, f ); \
+ else cpPlugins_Image_Input_Demangle( P< int >, D, I, O, r, f ); \
+ else cpPlugins_Image_Input_Demangle( P< long >, D, I, O, r, f ); \
+ else cpPlugins_Image_Input_Demangle( \
+ P< unsigned char >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ P< unsigned short >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ P< unsigned int >, D, I, O, r, f \
+ ); \
+ else cpPlugins_Image_Input_Demangle( \
+ P< unsigned long >, D, I, O, r, f \
+ )
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+_GenerateData( )
+{
+ cpPlugins::Interface::Image* image =
+ this->_Input< cpPlugins::Interface::Image >( 0 );
+ if( image == NULL )
+ return( "RGBImageToOtherChannelsFilter: No input image." );
+
+ itk::DataObject* itk_image = NULL;
+ std::string r = "";
+ cpPlugins_Plugins_RGBImageToOtherChannelsFilter(
+ itk::RGBPixel, 2, image, itk_image, r, _DemangleOutput
+ );
+ else cpPlugins_Plugins_RGBImageToOtherChannelsFilter(
+ itk::RGBPixel, 3, image, itk_image, r, _DemangleOutput
+ );
+ else cpPlugins_Plugins_RGBImageToOtherChannelsFilter(
+ itk::RGBPixel, 4, image, itk_image, r, _DemangleOutput
+ );
+ else r = "RGBImageToOtherChannelsFilter: Input image type not supported.";
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+_DemangleOutput( itk::DataObject* image )
+{
+ typedef typename I::PixelType _P;
+
+ std::string outc = this->m_Parameters.GetValueAsString( "OutChannel" );
+ std::string r = "";
+
+ using namespace cpExtensions::Algorithms;
+ if( outc == "HSV" )
+ r = this->_RealGD< I, RGBToHSVFunction< _P > >( image );
+ else if( outc == "YPbPr" )
+ r = this->_RealGD< I, RGBToYPbPrFunction< _P > >( image );
+ else if( outc == "Copy" )
+ r = this->_RealGD< I, RGBExtractFunction< _P > >( image );
+ else
+ r =
+ std::string( "RGBImageToOtherChannelsFilter: Conversor not available: " ) +
+ outc;
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I, class C >
+std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+_RealGD( itk::DataObject* image )
+{
+ typedef itk::Image< itk::RGBPixel< double >, I::ImageDimension > _O;
+ typedef
+ cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, _O, C >
+ _F;
+
+ // Configure filter
+ _F* filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
+ if( filter == NULL )
+ {
+ this->m_RealProcessObject = _F::New( );
+ filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
+
+ } // fi
+ filter->SetInput( dynamic_cast< I* >( image ) );
+ filter->Update( );
+
+ // Connect output
+ cpPlugins::Interface::Image* out =
+ this->_Output< cpPlugins::Interface::Image >( 0 );
+ if( out != NULL )
+ {
+ out->SetITKImage< _O >( filter->GetOutput( ) );
+ return( "" );
+ }
+ else
+ return( "RGBImageToOtherChannelsFilter: output not correctly created." );
+
+ return( "" );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__PLUGINS__RGBIMAGETOOTHERCHANNELSFILTER__H__
+#define __CPPLUGINS__PLUGINS__RGBIMAGETOOTHERCHANNELSFILTER__H__
+
+#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+
+namespace cpPlugins
+{
+ namespace Plugins
+ {
+ /**
+ */
+ class cpPlugins_EXPORT RGBImageToOtherChannelsFilter
+ : public cpPlugins::Interface::ImageToImageFilter
+ {
+ public:
+ typedef RGBImageToOtherChannelsFilter Self;
+ typedef cpPlugins::Interface::ImageToImageFilter Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro(
+ RGBImageToOtherChannelsFilter,
+ cpPluginsInterfaceImageToImageFilter
+ );
+
+ protected:
+ RGBImageToOtherChannelsFilter( );
+ virtual ~RGBImageToOtherChannelsFilter( );
+
+ virtual std::string _GenerateData( );
+
+ template< class I >
+ inline std::string _DemangleOutput( itk::DataObject* image );
+
+ template< class I, class C >
+ inline std::string _RealGD( itk::DataObject* image );
+
+ private:
+ // Purposely not implemented
+ RGBImageToOtherChannelsFilter( const Self& );
+ Self& operator=( const Self& );
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( RGBImageToOtherChannelsFilter );
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__PLUGINS__RGBIMAGETOOTHERCHANNELSFILTER__H__
+
+// eof - $RCSfile$
+++ /dev/null
-#include <cpPlugins/Plugins/RGBImageToYPbPrChannelsFilter.h>
-#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Extensions/Algorithms/RGBImageToOtherChannelsFilter.h>
-#include <cpPlugins/Extensions/Algorithms/RGBToYPbPrFunction.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-#define cpPlugins_RGB2YPbPr_Dimension( r, d, o, f ) \
- if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL ) \
- r = this->f< d >( )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_RGB2YPbPr_RGB( r, p, d, o, f ) \
- if( \
- dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \
- ) \
- r = this->f< p, d >( )
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter::
-RGBImageToYPbPrChannelsFilter( )
- : Superclass( )
-{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 3 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 2 );
-
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::String, "OutputPixelType" );
- this->m_DefaultParameters.SetValueAsString( "PixelType", "float" );
- this->m_Parameters = this->m_DefaultParameters;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter::
-~RGBImageToYPbPrChannelsFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter::
-_GenerateData( )
-{
- itk::DataObject* o = this->_GetInput( 0 );
-
- std::string r = "cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter: itk::Image dimension not supported.";
- cpPlugins_RGB2YPbPr_Dimension( r, 1, o, _GD0 );
- else cpPlugins_RGB2YPbPr_Dimension( r, 2, o, _GD0 );
- else cpPlugins_RGB2YPbPr_Dimension( r, 3, o, _GD0 );
- else cpPlugins_RGB2YPbPr_Dimension( r, 4, o, _GD0 );
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter::
-_GD0( )
-{
- itk::ImageBase< D >* i =
- dynamic_cast< itk::ImageBase< D >* >( this->_GetInput( 0 ) );
-
- std::string r = "cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter: itk::Image pixel type not supported";
- cpPlugins_RGB2YPbPr_RGB( r, char, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, short, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, int, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, long, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, unsigned char, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, unsigned short, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, unsigned int, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, unsigned long, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, float, D, i, _GD1 );
- else cpPlugins_RGB2YPbPr_RGB( r, double, D, i, _GD1 );
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter::
-_GD1( )
-{
- using namespace cpPlugins::Interface;
- Parameters::TString pt =
- this->m_Parameters.GetValueAsString( "OutputPixelType" );
-
- std::string r = "cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter: itk::Image output pixel type not supported";
- if( pt == "float" )
- r = this->_GD2< P, float, D >( );
- else if( pt == "double" )
- r = this->_GD2< P, double, D >( );
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class P, class O, unsigned int D >
-std::string cpPlugins::Plugins::RGBImageToYPbPrChannelsFilter::
-_GD2( )
-{
- typedef itk::Image< itk::RGBPixel< P >, D > _TImage;
- typedef itk::Image< O, D > _TChannel;
- typedef cpPlugins::Extensions::Algorithms::RGBToYPbPrFunction< O > _TFunction;
- typedef cpPlugins::Extensions::Algorithms::
- RGBImageToOtherChannelsFilter< _TImage, _TChannel, _TFunction > _TFilter;
-
- // Filter creation
- _TFilter* filter =
- dynamic_cast< _TFilter* >( this->m_RealProcessObject.GetPointer( ) );
- if( filter == NULL )
- {
- this->m_RealProcessObject = _TFilter::New( );
- filter =
- dynamic_cast< _TFilter* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
- filter->SetInput( dynamic_cast< _TImage* >( this->_GetInput( 0 ) ) );
- filter->Update( );
-
- this->_SetOutput( 0, filter->GetChannel1( ) );
- this->_SetOutput( 1, filter->GetChannel2( ) );
- this->_SetOutput( 2, filter->GetChannel3( ) );
-
- return( "" );
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__PLUGINS__RGBIMAGETOYPBPRCHANNELSFILTER__H__
-#define __CPPLUGINS__PLUGINS__RGBIMAGETOYPBPRCHANNELSFILTER__H__
-
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/ImageToImageFilter.h>
-
-namespace cpPlugins
-{
- namespace Plugins
- {
- /**
- */
- class cpPlugins_EXPORT RGBImageToYPbPrChannelsFilter
- : public cpPlugins::Interface::ImageToImageFilter
- {
- public:
- typedef RGBImageToYPbPrChannelsFilter Self;
- typedef cpPlugins::Interface::ImageToImageFilter Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro(
- RGBImageToYPbPrChannelsFilter,
- cpPluginsInterfaceImageToImageFilter
- );
-
- public:
- virtual std::string GetClassName( ) const;
-
- protected:
- RGBImageToYPbPrChannelsFilter( );
- virtual ~RGBImageToYPbPrChannelsFilter( );
-
- virtual std::string _GenerateData( );
-
- template< unsigned int D >
- std::string _GD0( );
-
- template< class P, unsigned int D >
- std::string _GD1( );
-
- template< class P, class O, unsigned int D >
- std::string _GD2( );
-
- private:
- // Purposely not implemented
- RGBImageToYPbPrChannelsFilter( const Self& );
- Self& operator=( const Self& );
- };
-
- // ---------------------------------------------------------------------
- CPPLUGINS_INHERIT_PROVIDER( RGBImageToYPbPrChannelsFilter );
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__PLUGINS__RGBIMAGETOYPBPRCHANNELSFILTER__H__
-
-// eof - $RCSfile$