Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Convert ITK pointer to Qt pointer
Forum Updated to NodeBB v4.3 + New Features

Convert ITK pointer to Qt pointer

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 4.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jk_mk
    wrote on last edited by
    #1

    Hello,

    I am using Qt with ITK (toolkit for medical image processing). I have created a ITK pointer named filter. This pointer includes the contents (raw data) of an image. Then I want to pass this pointer to a QGraphicsScene *scene, as it seems from the following code:

    @
    scene->addPixmap(QPixmap(filter));
    ui->graphicsView_resultImage->setScene(scene);
    @

    But when I debug my project, I get an error which says that addPixmap receives a pointer of type QPixmap. How I could convert the ITK pointer to QPixmap pointer. I think that I must convert filter to QPixmapData, but I do not know how to do this. Could somebody help me?

    [EDIT: code formatting, please wrap in @-tags, Volker]

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You need to know details of the format of your image. If you know that it is probably the best to read it directly into one of Qt's supported image objects.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jk_mk
        wrote on last edited by
        #3

        So it isn't possible to convert ITK pointer to Qt pointer? And suppoosing that I knew the format of my image, then I should type something like this to display the image?Or I am doing something wrong?

        @
        QImage image(scene->sceneRect().size().toSize(), QImage::Format_RGB32);

        QPainter painter(&image);
        scene->render(&painter);

        scene->addPixmap(QPixmap("result.png"));
        ui->graphicsView_resultImage->setScene(scene);
        @

        [EDIT: code formatting, Volker]

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Depends on what an ITK pointer is. I doubt that anybody here knows that.

          For the rest: Just try it with a test image. You would get the answer more quickly than waiting for a reply here :-)

          Your code looks a bit weird, though: You call render on a painter but manipulate the scene afterwards.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • L Offline
            L Offline
            loladiro
            wrote on last edited by
            #5

            http://www.itk.org/CourseWare/Training/GettingStarted-IV.pdf (under Qt)
            And if you need further help:
            http://www.google.com/#q=qt+itk+adaptor

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved