Results 1 to 3 of 3

Thread: Speeding up Image Rendering

  1. #1
    Join Date
    Jun 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Speeding up Image Rendering

    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 ?

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Speeding up Image Rendering

    What if you use opengl in graphics view ?
    QGraphicsView::setViewport(new QGLWidget)

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Speeding up Image Rendering

    You can speed things up if you use a format other than bmp - then you won't have to swap the channels which is quite a time intensive process. The same as creating a mask by scanning colors of the image, can you have that precalculated?. Also you can scale the image before doing those transformations, this will significantly reduce the amount of data that needs to be processed.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 8
    Last Post: 7th November 2012, 19:20
  2. Replies: 6
    Last Post: 21st September 2009, 10:55
  3. Rendering an image within QwtPlot
    By ttvo in forum Qwt
    Replies: 4
    Last Post: 10th July 2009, 07:03
  4. Replies: 3
    Last Post: 14th March 2007, 08:09
  5. Speeding up QPaint
    By georgie in forum Qt Programming
    Replies: 12
    Last Post: 16th May 2006, 02:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.