views:

32

answers:

1

I don't know whether this is the right forum. Anyway here is the question. In one of our application we display medical images and on top of them some algorithm generated bitmap. The real bitmap is a 16bit gray scale bitmap. From this we generate a color bitmap based on a look up table for eg

(0-100)->green 
(100-200)->blue
(200>above)->red

The display is working well and good with small images 256x256. But when the display area becomes big say 1024x1024 the gray scale to color bitmap conversion takes a while and the interactions are not smooth any more. In the recent times I have heard a lot about general purpose GPU programming. In our deployment we have high end (Nvidia QuadroFX) graphics card.

Our application is built using .Net/C# if requiured I can add little bit of C++/CLI too. Now my question is can this bitmap conversion be offloaded to the graphics processor? Where should I look for further reading?

A: 

Yes -- and since you're (apparently) displaying the bitmap, you don't need to go the GPGPU route (e.g., OpenCL or CUDA). You can use a programmable shader for it -- and if I understand what you're saying, it'll be a pretty straightforward one at that.

As far as how to write the shader, it will depend (mostly) on how you're doing the rest of your drawing. Just for an obvious example, if you're already using WPF for your drawing, you'll probably want to use an HLSL shader (WPF supports pixel shaders fairly directly).

It's probably also worth noting that if you had to support older hardware, a table lookup like this is something you could actually manage pretty easily on the GPU, even without programmable shaders. As long as you only need to support recent hardware, a shader will probably be simpler though.

Jerry Coffin
Thanks for quick answer. To clear some of your doubts. We use winforms for the display. So the whole medical image generation and the algorithmic bitmap gneration is done in the bcakground and alpha blended and displayed in the application. That was the reason why I was trying the gpgpu route. is it possible to use the WPF bitmap+HLSL shader to this in the background. Again thanks a lot for the answer.
ferosekhanj
Yes, using it in the background should work -- but since you're using WinForms, it's not nearly as well integrated. Since you're not displaying it immediately, you (apparently) need to get the data back from the GPU so it's available to the CPU for saving and such. In that case, something like CUDA or OpenCL probably be a better choice.
Jerry Coffin