From 169771ce0def5bd09e8daf54ea32650e0d823088 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Thu, 23 Feb 2012 17:05:24 +0100 Subject: [PATCH] Add callback for open dicom rt dialog (not done yet) --- vv/vvToolROIManager.cxx | 42 +++++++++++++++++++++++++++++++++++++++++ vv/vvToolROIManager.h | 1 + 2 files changed, 43 insertions(+) diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx index d8bc827..bfddaf9 100644 --- a/vv/vvToolROIManager.cxx +++ b/vv/vvToolROIManager.cxx @@ -22,6 +22,8 @@ #include "vvROIActor.h" #include "vvSlicer.h" #include "vvROIActor.h" +#include "vvMeshReader.h" +#include "vvStructSelector.h" // Qt #include @@ -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 contours=reader.GetOutput(); + // for (std::vector::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) diff --git a/vv/vvToolROIManager.h b/vv/vvToolROIManager.h index 4bbf394..3e139c9 100644 --- a/vv/vvToolROIManager.h +++ b/vv/vvToolROIManager.h @@ -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); -- 2.47.1