SET(
EXAMPLES_PROGRAMS
## example_TestParameters
- ## example_LoadPlugins
+ example_LoadPlugins
example_ReadWriteImage
+ example_MarchingCubes
+ example_OtsuFilter
## example_ReadImageSeriesWriteImage
## example_ReadQuadEdgeMesh
## example_RenderQuadEdgeMesh
## example_RGBImageToHSVChannels
## example_RGBImageToYPbPrChannels
## example_MPR
- example_MarchingCubes
)
FOREACH(prog ${EXAMPLES_PROGRAMS})
typedef TInterface::TClasses TClasses;
TInterface plugins;
- plugins.Load( plugins_file );
+ if( !plugins.Load( plugins_file ) )
+ {
+ std::cerr << "Error loading plugins file." << std::endl;
+ return( 1 );
+ } // fi
+
std::cout << "---------------------------------------------" << std::endl;
std::cout << "Loaded classes:" << std::endl;
TClasses::const_iterator cIt = plugins.GetClasses( ).begin( );
- TClasses::const_iterator end_cIt = plugins.GetClasses( ).end( );
- for( ; cIt != end_cIt; ++cIt )
+ for( ; cIt != plugins.GetClasses( ).end( ); ++cIt )
std::cout << " := " << cIt->first << std::endl;
std::cout << "---------------------------------------------" << std::endl;
-
return( 0 );
}
--- /dev/null
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+int main( int argc, char* argv[] )
+{
+ if( argc < 4 )
+ {
+ std::cerr
+ << "Usage: " << argv[ 0 ]
+ << " plugins_file"
+ << " input_image output_image" << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create interface
+ typedef cpPlugins::Interface::Interface TInterface;
+ typedef TInterface::TClasses TClasses;
+ TInterface plugins;
+ if( !plugins.Load( argv[ 1 ] ) )
+ {
+ std::cerr << "Failed to load plugins." << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create objects
+ typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::Parameters TParameters;
+ cpPlugins::Interface::ProcessObject::Pointer reader, writer, otsu;
+ reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+ writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" );
+ otsu = plugins.CreateProcessObject( "cpPlugins::OtsuThresholdImageFilter" );
+ if( reader.IsNull( ) || writer.IsNull( ) || otsu.IsNull( ) )
+ {
+ std::cerr << "No suitable objects found in plugins." << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Configure reader
+ TParameters reader_params = reader->GetDefaultParameters( );
+ for( int i = 2; i < argc - 1; ++i )
+ reader_params.AddValueToStringList( "FileNames", argv[ i ] );
+ reader->SetParameters( reader_params );
+
+ // Configure otsu
+ TParameters otsu_params = otsu->GetDefaultParameters( );
+ otsu_params.SetValueAsUint( "NumberOfHistogramBins", 100 );
+ otsu_params.SetValueAsReal( "InsideValue", 255 );
+ otsu_params.SetValueAsReal( "OutsideValue", 0 );
+ otsu_params.SetValueAsString( "OutputType", "uchar" );
+ otsu->SetParameters( otsu_params );
+
+ // Configure writer
+ TParameters writer_params = writer->GetDefaultParameters( );
+ writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
+ writer->SetParameters( writer_params );
+
+ // Connect pipeline
+ otsu->SetInput( 0, reader->GetOutput( 0 ) );
+ writer->SetInput( 0, otsu->GetOutput( 0 ) );
+
+ // Execute pipeline
+ std::string err = writer->Update( );
+ if( err != "" )
+ {
+ std::cerr << "ERROR: " << err << std::endl;
+ return( 1 );
+
+ } // fi
+ return( 0 );
+}
+
+// eof - $RCSfile$
#include <cpPlugins/Interface/Image.h>
-#undef ITK_MANUAL_INSTANTIATION
+#include <complex>
+#include <vtkImageData.h>
+
+#define ITK_MANUAL_INSTANTIATION
#include <itkImage.h>
+#include <itkImageToVTKImageFilter.h>
+
#include <itkCovariantVector.h>
+#include <itkDiffusionTensor3D.h>
+#include <itkPoint.h>
#include <itkRGBPixel.h>
#include <itkRGBAPixel.h>
-#include <itkVector.h>
#include <itkSymmetricSecondRankTensor.h>
-#include <itkDiffusionTensor3D.h>
-#include <itkImageToVTKImageFilter.h>
-#include <itkVTKImageToImageFilter.h>
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_Pixel( p, d, o ) \
- if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL ) \
- this->_ITK_2_VTK_1< p, d >( o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_Vector( p, d, o ) \
- if( \
- dynamic_cast< itk::Image< itk::Vector< p, d >, d >* >( o ) != NULL \
- ) \
- this->_ITK_2_VTK_1< itk::Vector< p, d >, d >( o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_CovVector( p, d, o ) \
- if( \
- dynamic_cast< itk::Image< itk::CovariantVector< p, d >, d >* >( o ) \
- != \
- NULL \
- ) \
- this->_ITK_2_VTK_1< itk::CovariantVector< p, d >, d >( o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_SymTensor( p, d, o ) \
- if( \
- dynamic_cast< itk::Image< itk::SymmetricSecondRankTensor< p, d >, d >* >( o ) \
- != \
- NULL \
- ) \
- this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< p, d >, d >( o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_RGB( p, d, o ) \
- cpPlugins_Image_Pixel( itk::RGBPixel< p >, d, o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_RGBA( p, d, o ) \
- cpPlugins_Image_Pixel( itk::RGBAPixel< p >, d, o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Image_DiffTensor( p, d, o ) \
- cpPlugins_Image_Pixel( itk::DiffusionTensor3D< p >, d, o )
+#include <itkVector.h>
// -------------------------------------------------------------------------
void cpPlugins::Interface::Image::
SetITKDataObject( itk::DataObject* o )
{
+ bool r;
if( dynamic_cast< itk::ImageBase< 1 >* >( o ) != NULL )
- this->_ITK_2_VTK_0< 1 >( o );
+ {
+ cpPlugins_Image_Array_Demangle(
+ itk::Vector, float, 1, 1, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Vector, double, 1, 1, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Point, float, 1, 1, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Point, double, 1, 1, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::CovariantVector, float, 1, 1, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::CovariantVector, double, 1, 1, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::SymmetricSecondRankTensor, float, 1, 1, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::SymmetricSecondRankTensor, double, 1, 1, o, _Type, r
+ );
+ else r = this->_Dim< 1 >( o );
+ }
else if( dynamic_cast< itk::ImageBase< 2 >* >( o ) != NULL )
- this->_ITK_2_VTK_0< 2 >( o );
+ {
+ cpPlugins_Image_Demangle(
+ itk::RGBPixel< char >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBPixel< short >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBPixel< unsigned char >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBPixel< unsigned short >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< char >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< short >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< unsigned char >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< unsigned short >, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Vector, float, 2, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Vector, double, 2, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Point, float, 2, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Point, double, 2, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::CovariantVector, float, 2, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::CovariantVector, double, 2, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::SymmetricSecondRankTensor, float, 2, 2, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::SymmetricSecondRankTensor, double, 2, 2, o, _Type, r
+ );
+ else r = this->_Dim< 2 >( o );
+ }
else if( dynamic_cast< itk::ImageBase< 3 >* >( o ) != NULL )
- this->_ITK_2_VTK_0< 3 >( o );
- else
- this->m_ITKObject = NULL;
+ {
+ cpPlugins_Image_Demangle(
+ itk::RGBPixel< char >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBPixel< short >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBPixel< unsigned char >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBPixel< unsigned short >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< char >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< short >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< unsigned char >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::RGBAPixel< unsigned short >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Vector, float, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Vector, double, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Point, float, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::Point, double, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::CovariantVector, float, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::CovariantVector, double, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::SymmetricSecondRankTensor, float, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Array_Demangle(
+ itk::SymmetricSecondRankTensor, double, 3, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::DiffusionTensor3D< float >, 3, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ itk::DiffusionTensor3D< double >, 3, o, _Type, r
+ );
+ else r = this->_Dim< 3 >( o );
+ }
+ else if( dynamic_cast< itk::ImageBase< 4 >* >( o ) != NULL )
+ {
+ this->m_ITKObject = o;
+ this->m_VTKObject = NULL;
+ this->m_ITKvVTKConnection = NULL;
+
+ } // fi
}
// -------------------------------------------------------------------------
const vtkImageData* cpPlugins::Interface::Image::
GetVTKImageData( ) const
{
- return( dynamic_cast< const vtkImageData* >( this->GetVTKDataObject( ) ) );
+ return(
+ dynamic_cast< const vtkImageData* >( this->GetVTKDataObject( ) )
+ );
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
template< unsigned int D >
-void cpPlugins::Interface::Image::
-_ITK_2_VTK_0( itk::DataObject* o )
+bool cpPlugins::Interface::Image::
+_Dim( itk::DataObject* o )
{
- cpPlugins_Image_Pixel( char, D, o );
- else cpPlugins_Image_Pixel( short, D, o );
- else cpPlugins_Image_Pixel( int, D, o );
- else cpPlugins_Image_Pixel( long, D, o );
- else cpPlugins_Image_Pixel( float, D, o );
- else cpPlugins_Image_Pixel( double, D, o );
- else cpPlugins_Image_Pixel( unsigned char, D, o );
- else cpPlugins_Image_Pixel( unsigned short, D, o );
- else cpPlugins_Image_Pixel( unsigned int, D, o );
- else cpPlugins_Image_Pixel( unsigned long, D, o );
- else cpPlugins_Image_RGB( char, D, o );
- else cpPlugins_Image_RGB( short, D, o );
- else cpPlugins_Image_RGB( int, D, o );
- else cpPlugins_Image_RGB( long, D, o );
- else cpPlugins_Image_RGB( float, D, o );
- else cpPlugins_Image_RGB( double, D, o );
- else cpPlugins_Image_RGB( unsigned char, D, o );
- else cpPlugins_Image_RGB( unsigned short, D, o );
- else cpPlugins_Image_RGB( unsigned int, D, o );
- else cpPlugins_Image_RGB( unsigned long, D, o );
- else cpPlugins_Image_RGBA( char, D, o );
- else cpPlugins_Image_RGBA( short, D, o );
- else cpPlugins_Image_RGBA( int, D, o );
- else cpPlugins_Image_RGBA( long, D, o );
- else cpPlugins_Image_RGBA( float, D, o );
- else cpPlugins_Image_RGBA( double, D, o );
- else cpPlugins_Image_RGBA( unsigned char, D, o );
- else cpPlugins_Image_RGBA( unsigned short, D, o );
- else cpPlugins_Image_RGBA( unsigned int, D, o );
- else cpPlugins_Image_RGBA( unsigned long, D, o );
- else cpPlugins_Image_Vector( char, D, o );
- else cpPlugins_Image_Vector( short, D, o );
- else cpPlugins_Image_Vector( int, D, o );
- else cpPlugins_Image_Vector( long, D, o );
- else cpPlugins_Image_Vector( float, D, o );
- else cpPlugins_Image_Vector( double, D, o );
- else cpPlugins_Image_Vector( unsigned char, D, o );
- else cpPlugins_Image_Vector( unsigned short, D, o );
- else cpPlugins_Image_Vector( unsigned int, D, o );
- else cpPlugins_Image_Vector( unsigned long, D, o );
- else cpPlugins_Image_CovVector( char, D, o );
- else cpPlugins_Image_CovVector( short, D, o );
- else cpPlugins_Image_CovVector( int, D, o );
- else cpPlugins_Image_CovVector( long, D, o );
- else cpPlugins_Image_CovVector( float, D, o );
- else cpPlugins_Image_CovVector( double, D, o );
- else cpPlugins_Image_CovVector( unsigned char, D, o );
- else cpPlugins_Image_CovVector( unsigned short, D, o );
- else cpPlugins_Image_CovVector( unsigned int, D, o );
- else cpPlugins_Image_CovVector( unsigned long, D, o );
- else cpPlugins_Image_SymTensor( char, D, o );
- else cpPlugins_Image_SymTensor( short, D, o );
- else cpPlugins_Image_SymTensor( int, D, o );
- else cpPlugins_Image_SymTensor( long, D, o );
- else cpPlugins_Image_SymTensor( float, D, o );
- else cpPlugins_Image_SymTensor( double, D, o );
- else cpPlugins_Image_SymTensor( unsigned char, D, o );
- else cpPlugins_Image_SymTensor( unsigned short, D, o );
- else cpPlugins_Image_SymTensor( unsigned int, D, o );
- else cpPlugins_Image_SymTensor( unsigned long, D, o );
- else cpPlugins_Image_DiffTensor( char, D, o );
- else cpPlugins_Image_DiffTensor( short, D, o );
- else cpPlugins_Image_DiffTensor( int, D, o );
- else cpPlugins_Image_DiffTensor( long, D, o );
- else cpPlugins_Image_DiffTensor( float, D, o );
- else cpPlugins_Image_DiffTensor( double, D, o );
- else cpPlugins_Image_DiffTensor( unsigned char, D, o );
- else cpPlugins_Image_DiffTensor( unsigned short, D, o );
- else cpPlugins_Image_DiffTensor( unsigned int, D, o );
- else cpPlugins_Image_DiffTensor( unsigned long, D, o );
+ bool r;
+ cpPlugins_Image_Demangle(
+ char, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ short, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ int, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ long, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ unsigned char, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ unsigned short, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ unsigned int, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ unsigned long, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ float, D, o, _Type, r
+ );
+ else cpPlugins_Image_Demangle(
+ double, D, o, _Type, r
+ );
+ else
+ {
+ this->m_ITKObject = o;
+ this->m_VTKObject = NULL;
+ this->m_ITKvVTKConnection = NULL;
+
+ } // fi
+ return( true );
}
// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-void cpPlugins::Interface::Image::
-_ITK_2_VTK_1( itk::DataObject* o )
+template< class I >
+bool cpPlugins::Interface::Image::
+_Type( itk::DataObject* o )
{
- typedef itk::Image< P, D > _I;
- typedef itk::ImageToVTKImageFilter< _I > _F;
-
+ typedef itk::ImageToVTKImageFilter< I > _F;
+
typename _F::Pointer f = _F::New( );
- f->SetInput( dynamic_cast< _I* >( o ) );
+ f->SetInput( dynamic_cast< I* >( o ) );
f->Update( );
this->m_ITKObject = o;
this->m_VTKObject = f->GetOutput( );
this->m_ITKvVTKConnection = f;
+
+ return( true );
}
// eof - $RCSfile$
class vtkImageData;
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle( p, d, o, f, r ) \
+ if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL ) \
+ r = this->f< itk::Image< p, d > >( o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Array_Demangle( a, p, da, di, o, f, r ) \
+ if( dynamic_cast< itk::Image< a< p, da >, di >* >( o ) != NULL ) \
+ r = this->f< itk::Image< a< p, da >, di > >( o )
+
+// -------------------------------------------------------------------------
namespace cpPlugins
{
namespace Interface
virtual ~Image( );
template< unsigned int D >
- void _ITK_2_VTK_0( itk::DataObject* o );
+ bool _Dim( itk::DataObject* o );
- template< class P, unsigned int D >
- void _ITK_2_VTK_1( itk::DataObject* o );
+ template< class I >
+ bool _Type( itk::DataObject* o );
private:
// Purposely not implemented
+#include <complex>
+
#undef ITK_MANUAL_INSTANTIATION
#include <itkImage.h>
+#include <itkImportImageContainer.h>
+#include <itkImageToVTKImageFilter.h>
+
#include <itkCovariantVector.h>
+#include <itkDiffusionTensor3D.h>
+#include <itkPoint.h>
#include <itkRGBPixel.h>
#include <itkRGBAPixel.h>
-#include <itkVector.h>
#include <itkSymmetricSecondRankTensor.h>
-#include <itkDiffusionTensor3D.h>
-#include <itkImageToVTKImageFilter.h>
+#include <itkVector.h>
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_Pixel( p, d ) \
- template class itk::Image< p, d >; \
- template class itk::ImageToVTKImageFilter< itk::Image< p, d > >
+#define cpPlugins_I_itk( p, d ) \
+ template class itk::Image< p, d >;
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_RGB( p, d ) \
- cpPlugins_Instance_itkImage_Pixel( itk::RGBPixel< p >, d )
+#define cpPlugins_I_itk_array( a, p, da, di ) \
+ template class itk::Image< a< p, da >, di >;
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_RGBA( p, d ) \
- cpPlugins_Instance_itkImage_Pixel( itk::RGBAPixel< p >, d )
+#define cpPlugins_I_itk_Container( p ) \
+ template class itk::ImportImageContainer< itk::SizeValueType, p >;
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_Vector( p, d ) \
- template class itk::Image< itk::Vector< p, d >, d >; \
- template class \
- itk::ImageToVTKImageFilter< itk::Image< itk::Vector< p, d >, d > >
+#define cpPlugins_I_itk_array_Container( a, p, d ) \
+ template class itk::ImportImageContainer< itk::SizeValueType, a< p, d > >;
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_CovVector( p, d ) \
- template class itk::Image< itk::CovariantVector< p, d >, d >; \
- template class \
- itk::ImageToVTKImageFilter< itk::Image< itk::CovariantVector< p, d >, d > >
+#define cpPlugins_I_itk_vtk( p, d ) \
+ template class itk::ImageToVTKImageFilter< itk::Image< p, d > >;
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_SymTensor( p, d ) \
- template class itk::Image< itk::SymmetricSecondRankTensor< p, d >, d >; \
+#define cpPlugins_I_itk_vtk_array( a, p, da, di ) \
template class \
- itk::ImageToVTKImageFilter< itk::Image< itk::SymmetricSecondRankTensor< p, d >, d > >
+ itk::ImageToVTKImageFilter< itk::Image< a< p, da > , di > >;
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_DiffTensor( p, d ) \
- cpPlugins_Instance_itkImage_Pixel( itk::DiffusionTensor3D< p >, d )
+// Possible itk types
-// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage_DIM( d ) \
- cpPlugins_Instance_itkImage_Pixel( char, d ); \
- cpPlugins_Instance_itkImage_Pixel( short, d ); \
- cpPlugins_Instance_itkImage_Pixel( int, d ); \
- cpPlugins_Instance_itkImage_Pixel( long, d ); \
- cpPlugins_Instance_itkImage_Pixel( float, d ); \
- cpPlugins_Instance_itkImage_Pixel( double, d ); \
- cpPlugins_Instance_itkImage_Pixel( unsigned char, d ); \
- cpPlugins_Instance_itkImage_Pixel( unsigned short, d ); \
- cpPlugins_Instance_itkImage_Pixel( unsigned int, d ); \
- cpPlugins_Instance_itkImage_Pixel( unsigned long, d ); \
- cpPlugins_Instance_itkImage_RGB( char, d ); \
- cpPlugins_Instance_itkImage_RGB( short, d ); \
- cpPlugins_Instance_itkImage_RGB( int, d ); \
- cpPlugins_Instance_itkImage_RGB( long, d ); \
- cpPlugins_Instance_itkImage_RGB( float, d ); \
- cpPlugins_Instance_itkImage_RGB( double, d ); \
- cpPlugins_Instance_itkImage_RGB( unsigned char, d ); \
- cpPlugins_Instance_itkImage_RGB( unsigned short, d ); \
- cpPlugins_Instance_itkImage_RGB( unsigned int, d ); \
- cpPlugins_Instance_itkImage_RGB( unsigned long, d ); \
- cpPlugins_Instance_itkImage_RGBA( char, d ); \
- cpPlugins_Instance_itkImage_RGBA( short, d ); \
- cpPlugins_Instance_itkImage_RGBA( int, d ); \
- cpPlugins_Instance_itkImage_RGBA( long, d ); \
- cpPlugins_Instance_itkImage_RGBA( float, d ); \
- cpPlugins_Instance_itkImage_RGBA( double, d ); \
- cpPlugins_Instance_itkImage_RGBA( unsigned char, d ); \
- cpPlugins_Instance_itkImage_RGBA( unsigned short, d ); \
- cpPlugins_Instance_itkImage_RGBA( unsigned int, d ); \
- cpPlugins_Instance_itkImage_RGBA( unsigned long, d ); \
- cpPlugins_Instance_itkImage_Vector( char, d ); \
- cpPlugins_Instance_itkImage_Vector( short, d ); \
- cpPlugins_Instance_itkImage_Vector( int, d ); \
- cpPlugins_Instance_itkImage_Vector( long, d ); \
- cpPlugins_Instance_itkImage_Vector( float, d ); \
- cpPlugins_Instance_itkImage_Vector( double, d ); \
- cpPlugins_Instance_itkImage_Vector( unsigned char, d ); \
- cpPlugins_Instance_itkImage_Vector( unsigned short, d ); \
- cpPlugins_Instance_itkImage_Vector( unsigned int, d ); \
- cpPlugins_Instance_itkImage_Vector( unsigned long, d ); \
- cpPlugins_Instance_itkImage_CovVector( char, d ); \
- cpPlugins_Instance_itkImage_CovVector( short, d ); \
- cpPlugins_Instance_itkImage_CovVector( int, d ); \
- cpPlugins_Instance_itkImage_CovVector( long, d ); \
- cpPlugins_Instance_itkImage_CovVector( float, d ); \
- cpPlugins_Instance_itkImage_CovVector( double, d ); \
- cpPlugins_Instance_itkImage_CovVector( unsigned char, d ); \
- cpPlugins_Instance_itkImage_CovVector( unsigned short, d ); \
- cpPlugins_Instance_itkImage_CovVector( unsigned int, d ); \
- cpPlugins_Instance_itkImage_CovVector( unsigned long, d ); \
- cpPlugins_Instance_itkImage_SymTensor( char, d ); \
- cpPlugins_Instance_itkImage_SymTensor( short, d ); \
- cpPlugins_Instance_itkImage_SymTensor( int, d ); \
- cpPlugins_Instance_itkImage_SymTensor( long, d ); \
- cpPlugins_Instance_itkImage_SymTensor( float, d ); \
- cpPlugins_Instance_itkImage_SymTensor( double, d ); \
- cpPlugins_Instance_itkImage_SymTensor( unsigned char, d ); \
- cpPlugins_Instance_itkImage_SymTensor( unsigned short, d ); \
- cpPlugins_Instance_itkImage_SymTensor( unsigned int, d ); \
- cpPlugins_Instance_itkImage_SymTensor( unsigned long, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( char, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( short, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( int, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( long, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( float, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( double, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( unsigned char, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( unsigned short, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( unsigned int, d ); \
- cpPlugins_Instance_itkImage_DiffTensor( unsigned long, d );
+namespace itk
+{
+ template std::ostream& operator<<(
+ std::ostream& os, const ImageRegion< 1 >& obj
+ );
+ template class Point< double, 1 >;
+ template class Vector< double, 1 >;
+
+} // ecapseman
+
+cpPlugins_I_itk_Container( char );
+cpPlugins_I_itk_Container( short );
+cpPlugins_I_itk_Container( int );
+cpPlugins_I_itk_Container( long );
+cpPlugins_I_itk_Container( unsigned char );
+cpPlugins_I_itk_Container( unsigned short );
+cpPlugins_I_itk_Container( unsigned int );
+cpPlugins_I_itk_Container( unsigned long );
+cpPlugins_I_itk_Container( float );
+cpPlugins_I_itk_Container( double );
+cpPlugins_I_itk_Container( std::complex< float > );
+cpPlugins_I_itk_Container( std::complex< double > );
+cpPlugins_I_itk_Container( itk::RGBPixel< char > );
+cpPlugins_I_itk_Container( itk::RGBPixel< short > );
+cpPlugins_I_itk_Container( itk::RGBPixel< unsigned char > );
+cpPlugins_I_itk_Container( itk::RGBPixel< unsigned short > );
+cpPlugins_I_itk_Container( itk::RGBAPixel< char > );
+cpPlugins_I_itk_Container( itk::RGBAPixel< short > );
+cpPlugins_I_itk_Container( itk::RGBAPixel< unsigned char > );
+cpPlugins_I_itk_Container( itk::RGBAPixel< unsigned short > );
+cpPlugins_I_itk_Container( itk::Offset< 1 > );
+cpPlugins_I_itk_Container( itk::Offset< 2 > );
+cpPlugins_I_itk_Container( itk::Offset< 3 > );
+cpPlugins_I_itk_Container( itk::Offset< 4 > );
+cpPlugins_I_itk_array_Container( itk::Vector, float, 1 );
+cpPlugins_I_itk_array_Container( itk::Vector, double, 1 );
+cpPlugins_I_itk_array_Container( itk::Vector, float, 2 );
+cpPlugins_I_itk_array_Container( itk::Vector, double, 2 );
+cpPlugins_I_itk_array_Container( itk::Vector, float, 3 );
+cpPlugins_I_itk_array_Container( itk::Vector, double, 3 );
+cpPlugins_I_itk_array_Container( itk::Vector, float, 4 );
+cpPlugins_I_itk_array_Container( itk::Vector, double, 4 );
+cpPlugins_I_itk_array_Container( itk::Point, float, 1 );
+cpPlugins_I_itk_array_Container( itk::Point, double, 1 );
+cpPlugins_I_itk_array_Container( itk::Point, float, 2 );
+cpPlugins_I_itk_array_Container( itk::Point, double, 2 );
+cpPlugins_I_itk_array_Container( itk::Point, float, 3 );
+cpPlugins_I_itk_array_Container( itk::Point, double, 3 );
+cpPlugins_I_itk_array_Container( itk::Point, float, 4 );
+cpPlugins_I_itk_array_Container( itk::Point, double, 4 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, float, 1 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, double, 1 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, float, 2 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, double, 2 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, float, 3 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, double, 3 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, float, 4 );
+cpPlugins_I_itk_array_Container( itk::CovariantVector, double, 4 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, float, 1 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, double, 1 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, float, 2 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, double, 2 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, float, 3 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, double, 3 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, float, 4 );
+cpPlugins_I_itk_array_Container( itk::SymmetricSecondRankTensor, double, 4 );
+cpPlugins_I_itk_Container( itk::DiffusionTensor3D< float > );
+cpPlugins_I_itk_Container( itk::DiffusionTensor3D< double > );
+
+cpPlugins_I_itk( char, 1 );
+cpPlugins_I_itk( short, 1 );
+cpPlugins_I_itk( int, 1 );
+cpPlugins_I_itk( long, 1 );
+cpPlugins_I_itk( unsigned char, 1 );
+cpPlugins_I_itk( unsigned short, 1 );
+cpPlugins_I_itk( unsigned int, 1 );
+cpPlugins_I_itk( unsigned long, 1 );
+cpPlugins_I_itk( float, 1 );
+cpPlugins_I_itk( double, 1 );
+
+cpPlugins_I_itk( char, 2 );
+cpPlugins_I_itk( short, 2 );
+cpPlugins_I_itk( int, 2 );
+cpPlugins_I_itk( long, 2 );
+cpPlugins_I_itk( unsigned char, 2 );
+cpPlugins_I_itk( unsigned short, 2 );
+cpPlugins_I_itk( unsigned int, 2 );
+cpPlugins_I_itk( unsigned long, 2 );
+cpPlugins_I_itk( float, 2 );
+cpPlugins_I_itk( double, 2 );
+
+cpPlugins_I_itk( char, 3 );
+cpPlugins_I_itk( short, 3 );
+cpPlugins_I_itk( int, 3 );
+cpPlugins_I_itk( long, 3 );
+cpPlugins_I_itk( unsigned char, 3 );
+cpPlugins_I_itk( unsigned short, 3 );
+cpPlugins_I_itk( unsigned int, 3 );
+cpPlugins_I_itk( unsigned long, 3 );
+cpPlugins_I_itk( float, 3 );
+cpPlugins_I_itk( double, 3 );
+
+cpPlugins_I_itk( char, 4 );
+cpPlugins_I_itk( short, 4 );
+cpPlugins_I_itk( int, 4 );
+cpPlugins_I_itk( long, 4 );
+cpPlugins_I_itk( unsigned char, 4 );
+cpPlugins_I_itk( unsigned short, 4 );
+cpPlugins_I_itk( unsigned int, 4 );
+cpPlugins_I_itk( unsigned long, 4 );
+cpPlugins_I_itk( float, 4 );
+cpPlugins_I_itk( double, 4 );
+
+cpPlugins_I_itk( std::complex< float >, 1 );
+cpPlugins_I_itk( std::complex< double >, 1 );
+
+cpPlugins_I_itk( std::complex< float >, 2 );
+cpPlugins_I_itk( std::complex< double >, 2 );
+
+cpPlugins_I_itk( std::complex< float >, 3 );
+cpPlugins_I_itk( std::complex< double >, 3 );
+
+cpPlugins_I_itk( std::complex< float >, 4 );
+cpPlugins_I_itk( std::complex< double >, 4 );
+
+cpPlugins_I_itk( itk::RGBPixel< char >, 2 );
+cpPlugins_I_itk( itk::RGBPixel< short >, 2 );
+cpPlugins_I_itk( itk::RGBPixel< unsigned char >, 2 );
+cpPlugins_I_itk( itk::RGBPixel< unsigned short >, 2 );
+
+cpPlugins_I_itk( itk::RGBPixel< char >, 3 );
+cpPlugins_I_itk( itk::RGBPixel< short >, 3 );
+cpPlugins_I_itk( itk::RGBPixel< unsigned char >, 3 );
+cpPlugins_I_itk( itk::RGBPixel< unsigned short >, 3 );
+
+cpPlugins_I_itk( itk::RGBPixel< char >, 4 );
+cpPlugins_I_itk( itk::RGBPixel< short >, 4 );
+cpPlugins_I_itk( itk::RGBPixel< unsigned char >, 4 );
+cpPlugins_I_itk( itk::RGBPixel< unsigned short >, 4 );
+
+cpPlugins_I_itk( itk::RGBAPixel< char >, 2 );
+cpPlugins_I_itk( itk::RGBAPixel< short >, 2 );
+cpPlugins_I_itk( itk::RGBAPixel< unsigned char >, 2 );
+cpPlugins_I_itk( itk::RGBAPixel< unsigned short >, 2 );
+
+cpPlugins_I_itk( itk::RGBAPixel< char >, 3 );
+cpPlugins_I_itk( itk::RGBAPixel< short >, 3 );
+cpPlugins_I_itk( itk::RGBAPixel< unsigned char >, 3 );
+cpPlugins_I_itk( itk::RGBAPixel< unsigned short >, 3 );
+
+cpPlugins_I_itk( itk::RGBAPixel< char >, 4 );
+cpPlugins_I_itk( itk::RGBAPixel< short >, 4 );
+cpPlugins_I_itk( itk::RGBAPixel< unsigned char >, 4 );
+cpPlugins_I_itk( itk::RGBAPixel< unsigned short >, 4 );
+
+cpPlugins_I_itk( itk::Offset< 1 >, 1 );
+cpPlugins_I_itk( itk::Offset< 2 >, 2 );
+cpPlugins_I_itk( itk::Offset< 3 >, 3 );
+cpPlugins_I_itk( itk::Offset< 4 >, 4 );
+
+cpPlugins_I_itk_array( itk::Vector, float, 1, 1 );
+cpPlugins_I_itk_array( itk::Vector, double, 1, 1 );
+cpPlugins_I_itk_array( itk::Vector, float, 2, 2 );
+cpPlugins_I_itk_array( itk::Vector, double, 2, 2 );
+cpPlugins_I_itk_array( itk::Vector, float, 3, 3 );
+cpPlugins_I_itk_array( itk::Vector, double, 3, 3 );
+cpPlugins_I_itk_array( itk::Vector, float, 4, 4 );
+cpPlugins_I_itk_array( itk::Vector, double, 4, 4 );
+
+cpPlugins_I_itk_array( itk::Point, float, 1, 1 );
+cpPlugins_I_itk_array( itk::Point, double, 1, 1 );
+cpPlugins_I_itk_array( itk::Point, float, 2, 2 );
+cpPlugins_I_itk_array( itk::Point, double, 2, 2 );
+cpPlugins_I_itk_array( itk::Point, float, 3, 3 );
+cpPlugins_I_itk_array( itk::Point, double, 3, 3 );
+cpPlugins_I_itk_array( itk::Point, float, 4, 4 );
+cpPlugins_I_itk_array( itk::Point, double, 4, 4 );
+
+cpPlugins_I_itk_array( itk::CovariantVector, float, 1, 1 );
+cpPlugins_I_itk_array( itk::CovariantVector, double, 1, 1 );
+cpPlugins_I_itk_array( itk::CovariantVector, float, 2, 2 );
+cpPlugins_I_itk_array( itk::CovariantVector, double, 2, 2 );
+cpPlugins_I_itk_array( itk::CovariantVector, float, 3, 3 );
+cpPlugins_I_itk_array( itk::CovariantVector, double, 3, 3 );
+cpPlugins_I_itk_array( itk::CovariantVector, float, 4, 4 );
+cpPlugins_I_itk_array( itk::CovariantVector, double, 4, 4 );
+
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, float, 1, 1 );
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, double, 1, 1 );
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, float, 2, 2 );
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, double, 2, 2 );
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, float, 3, 3 );
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, double, 3, 3 );
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, float, 4, 4 );
+cpPlugins_I_itk_array( itk::SymmetricSecondRankTensor, double, 4, 4 );
+
+cpPlugins_I_itk( itk::DiffusionTensor3D< float >, 3 );
+cpPlugins_I_itk( itk::DiffusionTensor3D< double >, 3 );
+
+/* TODO
+ * itk::FixedArray
+ * itk::Matrix
+ */
// -------------------------------------------------------------------------
-cpPlugins_Instance_itkImage_DIM( 1 );
-cpPlugins_Instance_itkImage_DIM( 2 );
-cpPlugins_Instance_itkImage_DIM( 3 );
+// Possible itk types that could be connected to vtk
+
+cpPlugins_I_itk_vtk( char, 1 );
+cpPlugins_I_itk_vtk( short, 1 );
+cpPlugins_I_itk_vtk( int, 1 );
+cpPlugins_I_itk_vtk( long, 1 );
+cpPlugins_I_itk_vtk( unsigned char, 1 );
+cpPlugins_I_itk_vtk( unsigned short, 1 );
+cpPlugins_I_itk_vtk( unsigned int, 1 );
+cpPlugins_I_itk_vtk( unsigned long, 1 );
+cpPlugins_I_itk_vtk( float, 1 );
+cpPlugins_I_itk_vtk( double, 1 );
+
+cpPlugins_I_itk_vtk( char, 2 );
+cpPlugins_I_itk_vtk( short, 2 );
+cpPlugins_I_itk_vtk( int, 2 );
+cpPlugins_I_itk_vtk( long, 2 );
+cpPlugins_I_itk_vtk( unsigned char, 2 );
+cpPlugins_I_itk_vtk( unsigned short, 2 );
+cpPlugins_I_itk_vtk( unsigned int, 2 );
+cpPlugins_I_itk_vtk( unsigned long, 2 );
+cpPlugins_I_itk_vtk( float, 2 );
+cpPlugins_I_itk_vtk( double, 2 );
+
+cpPlugins_I_itk_vtk( char, 3 );
+cpPlugins_I_itk_vtk( short, 3 );
+cpPlugins_I_itk_vtk( int, 3 );
+cpPlugins_I_itk_vtk( long, 3 );
+cpPlugins_I_itk_vtk( unsigned char, 3 );
+cpPlugins_I_itk_vtk( unsigned short, 3 );
+cpPlugins_I_itk_vtk( unsigned int, 3 );
+cpPlugins_I_itk_vtk( unsigned long, 3 );
+cpPlugins_I_itk_vtk( float, 3 );
+cpPlugins_I_itk_vtk( double, 3 );
+
+cpPlugins_I_itk_vtk( itk::RGBPixel< char >, 2 );
+cpPlugins_I_itk_vtk( itk::RGBPixel< short >, 2 );
+cpPlugins_I_itk_vtk( itk::RGBPixel< unsigned char >, 2 );
+cpPlugins_I_itk_vtk( itk::RGBPixel< unsigned short >, 2 );
+
+cpPlugins_I_itk_vtk( itk::RGBPixel< char >, 3 );
+cpPlugins_I_itk_vtk( itk::RGBPixel< short >, 3 );
+cpPlugins_I_itk_vtk( itk::RGBPixel< unsigned char >, 3 );
+cpPlugins_I_itk_vtk( itk::RGBPixel< unsigned short >, 3 );
+
+cpPlugins_I_itk_vtk( itk::RGBAPixel< char >, 2 );
+cpPlugins_I_itk_vtk( itk::RGBAPixel< short >, 2 );
+cpPlugins_I_itk_vtk( itk::RGBAPixel< unsigned char >, 2 );
+cpPlugins_I_itk_vtk( itk::RGBAPixel< unsigned short >, 2 );
+
+cpPlugins_I_itk_vtk( itk::RGBAPixel< char >, 3 );
+cpPlugins_I_itk_vtk( itk::RGBAPixel< short >, 3 );
+cpPlugins_I_itk_vtk( itk::RGBAPixel< unsigned char >, 3 );
+cpPlugins_I_itk_vtk( itk::RGBAPixel< unsigned short >, 3 );
+
+cpPlugins_I_itk_vtk_array( itk::Vector, float, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::Vector, double, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::Vector, float, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::Vector, double, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::Vector, float, 3, 3 );
+cpPlugins_I_itk_vtk_array( itk::Vector, double, 3, 3 );
+
+cpPlugins_I_itk_vtk_array( itk::Point, float, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::Point, double, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::Point, float, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::Point, double, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::Point, float, 3, 3 );
+cpPlugins_I_itk_vtk_array( itk::Point, double, 3, 3 );
+
+cpPlugins_I_itk_vtk_array( itk::CovariantVector, float, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::CovariantVector, double, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::CovariantVector, float, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::CovariantVector, double, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::CovariantVector, float, 3, 3 );
+cpPlugins_I_itk_vtk_array( itk::CovariantVector, double, 3, 3 );
+
+cpPlugins_I_itk_vtk_array( itk::SymmetricSecondRankTensor, float, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::SymmetricSecondRankTensor, double, 1, 1 );
+cpPlugins_I_itk_vtk_array( itk::SymmetricSecondRankTensor, float, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::SymmetricSecondRankTensor, double, 2, 2 );
+cpPlugins_I_itk_vtk_array( itk::SymmetricSecondRankTensor, float, 3, 3 );
+cpPlugins_I_itk_vtk_array( itk::SymmetricSecondRankTensor, double, 3, 3 );
+
+cpPlugins_I_itk_vtk( itk::DiffusionTensor3D< float >, 3 );
+cpPlugins_I_itk_vtk( itk::DiffusionTensor3D< double >, 3 );
// eof - $RCSfile$
lst.push_back( TReal( std::atof( token.c_str( ) ) ) );
}
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasStringValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::String );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasBoolValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::Bool );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasIntValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::Int );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasUintValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::Uint );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasRealValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::Real );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasIndexValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::Index );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasPointValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::Point );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasStringListValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::StringList );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasBoolListValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::BoolList );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasIntListValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::IntList );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasUintListValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::UintList );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasRealListValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::RealList );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasIndexListValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::IndexList );
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Parameters::
+HasPointListValue( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt != this->m_Parameters.end( ) )
+ return( pIt->second.first == Self::PointList );
+ return( false );
+}
+
// eof - $RCSfile$
std::vector< P >& lst, const TString& name
) const;
+ bool HasStringValue( const TString& name ) const;
+ bool HasBoolValue( const TString& name ) const;
+ bool HasIntValue( const TString& name ) const;
+ bool HasUintValue( const TString& name ) const;
+ bool HasRealValue( const TString& name ) const;
+ bool HasIndexValue( const TString& name ) const;
+ bool HasPointValue( const TString& name ) const;
+ bool HasStringListValue( const TString& name ) const;
+ bool HasBoolListValue( const TString& name ) const;
+ bool HasIntListValue( const TString& name ) const;
+ bool HasUintListValue( const TString& name ) const;
+ bool HasRealListValue( const TString& name ) const;
+ bool HasIndexListValue( const TString& name ) const;
+ bool HasPointListValue( const TString& name ) const;
protected:
TParameters m_Parameters;
#include <cpPlugins/Interface/DataObject.h>
#include <cpPlugins/Interface/Parameters.h>
+#include <cpPlugins/Interface/Image.h>
+
#define ITK_MANUAL_INSTANTIATION
#include <itkProcessObject.h>
ProcessObject( );
virtual ~ProcessObject( );
- /* TODO
- virtual itk::DataObject* _GetInput( unsigned int idx );
- virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj );
- */
-
template< class O >
void _MakeOutput( unsigned int idx )
{
} // ecapseman
+// -------------------------------------------------------------------------
+#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$
MeshReader.h
MeshWriter.h
MarchingCubes.h
+ OtsuThresholdImageFilter.h
)
SET(
LIB_SOURCES_CXX
MeshReader.cxx
MeshWriter.cxx
MarchingCubes.cxx
+ OtsuThresholdImageFilter.cxx
)
## =====================
#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/PolyDataReader.h>
#include <cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h>
#include <cpPlugins/Plugins/RGBImageToYPbPrChannelsFilter.h>
*/
host.add( new MeshReaderProvider( ) );
host.add( new MeshWriterProvider( ) );
host.add( new MarchingCubesProvider( ) );
-/*
- host.add( new ImageSeriesReaderProvider( ) );
- host.add( new MeshReaderProvider( ) );
- host.add( new PolyDataReaderProvider( ) );
- host.add( new RGBImageToHSVChannelsFilterProvider( ) );
- host.add( new RGBImageToYPbPrChannelsFilterProvider( ) );
-*/
+ host.add( new OtsuThresholdImageFilterProvider( ) );
+
+ /*
+ host.add( new ImageSeriesReaderProvider( ) );
+ host.add( new MeshReaderProvider( ) );
+ host.add( new PolyDataReaderProvider( ) );
+ host.add( new RGBImageToHSVChannelsFilterProvider( ) );
+ host.add( new RGBImageToYPbPrChannelsFilterProvider( ) );
+ */
return( true );
}
#include <cpPlugins/Plugins/ImageReader.h>
#include <cpPlugins/Interface/Image.h>
+#include <complex>
#include <set>
-#undef ITK_MANUAL_INSTANTIATION
+#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 <itkImageFileReader.h>
#include <itkImageSeriesReader.h>
case 1: r = this->_GD0< 1 >( io, names ); break;
case 2: r = this->_GD0< 2 >( io, names ); break;
case 3: r = this->_GD0< 3 >( io, names ); break;
+ case 4: r = this->_GD0< 4 >( io, names ); break;
default:
- r = "ImageReader: Image dimension not supported.";
+ r = "ImageReader: Single image dimension not supported.";
break;
} // hctiws
}
{
case 1: r = this->_GD0< 2 >( io, names ); break;
case 2: r = this->_GD0< 3 >( io, names ); break;
+ case 3: r = this->_GD0< 4 >( io, names ); break;
default:
- r = "ImageReader: Image dimension not supported.";
+ r = "ImageReader: Multiple images dimension not supported.";
break;
} // hctiws
std::string cpPlugins::Plugins::ImageReader::
_GD0( itk::ImageIOBase* io, const TStringList& names )
{
+ itk::ImageIOBase::IOComponentType ct = io->GetComponentType( );
+ itk::ImageIOBase::IOPixelType pt = io->GetPixelType( );
std::string r = "";
- switch( io->GetComponentType( ) )
+
+ if( pt == itk::ImageIOBase::SCALAR )
{
- case itk::ImageIOBase::UCHAR:
- r = this->_GD1< unsigned char, D >( io, names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_GD1< char, D >( io, names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_GD1< unsigned short, D >( io, names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_GD1< short, D >( io, names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_GD1< unsigned int, D >( io, names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_GD1< int, D >( io, names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_GD1< unsigned long, D >( io, names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_GD1< long, D >( io, names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_GD1< float, D >( io, names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_GD1< double, D >( io, names );
- break;
- default:
- r = "ImageReader: Atomic pixel type not supported.";
- break;
- } // hctiws
- return( r );
-}
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_RealGD< unsigned char, D >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_RealGD< char, D >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_RealGD< unsigned short, D >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_RealGD< short, D >( names );
+ break;
+ case itk::ImageIOBase::UINT:
+ r = this->_RealGD< unsigned int, D >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_RealGD< int, D >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_RealGD< unsigned long, D >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_RealGD< long, D >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< float, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< double, D >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::RGB )
+ {
+ if( D == 2 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_RealGD< itk::RGBPixel< unsigned char >, 2 >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_RealGD< itk::RGBPixel< char >, 2 >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_RealGD< itk::RGBPixel< unsigned short >, 2 >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_RealGD< itk::RGBPixel< short >, 2 >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( D == 3 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_RealGD< itk::RGBPixel< unsigned char >, 3 >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_RealGD< itk::RGBPixel< char >, 3 >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_RealGD< itk::RGBPixel< unsigned short >, 3 >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_RealGD< itk::RGBPixel< short >, 3 >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( D == 4 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_RealGD< itk::RGBPixel< unsigned char >, 4 >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_RealGD< itk::RGBPixel< char >, 4 >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_RealGD< itk::RGBPixel< unsigned short >, 4 >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_RealGD< itk::RGBPixel< short >, 4 >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::ImageReader::
-_GD1( itk::ImageIOBase* io, const TStringList& names )
-{
- std::string r = "";
- switch( io->GetPixelType( ) )
+ } // fi
+ }
+ else if( pt == itk::ImageIOBase::RGBA )
+ {
+ if( D == 2 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_RealGD< itk::RGBAPixel< unsigned char >, 2 >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_RealGD< itk::RGBAPixel< char >, 2 >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_RealGD< itk::RGBAPixel< unsigned short >, 2 >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_RealGD< itk::RGBAPixel< short >, 2 >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( D == 3 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_RealGD< itk::RGBAPixel< unsigned char >, 3 >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_RealGD< itk::RGBAPixel< char >, 3 >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_RealGD< itk::RGBAPixel< unsigned short >, 3 >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_RealGD< itk::RGBAPixel< short >, 3 >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( D == 4 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_RealGD< itk::RGBAPixel< unsigned char >, 4 >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_RealGD< itk::RGBAPixel< char >, 4 >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_RealGD< itk::RGBAPixel< unsigned short >, 4 >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_RealGD< itk::RGBAPixel< short >, 4 >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
+
+ } // fi
+ }
+ else if( pt == itk::ImageIOBase::OFFSET )
+ {
+ switch( D )
+ {
+ case 1:
+ r = this->_RealGD< itk::Offset< 1 >, 1 >( names );
+ break;
+ case 2:
+ r = this->_RealGD< itk::Offset< 2 >, 2 >( names );
+ break;
+ case 3:
+ r = this->_RealGD< itk::Offset< 3 >, 3 >( names );
+ break;
+ case 4:
+ r = this->_RealGD< itk::Offset< 4 >, 4 >( names );
+ break;
+ default:
+ r = "ImageReader: Offset pixel dimension not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::VECTOR )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::Vector< float, D >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::Vector< double, D >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Vector type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::POINT )
{
- case itk::ImageIOBase::SCALAR:
- r = this->_GD2< P, D >( names );
- break;
- case itk::ImageIOBase::RGB:
- r = this->_GD2< itk::RGBPixel< P >, D >( names );
- break;
- case itk::ImageIOBase::RGBA:
- r = this->_GD2< itk::RGBAPixel< P >, D >( names );
- break;
- /* TODO
- case itk::ImageIOBase::OFFSET:
- r = this->_GD2< itk::Offset< P >, D >( names );
- break;
- case itk::ImageIOBase::VECTOR:
- r = this->_GD2< P, D >( names );
- break;
- case itk::ImageIOBase::POINT:
- r = this->_GD2< P, D >( names );
- break;
- case itk::ImageIOBase::COVARIANTVECTOR:
- r = this->_GD2< P, D >( names );
- break;
- case itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR:
- r = this->_GD2< P, D >( names );
- break;
- case itk::ImageIOBase::DIFFUSIONTENSOR3D:
- r = this->_GD2< P, D >( names );
- break;
- */
- /* TODO
- case itk::ImageIOBase::COMPLEX:
- r = this->_GD2< std::complex< P >, D >( names );
- break;
- case itk::ImageIOBase::FIXEDARRAY:
- r = this->_GD2< P, D >( names );
- break;
- case itk::ImageIOBase::MATRIX:
- r = this->_GD2< P, D >( names );
- break;
- */
- default:
- r = "ImageReader: Pixel type not supported.";
- break;
- } // hctiws
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::Point< float, D >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::Point< double, D >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Point type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::COVARIANTVECTOR )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::CovariantVector< float, D >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::CovariantVector< double, D >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Vector type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r =
+ this->_RealGD< itk::SymmetricSecondRankTensor< float, D >, D >(
+ names
+ );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r =
+ this->_RealGD< itk::SymmetricSecondRankTensor< double, D >, D >(
+ names
+ );
+ break;
+ default:
+ r = "ImageReader: Vector type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D )
+ {
+ if( D == 3 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::DiffusionTensor3D< float >, 3 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::DiffusionTensor3D< double >, 3 >( names );
+ break;
+ default:
+ r = "ImageReader: Diffusion tensor type not supported.";
+ break;
+ } // hctiws
+ }
+ else
+ r = "ImageReader: Diffusion tensor dimension not supported.";
+ }
+ else if( pt == itk::ImageIOBase::COMPLEX )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< std::complex< float >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< std::complex< double >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Complex type not supported.";
+ break;
+ } // hctiws
+ }
+ else
+ r = "ImageReader: Image pixel type not yet supported.";
+ /* TODO
+ itk::ImageIOBase::FIXEDARRAY
+ itk::ImageIOBase::MATRIX
+ */
+
return( r );
}
// -------------------------------------------------------------------------
template< class P, unsigned int D >
std::string cpPlugins::Plugins::ImageReader::
-_GD2( const TStringList& names )
+_RealGD( const TStringList& names )
{
typedef itk::Image< P, D > _I;
std::string _GD0( itk::ImageIOBase* io, const TStringList& names );
template< class P, unsigned int D >
- std::string _GD1( itk::ImageIOBase* io, const TStringList& names );
-
- template< class P, unsigned int D >
- std::string _GD2( const TStringList& names );
+ std::string _RealGD( const TStringList& names );
private:
// Purposely not implemented
#include <cpPlugins/Plugins/ImageWriter.h>
-#undef ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-#include <itkImageFileWriter.h>
+#include <complex>
-// -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_Dimension( r, d, i, f ) \
- if( dynamic_cast< itk::ImageBase< d >* >( i ) != NULL ) \
- r = this->f< d >( i )
+#define ITK_MANUAL_INSTANTIATION
+#include <itkImage.h>
-// -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_Pixel( r, p, d, i, f ) \
- if( dynamic_cast< itk::Image< p, d >* >( i ) != NULL ) \
- r = this->f< p, d >( i )
+#include <itkCovariantVector.h>
+#include <itkDiffusionTensor3D.h>
+#include <itkPoint.h>
+#include <itkRGBPixel.h>
+#include <itkRGBAPixel.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkVector.h>
-// -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_RGB( r, p, d, i, f ) \
- if( \
- dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( i ) != NULL \
- ) \
- r = this->f< itk::RGBPixel< p >, d >( i )
+#undef ITK_MANUAL_INSTANTIATION
+#include <itkImageFileWriter.h>
// -------------------------------------------------------------------------
cpPlugins::Plugins::ImageWriter::
_GenerateData( )
{
itk::DataObject* i = this->m_Inputs[ 0 ]->GetITKDataObject( );
-
- std::string r = "ImageWriter: Image dimension not supported.";
- cpPlugins_ImageWriter_Dimension ( r, 1, i, _GD0 );
- else cpPlugins_ImageWriter_Dimension( r, 2, i, _GD0 );
- else cpPlugins_ImageWriter_Dimension( r, 3, i, _GD0 );
- return( r );
+ return( this->_DemangleImageDimension( i ) );
}
// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::ImageWriter::
-_GD0( itk::DataObject* i )
+namespace cpPlugins
{
- std::string r = "ImageWriter: 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 );
+ namespace Plugins
+ {
+ cpPlugins_Image_Demangle_Methods_Code( ImageWriter, _RealGD );
+ }
}
// -------------------------------------------------------------------------
-template< class P, unsigned int D >
+template< class I >
std::string cpPlugins::Plugins::ImageWriter::
-_GD1( itk::DataObject* i )
+_RealGD( itk::DataObject* image )
{
- typedef itk::Image< P, D > _I;
- typedef itk::ImageFileWriter< _I > _W;
+ typedef itk::ImageFileWriter< I > _W;
// Get filename
using namespace cpPlugins::Interface;
} // fi
writer->SetFileName( fname );
- writer->SetInput( dynamic_cast< _I* >( i ) );
+ writer->SetInput( dynamic_cast< I* >( image ) );
try
{
writer->Update( );
virtual std::string _GenerateData( );
- template< unsigned int D >
- std::string _GD0( itk::DataObject* i );
+ cpPlugins_Image_Demangle_Methods( ImageWriter );
- template< class P, unsigned int D >
- std::string _GD1( itk::DataObject* i );
+ template< class I >
+ std::string _RealGD( itk::DataObject* image );
private:
// Purposely not implemented
--- /dev/null
+#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>
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::OtsuThresholdImageFilter::
+OtsuThresholdImageFilter( )
+ : Superclass( )
+{
+ this->m_ClassName = "cpPlugins::OtsuThresholdImageFilter";
+ this->m_ClassCategory = "ImageToImageFilter";
+ this->SetNumberOfInputs( 1 );
+ this->SetNumberOfOutputs( 1 );
+ this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+
+ using namespace cpPlugins::Interface;
+ this->m_DefaultParameters.Configure( Parameters::Uint, "NumberOfHistogramBins" );
+ this->m_DefaultParameters.Configure( Parameters::Real, "InsideValue" );
+ this->m_DefaultParameters.Configure( Parameters::Real, "OutsideValue" );
+ this->m_Parameters = this->m_DefaultParameters;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::OtsuThresholdImageFilter::
+~OtsuThresholdImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
+_GenerateData( )
+{
+ itk::DataObject* i = this->m_Inputs[ 0 ]->GetITKDataObject( );
+ return( this->_DemangleImageDimension( i ) );
+}
+
+// -------------------------------------------------------------------------
+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 )
+{
+ if( this->m_Parameters.HasStringValue( "OutputType" ) )
+ {
+ std::string output_type = this->m_Parameters.GetValueAsString( "OutputType" );
+ std::string r = "";
+ if( output_type == "char" )
+ r = this->_RealGD< I, itk::Image< char, I::ImageDimension > >( image );
+ else if( output_type == "uchar" )
+ r = this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >( image );
+ else if( output_type == "short" )
+ r = this->_RealGD< I, itk::Image< short, I::ImageDimension > >( image );
+ else if( output_type == "ushort" )
+ r = this->_RealGD< I, itk::Image< unsigned short, I::ImageDimension > >( image );
+ else if( output_type == "int" )
+ r = this->_RealGD< I, itk::Image< int, I::ImageDimension > >( image );
+ else if( output_type == "uint" )
+ r = this->_RealGD< I, itk::Image< unsigned int, I::ImageDimension > >( image );
+ else if( output_type == "long" )
+ r = this->_RealGD< I, itk::Image< long, I::ImageDimension > >( image );
+ else if( output_type == "ulong" )
+ r = this->_RealGD< I, itk::Image< unsigned long, I::ImageDimension > >( image );
+ else if( output_type == "float" )
+ r = this->_RealGD< I, itk::Image< float, I::ImageDimension > >( image );
+ else if( output_type == "double" )
+ r = this->_RealGD< I, itk::Image< double, I::ImageDimension > >( image );
+ else
+ r = "OtsuThresholdImageFilter: Invalid output type.";
+ }
+ else
+ return( this->_RealGD< I, I >( 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
+#ifndef __CPPLUGINS__PLUGINS__OTSUTHRESHOLDIMAGEFILTER__H__
+#define __CPPLUGINS__PLUGINS__OTSUTHRESHOLDIMAGEFILTER__H__
+
+#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/Interface/ImageToImageFilter.h>
+
+namespace cpPlugins
+{
+ namespace Plugins
+ {
+ /**
+ */
+ class cpPlugins_EXPORT OtsuThresholdImageFilter
+ : public cpPlugins::Interface::ImageToImageFilter
+ {
+ public:
+ typedef OtsuThresholdImageFilter Self;
+ typedef cpPlugins::Interface::ImageToImageFilter Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( OtsuThresholdImageFilter, cpPluginsInterfaceImageToImageFilter );
+
+ protected:
+ OtsuThresholdImageFilter( );
+ virtual ~OtsuThresholdImageFilter( );
+
+ virtual std::string _GenerateData( );
+
+ cpPlugins_Image_Demangle_Methods( OtsuThresholdImageFilter );
+
+ template< class I >
+ std::string _DemangleInput( itk::DataObject* image );
+
+ template< class I, class O >
+ std::string _RealGD( itk::DataObject* image );
+
+ private:
+ // Purposely not implemented
+ OtsuThresholdImageFilter( const Self& );
+ Self& operator=( const Self& );
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( OtsuThresholdImageFilter );
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__PLUGINS__OTSUTHRESHOLDIMAGEFILTER__H__
+
+// eof - $RCSfile$
+++ /dev/null
-#include <cpPlugins/Plugins/PolyDataReader.h>
-#include <cpPlugins/Interface/PolyData.h>
-
-#include <vtkErrorCode.h>
-#include <vtkPolyDataReader.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::PolyDataReader::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::PolyDataReader" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::PolyDataReader::
-PolyDataReader( )
- : Superclass( )
-{
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::PolyData >( 0 );
-
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
- this->m_Parameters = this->m_DefaultParameters;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::PolyDataReader::
-~PolyDataReader( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::PolyDataReader::
-_GenerateData( )
-{
- // Get filename
- using namespace cpPlugins::Interface;
- Parameters::TString fname =
- this->m_Parameters.GetValueAsString( "FileName" );
-
- // Create a possible reader
- vtkPolyDataReader* reader =
- dynamic_cast< vtkPolyDataReader* >( this->m_Reader.GetPointer( ) );
- if( reader == NULL )
- {
- this->m_Reader = vtkSmartPointer< vtkPolyDataReader >::New( );
- reader =
- dynamic_cast< vtkPolyDataReader* >( this->m_Reader.GetPointer( ) );
-
- } // fi
- reader->SetFileName( fname.c_str( ) );
- reader->Update( );
- unsigned long error = reader->GetErrorCode( );
- if( error == vtkErrorCode::NoError )
- {
- if( this->m_Outputs[ 0 ].IsNotNull( ) )
- {
- cpPlugins::Interface::PolyData* pdata =
- dynamic_cast< cpPlugins::Interface::PolyData* >(
- this->m_Outputs[ 0 ].GetPointer( )
- );
- if( pdata != NULL )
- pdata->SetRealDataObject( reader->GetOutput( ) );
-
- } // fi
- return( "" );
- }
- else
- return( vtkErrorCode::GetStringFromErrorCode( error ) );
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__PLUGINS__POLYDATAREADER__H__
-#define __CPPLUGINS__PLUGINS__POLYDATAREADER__H__
-
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/PolyDataSource.h>
-
-#include <vtkAlgorithm.h>
-#include <vtkSmartPointer.h>
-
-namespace cpPlugins
-{
- namespace Plugins
- {
- /**
- */
- class cpPlugins_EXPORT PolyDataReader
- : public cpPlugins::Interface::PolyDataSource
- {
- public:
- typedef PolyDataReader Self;
- typedef cpPlugins::Interface::PolyDataSource Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( PolyDataReader, cpPluginsInterfacePolyDataSource );
-
- public:
- virtual std::string GetClassName( ) const;
-
- protected:
- PolyDataReader( );
- virtual ~PolyDataReader( );
-
- virtual std::string _GenerateData( );
-
- private:
- // Purposely not implemented
- PolyDataReader( const Self& );
- Self& operator=( const Self& );
-
- protected:
- vtkSmartPointer< vtkAlgorithm > m_Reader;
- };
-
- // ---------------------------------------------------------------------
- CPPLUGINS_INHERIT_PROVIDER( PolyDataReader );
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__PLUGINS__POLYDATAREADER__H__
-
-// eof - $RCSfile$