       //printf("not hit: outval: %f %f %f %f %d %d %f %f %f \n",outval.x, outval.y, outval.z, outval.w, x, y, seedval.x, seedval.y, seedval.z);
     }
     idptr[i] = int(seedval.x);
-    idxptr[i] = int(seedval.y) + int(seedval.z)*image_size;
+    idxptr[i] = int(seedval.y) + int(seedval.z)*imageSize;
   }
 
   thrustptr[index] = outindex;


surface<void, cudaSurfaceType2D> surfaceWrite;

__global__ void  /*__launch_bounds__(16)*/ jfa_seed_kernel(int image_size, int num_labels, float4* seedbuffer, int* thrustptr, int *idptr, int*idxptr)
{
  int x = blockIdx.x*blockDim.x + threadIdx.x;
  int y = blockIdx.y*blockDim.y + threadIdx.y;
  int index = y*image_size + x;
  /*if (x< image_size && y < image_size)
  {
    surf2Dwrite<float4>(make_float4(0.0f, 0.0f, 0.0f, 1.0f), surfaceWrite, x*sizeof(float4), y);



#define MAX_LABELS 256

int cudaJFAApolloniusThrust(cudaGraphicsResource_t &computeImage, int imageSize, int numLabels,
                            thrust::device_vector<float4> &seedbuffer,
                            thrust::device_vector<float> &distance_vector,
                            thrust::device_vector<int> &compute_vector,
