X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FITKImageGenericFilters_1%2FCastImageFilter.cxx;fp=plugins%2FITKImageGenericFilters_1%2FCastImageFilter.cxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=a7cf31b2aea4fb09f0b37a14cf408fdfad726714;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/plugins/ITKImageGenericFilters_1/CastImageFilter.cxx b/plugins/ITKImageGenericFilters_1/CastImageFilter.cxx deleted file mode 100644 index a7cf31b..0000000 --- a/plugins/ITKImageGenericFilters_1/CastImageFilter.cxx +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include - -#include - -// ------------------------------------------------------------------------- -cpPluginsITKImageGenericFilters_1::CastImageFilter:: -CastImageFilter( ) - : Superclass( ) -{ - this->_ConfigureInput< cpInstances::DataObjects::Image >( "Input", true, false ); - this->_ConfigureOutput< cpInstances::DataObjects::Image >( "Output" ); - this->m_Parameters.ConfigureAsScalarTypesChoices( "OutputPixelType" ); -} - -// ------------------------------------------------------------------------- -cpPluginsITKImageGenericFilters_1::CastImageFilter:: -~CastImageFilter( ) -{ -} - -// ------------------------------------------------------------------------- -void cpPluginsITKImageGenericFilters_1::CastImageFilter:: -_GenerateData( ) -{ - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) - this->_Error( "Invalid input image." ); -} - -// ------------------------------------------------------------------------- -template< class _TInput > -void cpPluginsITKImageGenericFilters_1::CastImageFilter:: -_GD0( _TInput* input ) -{ - std::string o_type = - this->m_Parameters.GetSelectedChoice( "OutputPixelType" ); - if( o_type == "char" ) this->_GD1< _TInput, char >( input ); - else if( o_type == "short" ) this->_GD1< _TInput, short >( input ); - else if( o_type == "int" ) this->_GD1< _TInput, int >( input ); - else if( o_type == "long" ) this->_GD1< _TInput, long >( input ); - else if( o_type == "uchar" ) this->_GD1< _TInput, unsigned char >( input ); - else if( o_type == "ushort" ) this->_GD1< _TInput, unsigned short >( input ); - else if( o_type == "uint" ) this->_GD1< _TInput, unsigned int >( input ); - else if( o_type == "ulong" ) this->_GD1< _TInput, unsigned long >( input ); - else if( o_type == "float" ) this->_GD1< _TInput, float >( input ); - else if( o_type == "double" ) this->_GD1< _TInput, double >( input ); -} - -// ------------------------------------------------------------------------- -template< class _TInput, class _TOutputPixel > -void cpPluginsITKImageGenericFilters_1::CastImageFilter:: -_GD1( _TInput* input ) -{ - typedef itk::Image< _TOutputPixel, _TInput::ImageDimension > _TOutput; - typedef itk::CastImageFilter< _TInput, _TOutput > _TFilter; - - auto filter = this->_CreateITK< _TFilter >( ); - filter->SetInput( input ); - filter->Update( ); - this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); -} - -// eof - $RCSfile$