]> Creatis software - cpPlugins.git/blobdiff - plugins/ITKImageInterpolators/LinearInterpolateImageFunction.cxx
yet another refactoring
[cpPlugins.git] / plugins / ITKImageInterpolators / LinearInterpolateImageFunction.cxx
diff --git a/plugins/ITKImageInterpolators/LinearInterpolateImageFunction.cxx b/plugins/ITKImageInterpolators/LinearInterpolateImageFunction.cxx
new file mode 100644 (file)
index 0000000..5317a29
--- /dev/null
@@ -0,0 +1,58 @@
+#include <ITKImageInterpolators/LinearInterpolateImageFunction.h>
+#include <cpInstances/DataObjects/Image.h>
+#include <itkImage.h>
+#include <itkLinearInterpolateImageFunction.h>
+
+// -------------------------------------------------------------------------
+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$