I'm currently working on a medical imaging software and need to overlay the atlas of the brain corresponding to the MRI image slice . I'm using graphicsview & graphicscene to display the images, the code i'm using to display the atlas images is below.

pAtlasImage is the current atlas 24 bit BMP image array

QImage image(nAtlasWidth,nAtlasHeight,QImage::Format_RGB8 88);
memcpy(image.bits(), pAtlasImage, nAtlasWidth*nAtlasHeight*3);
image = image.rgbSwapped();//Returns a QImage in which the values of the red and blue components of all pixels have been swapped, effectively converting an RGB image to an BGR image.
atlas_qpixmap_image = QPixmap::fromImage(image,Qt::AutoColor);
atlas_qpixmap_image.setAlphaChannel(atlas_qpixmap_ image.createMaskFromColor(Qt::white, Qt::MaskOutColor));
atlas_1_qgpixmap = scene[m_nSliceCurrent]->addPixmap(atlas_qpixmap_image.scaled(w,h,Qt::Igno reAspectRatio, Qt::FastTransformation));

The code is laggy and jumps some frames when I'm scrolling through the MRI images, due mainly to the setAlphaChannel call, is there anyway to speed the code by using a QPainter somewhere instead of a QPixmap or QImage ?