read/write support for image2d and image3d

It would be very nice to be able to read and write to the same image. Various image processing routines are iterative and require reading an image, then updating it.

It is annoying to have to keep 2 copies of an image in memory and to copy data between these images in order to accomplish this. In particular, dealing with large 3D images, it eats up too much memory to have to keep two images on the GPU at the same time.