         return;
 
     // initialise intermediate image line
-    __shared__ extern uchar4 imgLine[];
+    __shared__ extern uchar smem[];
+    uchar4 *imgLine = (uchar4 *)smem;
+    uchar *voxel = smem+width*4;
     for (int ix=threadIdx.x; ix<width; ix+=blockDim.x)
     {
         imgLine[ix] = make_uchar4(0,0,0,0);

        // 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]));

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

            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
