Convert ITK pointer to Qt pointer
-
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]
-
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]
-
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.itk.org/CourseWare/Training/GettingStarted-IV.pdf (under Qt)
And if you need further help:
http://www.google.com/#q=qt+itk+adaptor