 
 
 // ----------------------------------------------------------------------------
+/* Apply a 4x4 matrix to a 3D points */
 __device__ void transformFrom4Matrix(double matrix[16], double point[3], double output[3])
 {
   output[0] = matrix[0] * point[0] + matrix[1] * point[1] + matrix[2] * point[2] + matrix[3];



// ----------------------------------------------------------------------------
__host__ void vtkDoubleArrayToTable(vtkDoubleArray* doubleArray, double* output)
{
  for (int i = 0; i < doubleArray->GetNumberOfTuples(); i++)
  {
    output[i] = doubleArray->GetTuple1(i);
  }
}


// ----------------------------------------------------------------------------
__host__ void vtkImageDataToTable(vtkImageData* image, double* output)
{
  vtkDoubleArray* depths = vtkDoubleArray::SafeDownCast(image->GetPointData()->GetArray("Depths"));

  return currentVal + shift;
}


// ----------------------------------------------------------------------------
/* Compute the voxel Id on a 1D table according to its 3D coordinates
  coordinates : 3D coordinates
  type : Define if we want the Id from the grid matrix ( = 1) or the depth map ( = 0 )
         because we don't use  the same dimensions
  TOBEIMPROVED
*/
__device__ int computeVoxelID(int coordinates[3], int type)
{
  int dimX = c_gridDims.x - 1;
