X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FITKImageInterpolators%2FLinearInterpolateImageFunction.cxx;fp=plugins%2FITKImageInterpolators%2FLinearInterpolateImageFunction.cxx;h=55a3c3786bc45281bce6dd6c1c78fd53d64e1822;hb=80ac2c55630c2a345a2102f0be86843147a398cc;hp=0000000000000000000000000000000000000000;hpb=e393f405f8f1864f8b019940fe1303be78002f64;p=cpPlugins.git diff --git a/plugins/ITKImageInterpolators/LinearInterpolateImageFunction.cxx b/plugins/ITKImageInterpolators/LinearInterpolateImageFunction.cxx new file mode 100644 index 0000000..55a3c37 --- /dev/null +++ b/plugins/ITKImageInterpolators/LinearInterpolateImageFunction.cxx @@ -0,0 +1,58 @@ +#include +#include +#include +#include + +// ------------------------------------------------------------------------- +cpPluginsITKImageInterpolators::LinearInterpolateImageFunction:: +LinearInterpolateImageFunction( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPluginsITKImageInterpolators::LinearInterpolateImageFunction:: +~LinearInterpolateImageFunction( ) +{ +} + +// ------------------------------------------------------------------------- +void cpPluginsITKImageInterpolators::LinearInterpolateImageFunction:: +CreateInterpolator( + itk::LightObject* image, const std::string& precision_type + ) +{ + this->m_PrecisionType = precision_type; + cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( image, _GD0 ) + this->_Error( "Invalid input image." ); +} + +// ------------------------------------------------------------------------- +void cpPluginsITKImageInterpolators::LinearInterpolateImageFunction:: +_GenerateData( ) +{ +} + +// ------------------------------------------------------------------------- +template< class _TImage > +void cpPluginsITKImageInterpolators::LinearInterpolateImageFunction:: +_GD0( _TImage* image ) +{ + if( this->m_PrecisionType == "float" ) + this->_GD1< _TImage, float >( image ); + else if( this->m_PrecisionType == "double" ) + this->_GD1< _TImage, double >( image ); +} + +// ------------------------------------------------------------------------- +template< class _TImage, class _TScalar > +void cpPluginsITKImageInterpolators::LinearInterpolateImageFunction:: +_GD1( _TImage* image ) +{ + typedef itk::LinearInterpolateImageFunction< _TImage, _TScalar > _TFunction; + + auto function = this->_CreateITK< _TFunction >( ); + this->GetOutput( "Output" )->SetITK( function ); +} + +// eof - $RCSfile$