瀏覽代碼

Displaying the received image via ctkDICOMImage

Ivo Wolf 14 年之前
父節點
當前提交
675786f5e7
共有 1 個文件被更改,包括 19 次插入0 次删除
  1. 19 0
      Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppLogic.cpp

+ 19 - 0
Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppLogic.cpp

@@ -23,11 +23,19 @@
 #include "ctkExampleDicomAppLogic_p.h"
 #include "ctkExampleDicomAppPlugin_p.h"
 
+// Qt includes
 #include <QtPlugin>
 #include <QRect>
 #include <QDebug>
 #include <QPushButton>
 #include <QApplication>
+#include <QLabel>
+
+// ctkDICOMCore includes
+#include "ctkDICOMImage.h"
+
+// DCMTK includes
+#include <dcmimage.h>
 
 ctkExampleDicomAppLogic::ctkExampleDicomAppLogic()
   : hostTracker(ctkExampleDicomAppPlugin::getPluginContext()), button(NULL)
@@ -198,6 +206,17 @@ void ctkExampleDicomAppLogic::buttonClicked()
   {
     s=s+" URI: "+locators.begin()->URI;
     qDebug() << "URI: " << locators.begin()->URI;
+    QString filename = locators.begin()->URI;
+    if(filename.startsWith("file:/",Qt::CaseInsensitive))
+      filename=filename.remove(0,6);
+    qDebug()<<filename;
+    DicomImage dcmtkImage(filename.toLatin1().data());
+    ctkDICOMImage ctkImage(&dcmtkImage);
+
+    QLabel* qtImage = new QLabel;
+    qtImage->setPixmap(ctkImage.getPixmap(0));
+    qtImage->show();
   }
   button->setText(s);
+
 }