     data.ApplyDepthThresholdFilter(thresholdBestCost);
 
     // Get data and transform its properties to atomic type
-    TCompute* h_depthMap = new TCompute[nbPixelOnDepthMap];
     vtkImageDataToTable(data.GetDepthMap(), h_depthMap);
-    TCompute* h_matrixK = new TCompute[Mat4x4];
-    vtkMatrixToTComputeTable(data.Get4MatrixK(), h_matrixK);
-    TCompute* h_matrixRT = new TCompute[Mat4x4];
-    vtkMatrixToTComputeTable(data.GetMatrixTR(), h_matrixRT);
+    vtkMatrixToTypeComputeTable(data.Get4MatrixK(), h_matrixK);
+    vtkMatrixToTypeComputeTable(data.GetMatrixTR(), h_matrixRT);
 
     // Wait that all threads have finished
     CudaErrorCheck(cudaDeviceSynchronize());
 
-    CudaErrorCheck(cudaMemcpy(d_depthMap, h_depthMap, nbPixelOnDepthMap * sizeof(TCompute), cudaMemcpyHostToDevice));
-    CudaErrorCheck(cudaMemcpy(d_matrixK, h_matrixK, Mat4x4 * sizeof(TCompute), cudaMemcpyHostToDevice));
-    CudaErrorCheck(cudaMemcpy(d_matrixRT, h_matrixRT, Mat4x4 * sizeof(TCompute), cudaMemcpyHostToDevice));
-
+    CudaErrorCheck(cudaMemcpy(d_depthMap, h_depthMap, nbPixelOnDepthMap * sizeof(TypeCompute), cudaMemcpyHostToDevice));
+    CudaErrorCheck(cudaMemcpy(d_matrixK, h_matrixK, SizeMat4x4 * sizeof(TypeCompute), cudaMemcpyHostToDevice));
+    CudaErrorCheck(cudaMemcpy(d_matrixRT, h_matrixRT, SizeMat4x4 * sizeof(TypeCompute), cudaMemcpyHostToDevice));
 
     // run code into device
     depthMapKernel<TVolumetric> << < dimGrid, dimBlock >> >(d_depthMap, d_matrixK, d_matrixRT, d_outScalar);
-    // clean memory
-    delete(h_depthMap);
-    delete(h_matrixK);
-    delete(h_matrixRT);
+
     }
 
   // Transfer data from device to host

/* Compute the voxel Id on a 1D table according to its 3D coordinates
  coordinates : 3D coordinates
*/
__device__ int computeVoxelIDGrid(int coordinates[Point3D])
{
  int dimX = c_gridDims.x - 1;
  int dimY = c_gridDims.y - 1;


  // Compute the ID on depthmap values according to pixel position and depth map dimensions
  int depthMapId = computeVoxelIDDepth(pixel);
  TypeCompute depth = depths[depthMapId];
  if (depth == -1)
    {
    return;
    }
  int gridId = computeVoxelIDGrid(voxelIndex);  // Get the distance between voxel and camera
  TypeCompute realDepth = norm(voxelCenterCamera);
  TVolumetric newValue;
  rayPotential<TVolumetric>(realDepth, depth, newValue);
  // Update the value to the output
