     //if (seedval.x > 0.0) outval = make_float4(0.0f, 1.0f, 0.0f, 1.0f);
     if (int(seedval.x) > 0 && x == int(seedval.y) && y == int(seedval.z) && (x!=0 || y!=0))
     {
-      outval = make_float4(seedval.x/(num_labels+1), int(seedval.y)/float(image_size), int(seedval.z)/float(image_size), 1.0f);
+      outval = make_float4(seedval.x/(num_labels+1), int(seedval.y)/float(imageSize), int(seedval.z)/float(imageSize), 1.0f);
 
       // index for thrust computation =
-      outindex = x + y*image_size;
+      outindex = x + y*imageSize;
       //printf("hit: outval: %f %f %f %f %d %d %f %f %f nl: %d oi: %d\n",outval.x, outval.y, outval.z, outval.w, x, y, seedval.x, seedval.y, seedval.z,num_labels, outindex);
       //printf("hit: outval: %f %f %f %f %d %d\n",outval.x, outval.y, outval.z, outval.w, x, y);
       //break;

  compute_temp_vector = compute_vector;
  apollonius_cuda<<<dimGrid, dimBlock>>>(thrust::raw_pointer_cast(compute_vector.data()),
                                         thrust::raw_pointer_cast(distance_vector.data()),
                                         1, image_size, image_size);

  for(int k = (image_size / 2); k > 0; k /= 2)
  {

    apollonius_cuda<<<dimGrid,dimBlock>>>(thrust::raw_pointer_cast(compute_vector.data()),
                                          thrust::raw_pointer_cast(distance_vector.data()),
                                          k, image_size, image_size);
  }

#endif
  // colorize diagram

  jfa_thrust_gather<<<dimGrid,dimBlock>>>(image_size, numLabels, raw_ptr, idptr, idxptr);
  cudaThreadSynchronize();

  cudaGraphicsUnmapResources(1, &computeImage);


#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,
