Working with single channel images? (Is it possible?)

Hi,

I’ve been starting to play with OpenCL. We have single channel medical images (16-bits). First tried to create a image with this format:


      format.image_channel_order = CL_R;
      format.image_channel_data_type = CL_SIGNED_INT16;

Assuming that the memory layout would be:


  RRRRRRRRR....

However, this gave an image of all zeros.

When I pad to RGBA, all sees better.


      format.image_channel_order = CL_RGBA;
      format.image_channel_data_type = CL_SIGNED_INT16;

   RGBARGBA...  (where R is from my single channel image, GBA is 0)

Seeing the same behavior on Mac and a Linux/Tesla board setup. Am I doing something wrong? Any experience/comments?

Thanks,
-dan

Sorry to answer my own question… The kernel was using


float4 value = read_imagef ( ... )

For a integer image, this is undefined. So I was getting garbage. Using


int4 value = read_imagei ( ...)

Does the proper thing.

Best,
-dan

Good to know it works though :). I’ve been working with CL_RGBA recently and have had no time to try anything with CL_R

Did you try ?

format.image_channel_order = CL_LUMINANCE;