1 #include <ITKImageInterpolators/BSplineInterpolateImageFunction.h>
2 #include <cpInstances/DataObjects/Image.h>
4 #include <itkBSplineInterpolateImageFunction.h>
6 // -------------------------------------------------------------------------
7 cpPluginsITKImageInterpolators::BSplineInterpolateImageFunction::
8 BSplineInterpolateImageFunction( )
11 this->m_Parameters.ConfigureAsUint( "SplineOrder", 3 );
12 this->m_Parameters.ConfigureAsBool( "UseImageDirection", true );
15 // -------------------------------------------------------------------------
16 cpPluginsITKImageInterpolators::BSplineInterpolateImageFunction::
17 ~BSplineInterpolateImageFunction( )
21 // -------------------------------------------------------------------------
22 void cpPluginsITKImageInterpolators::BSplineInterpolateImageFunction::
24 itk::LightObject* image, const std::string& precision_type
27 this->m_PrecisionType = precision_type;
28 cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( image, _GD0 )
29 this->_Error( "Invalid input image." );
32 // -------------------------------------------------------------------------
33 void cpPluginsITKImageInterpolators::BSplineInterpolateImageFunction::
38 // -------------------------------------------------------------------------
39 template< class _TImage >
40 void cpPluginsITKImageInterpolators::BSplineInterpolateImageFunction::
41 _GD0( _TImage* image )
43 if( this->m_PrecisionType == "float" )
44 this->_GD1< _TImage, float >( image );
45 else if( this->m_PrecisionType == "double" )
46 this->_GD1< _TImage, double >( image );
49 // -------------------------------------------------------------------------
50 template< class _TImage, class _TScalar >
51 void cpPluginsITKImageInterpolators::BSplineInterpolateImageFunction::
52 _GD1( _TImage* image )
54 typedef itk::BSplineInterpolateImageFunction< _TImage, _TScalar, _TScalar > _TFunction;
56 auto function = this->_CreateITK< _TFunction >( );
57 function->SetSplineOrder( this->m_Parameters.GetUint( "SplineOrder" ) );
58 function->SetUseImageDirection( this->m_Parameters.GetBool( "UseImageDirection" ) );
59 this->GetOutput( "Output" )->SetITK( function );