// get a pixel copy function that is appropriate for the data type
static void vtkGetSetPixelsFunc(mitkVtkImageOverwrite *self,
                         void (**setpixels)(void *&out, const void *in,
                                            int numscalars, int n))
{
  int dataType = self->GetOutput()->GetScalarType();
  int numscalars = self->GetOutput()->GetNumberOfScalarComponents();

  switch (numscalars)
    {
    case 1:
      switch (dataType)
        {
        vtkTemplateAliasMacro(
          *setpixels = &vtkImageResliceSetPixels<VTK_TT>::Set1
          );
        default:
          setpixels = nullptr;
        }
    default:
      switch (dataType)
        {
        vtkTemplateAliasMacro(
          *setpixels = &vtkImageResliceSetPixels<VTK_TT>::Set
          );
        default:
          setpixels = nullptr;
        }
    }
}
static void vtkGetResliceInterpFunc(mitkVtkImageOverwrite *self,
                             int (**interpolate)(void *&outPtr,
                                                 const void *inPtr,
                                                 const int inExt[6],
                                                 const vtkIdType inInc[3],
                                                 int numscalars,
                                                 const F point[3],
                                                 int mode,
                                                 const void *background,
                                                 mitkVtkImageOverwrite *self))
{
  int dataType = self->GetOutput()->GetScalarType();

  switch (dataType)
  {
    vtkTemplateAliasMacro(*((int (**)(VTK_TT *&outPtr, const VTK_TT *inPtr,
      const int inExt[6],
      const vtkIdType inInc[3],
      int numscalars, const F point[3],
      int mode,
      const VTK_TT *background,
      mitkVtkImageOverwrite *self))interpolate) = \
      &vtkNearestNeighborInterpolation);
  default:
    interpolate = nullptr;
  }
}
static void vtkFreeBackgroundPixel(mitkVtkImageOverwrite *self, void **rval)
{
  switch (self->GetOutput()->GetScalarType())
    {
    vtkTemplateAliasMacro(delete [] *((VTK_TT **)rval));
    }

  *rval = nullptr;
}
static void vtkAllocBackgroundPixel(mitkVtkImageOverwrite *self, void **rval,
                             int numComponents)
{
  switch (self->GetOutput()->GetScalarType())
    {
    vtkTemplateAliasMacro(vtkAllocBackgroundPixelT(self, (VTK_TT **)rval,
                                              numComponents));
    }
}
int
DetermineSubdivisions(vtkDataArray *arr, vtkIdType id[4], int max, 
                      double threshold)
{
    int numSubdivs = 0;
    switch(arr->GetDataType())
    {
        vtkTemplateAliasMacro(numSubdivs = DetermineSubdivisions(id, max, threshold,
            static_cast<VTK_TT *>(arr->GetVoidPointer(0))));
    }
    return numSubdivs;
}