static void Paint(mitk::Image::Pointer image, itk::Index<3> index, unsigned int timeStep)
{
  // As soon as the ImagePixelWriteAccessor object goes out of scope at the
  // end of this function, the image will be unlocked again (RAII).
  mitk::ImagePixelWriteAccessor<T> writeAccessor(image, image->GetVolumeData(timeStep));
  writeAccessor.SetPixelByIndex(index, std::numeric_limits<T>::min());

  // Don't forget to update the modified time stamp of the image. Otherwise,
  // everything downstream wouldn't recognize that the image changed,
  // including the rendering system.
  image->Modified();
}
void ReadPixel(mitk::PixelType, mitk::Image::Pointer image, itk::Index<3> indexPoint, double& value)
{
  if (image->GetDimension() == 2)
  {
    mitk::ImagePixelReadAccessor<PixelType,2> readAccess(image, image->GetSliceData(0));
    itk::Index<2> idx;
    idx[0] = indexPoint[0];
    idx[1] = indexPoint[1];
    value = readAccess.GetPixelByIndex(idx);
  }
  else if (image->GetDimension() == 3)
  {
    mitk::ImagePixelReadAccessor<PixelType,3> readAccess(image, image->GetVolumeData(0));
    itk::Index<3> idx;
    idx[0] = indexPoint[0];
    idx[1] = indexPoint[1];
    idx[2] = indexPoint[2];
    value = readAccess.GetPixelByIndex(idx);
  }
  else
  {
    //unhandled
  }
}