I'm new to MITK and not an advanced programmer. I need help displaying a DICOM image in a QT Widget. I am using Visual Studio 2013, MITK, and QT5 to develop a program, that is supposed to open and view DICOM images. The user browses an image which is then displayed. I`ve seen here: Interactively editing an existing rectangle on a QPixmap? that it is possible with a QLabel and QGraphicsview. I just don't know how to use that in my program:
void MainWindow::on_openButton_pressed()
{
QString imagePath = QFileDialog::getOpenFileName(
this, tr("Open File"),
"",
tr("JPEG(*.jpg *.jpeg);;DICOM(*.dcm)")
);
imageObject = new QImage();
imageObject->load(imagePath); //bool status is false here
image = QPixmap::fromImage(*imageObject)
image.load(imagePath);
QSize bigsize = ui->bigImageLabel->size();
QSize bigsize = ui->label->size();
ui->label->setPixmap(image.scaled(bigsize, Qt::IgnoreAspectRatio, Qt::FastTransformation));
ui->label->show();
}
I also tried using QGraphicsView (which only works for JPEGs).
scene = new QGraphicsScene(this);
scene->addPixmap(image);
scene->setSceneRect(image.rect());
ui->ViewCoronal->setScene(scene);
I hope someone can help me. Thanks in advance