QT- QImage and multi-threading problem.
- by umanga
Greetings all,
Please refer to image at :
http://i48.tinypic.com/316qb78.jpg
We are developing an application to extract cell edges from MRC images from electron microscope.
MRC file format stores volumetric pixel data (http://en.wikipedia.org/wiki/Voxel) and we simply use 3D char array(char***) to load and store data (gray scale values) from a MRC file.
As shown in the image,there are 3 viewers to display XY,YZ and ZX planes respectively.
Scrollbars on the top of the viewers use to change the image slice along an axis.
Here is the steps we do when user changes the scrollbar position.
1) get the new scrollbar value.(this
is the selected slice)
2) for the relavant plane (YZ,XY or
ZX), generate (char* slice;) array for
the selected slice by reading 3D char
array (char***)
3) Create a new QImage*
(Format_RGB888) and set pixel values
by reading 'slice' (using
img-setPixel(x,y,c);)
4) This new QImage* is painted in the
paintEvent() method.
We are going to execute "edge-detection" process in a seperate thread since it is an intensive process.During this process we need to draw detected curve (set of pixels) on top of above QImage*.(as a layer).This means we need to call drawPoint() methods outside the QT thread.
Is it the best wayto use QImage for this case?
What is the best way to execute QT drawing methods from another thread?
thanks in advance,