How to map 3 channel image data to a 3dArray?

I have pixel data in a one dimensional array:

R(red value of 0,0 pixel) G(green value of 0,0 pixel) B RG (green value of 0,1 pixel) B RGB RGB …

from the 3 channel image with with = WIDTH and height = HEIGHT

to get blue pixel value at x,y coordinates you do:

channel = 2

pixel_value = array[ (y * WIDTH + x )*3 + channel]

i am trying to map this data on a 3d array of the dimensions:

WIDTHxHEIGHTxCHANNELS so that 3darr[x,z,2] returns same result as above.

Here is what i tryed already. Unfortunatly it does not seem to map properly:

 //h_data is the image data

  //preparing to fill 3darray with image data and doing it

    cudaMemcpy3DParms cpy_params = {0};

    cpy_params.extent = ca_extent;

    cpy_params.kind = cudaMemcpyHostToDevice;

    cpy_params.dstArray = ca_image;

    cpy_params.srcPtr = make_cudaPitchedPtr( (void*)h_data, width*sizeof(unsigned char), height, 3 );

    CUDA_SAFE_CALL( cudaMemcpy3D( &cpy_params));

I am using cuda2.0beta sdk.

Can someone suggest me what am i doing wrong?