#include #include #include // ------------------------------------------------------------------------- cpPluginsImageFilters::ResampleImageFilter:: ResampleImageFilter( ) : Superclass( ) { this->_AddInput( "Input" ); this->_AddOutput< cpPlugins::Image >( "Output" ); std::vector< std::string > choices; choices.push_back( "float" ); choices.push_back( "double" ); this->m_Parameters.ConfigureAsChoices( "ScalarType", choices ); this->m_Parameters.SetSelectedChoice( "ScalarType", "float" ); } // ------------------------------------------------------------------------- cpPluginsImageFilters::ResampleImageFilter:: ~ResampleImageFilter( ) { } // ------------------------------------------------------------------------- void cpPluginsImageFilters::ResampleImageFilter:: _GenerateData( ) { auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > void cpPluginsImageFilters::ResampleImageFilter:: _GD0( _TImage* image ) { if( image != NULL ) { auto choice = this->m_Parameters.GetSelectedChoice( "OutputResolution" ); if( choice == "float" ) this->_GD1< _TImage, float >( image ); else if( choice == "double" ) this->_GD1< _TImage, double >( image ); else this->_Error( "No valid scalar type." ); } else this->_Error( "No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage, class _TScalar > void cpPluginsImageFilters::ResampleImageFilter:: _GD1( _TImage* image ) { typedef itk::ResampleImageFilter< _TImage, _TImage, _TScalar, _TScalar > _TFilter; if( image == NULL ) this->_Error( "No valid input image." ); // Configure filter _TFilter* filter = this->_CreateITK< _TFilter >( ); filter->SetInput( image ); // Connect output this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$