 
 // ----------------------------------------------------------------------------
 /* Compute the middle of a voxel according to constant global value and the origin of the voxel */
-__device__ void computeVoxelCenter(int voxelCoordinate[3], double output[3])
-{
-  output[0] = c_gridOrig.x + (voxelCoordinate[0] + 0.5) * c_gridSpacing.x;
-  output[1] = c_gridOrig.y + (voxelCoordinate[1] + 0.5) * c_gridSpacing.y;
-  output[2] = c_gridOrig.z + (voxelCoordinate[2] + 0.5) * c_gridSpacing.z;
+__device__ void computeVoxelCenter(int voxelCoordinate[Point3D], double output[Point3D])
+{
+  output[0] = c_gridOrig[0] + (voxelCoordinate[0] + 0.5) * c_gridSpacing[0];
+  output[1] = c_gridOrig[1] + (voxelCoordinate[1] + 0.5) * c_gridSpacing[1];
+  output[2] = c_gridOrig[2] +(voxelCoordinate[2] + 0.5) * c_gridSpacing[2];
 }
 
 

  // Create device data from host value
  double *d_depthMap, *d_matrixK, *d_matrixRT;
  CudaErrorCheck(cudaMalloc((void**)&d_depthMap, nbPixelOnDepthMap * sizeof(double)));
  CudaErrorCheck(cudaMalloc((void**)&d_matrixK, matrix4Size * sizeof(double)));
  CudaErrorCheck(cudaMalloc((void**)&d_matrixRT, matrix4Size * sizeof(double)));
  
  for (int i = 0; i < h_dataList.size(); i++)
    {

  matrixTR : matrixTR
  output : double table that will be filled at the end of function
*/
__global__ void depthMapKernel(double* depths, double matrixK[Mat4x4], double matrixTR[Mat4x4],
  double* output)
{
  // Get voxel coordinate according to thread id
  int i = threadIdx.x;
  int j = blockIdx.y;
  int k = blockIdx.z;
  int voxelCoordinate[Point3D] = { i, j, k };

  // Get the center of the voxel
  double voxelCenterTemp[Point3D];
  computeVoxelCenter(voxelCoordinate, voxelCenterTemp);

  // Transform voxel from grid to real coord
  double voxelCenter[Point3D];
  transformFrom4Matrix(c_gridMatrix, voxelCenterTemp, voxelCenter);

  // Transform voxel center from real coord to camera coords
  double voxelCenterCamera[Point3D];
  transformFrom4Matrix(matrixTR, voxelCenter, voxelCenterCamera);

  // Transform voxel center from camera coords to depth map homogeneous coords
  double voxelCenterHomogen[Point3D];
  transformFrom4Matrix(matrixK, voxelCenterCamera, voxelCenterHomogen);

  // Get voxel center on depth map coord
