    cudaError_t __err = cudaGetLastError();
    if (__err != cudaSuccess)
    {
-      printf("CUDA:ray_interpolated_projection:%s:%s\n",msg, cudaGetErrorString(__err));
+      printf("CUDA:ray_interpolated:%s:%s\n",msg, cudaGetErrorString(__err));
       cudaDeviceReset();
       return 1;
    }
    return 0;
 }
-
     
     
 // Declare the texture reference.
+    texture<float, cudaTextureType3D , cudaReadModeElementType> tex;
 
 #define MAXTREADS 1024
-#define PROJ_PER_BLOCK 9
-#define PIXEL_SIZE_BLOCK 9
 /*GEOMETRY DEFINITION
  *
  *                Detector plane, behind

#include <cuda_runtime_api.h>
#include <cuda.h>
#include "ray_interpolated_projection.hpp"
#include "errors.hpp"
#include <stdio.h>
#include <math.h>


 *
 *
 **/

template<bool sphericalrotation>
        __global__ void kernelPixelDetector( Geometry geo,
        float* detector,
        Point3D source ,
        Point3D deltaU,
        Point3D deltaV,
        Point3D uvOrigin,
        float DSO,
        float cropdist_init){
    
    unsigned long  y = blockIdx.y * blockDim.y + threadIdx.y;
    unsigned long  x = blockIdx.x * blockDim.x + threadIdx.x;
    unsigned long  idx =  x  * geo.nDetecV + y;
    
    if ((x>= geo.nDetecU) | (y>= geo.nDetecV))
        return;
    
    
    
    
    /////// Get coordinates XYZ of pixel UV
