             if(ix<iPosX)
                 continue;
             // fetch scalar voxel value
+#ifdef SHMLOAD
+            const uchar *v = voxel + BPV * (ix-iPosX);
+#else
             const uchar *v = voxLine + BPV * (ix-iPosX);
+#endif
             // pointer to destination pixel
             uchar4 *pix = imgLine + ix;
             // apply transfer function

            d.w += w;

            // store into shmem
            *pix = d;
        }
    }


        // the voxel row of the current slice corresponding to this image line
        const uchar *voxLine = voxels +BPV * (MUL24(slice+1,MUL24(c_vox[principal+1],c_vox[principal+0]))
                + MUL24((iPosY-line-1),c_vox[principal+0]));

#ifdef SHMLOAD
        for (int ix=threadIdx.x; ix<c_vox[principal+0]; ix+=blockDim.x)
        {
            //((uchar4 *)voxel)[ix] = ((uchar4 *)voxels)[ix];
            voxel[ix] = voxLine[ix];
        }
        __syncthreads();
#endif

        // Traverse intermediate image pixels which correspond to the current slice.
        // 1 is subtracted from each loop counter to remain inside of the volume boundaries:
