]> Creatis software - clitk.git/commitdiff
Add callback for open dicom rt dialog (not done yet)
authorDavid Sarrut <david.sarrut@gmail.com>
Thu, 23 Feb 2012 16:05:24 +0000 (17:05 +0100)
committerDavid Sarrut <david.sarrut@gmail.com>
Thu, 23 Feb 2012 16:05:24 +0000 (17:05 +0100)
vv/vvToolROIManager.cxx
vv/vvToolROIManager.h

index d8bc827a17307cffa31e501c9d22978d2beb9d60..bfddaf923d3e486e8a940488ff8c31f2dea4322a 100644 (file)
@@ -22,6 +22,8 @@
 #include "vvROIActor.h"
 #include "vvSlicer.h"
 #include "vvROIActor.h"
+#include "vvMeshReader.h"
+#include "vvStructSelector.h"
 
 // Qt
 #include <QFileDialog>
@@ -96,6 +98,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f)
   connect(parent, SIGNAL(SelectedImageHasChanged(vvSlicerManager *)), 
           this, SLOT(SelectedImageHasChanged(vvSlicerManager *)));
   connect(mOpenBinaryButton, SIGNAL(clicked()), this, SLOT(OpenBinaryImage()));
+  connect(mOpenDicomButton, SIGNAL(clicked()), this, SLOT(OpenDicomImage()));
   connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
   connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
   connect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
@@ -230,6 +233,45 @@ void vvToolROIManager::OpenBinaryImage()
 //------------------------------------------------------------------------------
 
 
+//------------------------------------------------------------------------------
+void vvToolROIManager::OpenDicomImage() 
+{
+  DD("OpenDicomImage");
+  QString Extensions = "Dicom Files ( *.dcm RS*)";
+  Extensions += ";;All Files (*)";
+  QString file = QFileDialog::getOpenFileName(this,tr("Merge Images"), 
+                                              mMainWindow->GetInputPathName(), 
+                                              Extensions);
+  if (file.isNull()) return;
+
+  //  AddDCStructContour(index, file);
+  vvMeshReader reader;
+  reader.SetFilename(file.toStdString());
+  vvStructSelector selector;
+  selector.SetStructures(reader.GetROINames());
+  // selector.EnablePropagationCheckBox(); FIXME Disable
+
+  // FIXME : change text -> allow to save binary image
+
+  if (selector.exec()) {
+    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+    reader.SetSelectedItems(selector.getSelectedItems());
+    reader.SetImage(mSlicerManager->GetImage());
+    reader.Update();
+
+    // std::vector<vvMesh::Pointer> contours=reader.GetOutput();
+    // for (std::vector<vvMesh::Pointer>::iterator i=contours.begin();
+    //      i!=contours.end(); i++)
+    //   AddContour(index,*i,selector.PropagationEnabled());
+    QApplication::restoreOverrideCursor();
+  }
+
+
+
+}
+//------------------------------------------------------------------------------
+
+
 //------------------------------------------------------------------------------
 void vvToolROIManager::AddImage(vvImage * binaryImage, std::string filename, 
                                 double BG, bool modeBG) 
index 4bbf39493a0e111dab74185e189422f981a22b44..3e139c9439f662e1b78295ba135f1494859f94b3 100644 (file)
@@ -51,6 +51,7 @@ class vvToolROIManager:
   void AnImageIsBeingClosed(vvSlicerManager *);
   void SelectedImageHasChanged(vvSlicerManager *);
   void OpenBinaryImage();
+  void OpenDicomImage();
   void SelectedItemChangedInTree();
   void VisibleROIToggled(bool b);
   void VisibleContourROIToggled(bool b);