From: David Sarrut Date: Thu, 2 Feb 2012 08:38:45 +0000 (+0100) Subject: First version of new ROI tool (the goal is to put it into the main tab and allow... X-Git-Tag: v1.3.0~104^2~12 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=29c90b5fbd7ecd5d8375e02b7a03734c4fdbc806;p=clitk.git First version of new ROI tool (the goal is to put it into the main tab and allow dcm-rt-struct to be loaded) --- diff --git a/vv/qt_ui/vvToolROIManager.ui b/vv/qt_ui/vvToolROIManager.ui new file mode 100644 index 0000000..60c247d --- /dev/null +++ b/vv/qt_ui/vvToolROIManager.ui @@ -0,0 +1,542 @@ + + + vvToolROIManager + + + + 0 + 0 + 411 + 534 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Form + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 11 + 75 + true + + + + QFrame::NoFrame + + + No selected image + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + false + + + + + + + :/common/icons/exit.png:/common/icons/exit.png + + + + + + + + + + + + 0 + 0 + + + + Load ROI from image + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Open label image + + + + + + + :/common/icons/fileopen.png:/common/icons/fileopen.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + BG + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + QAbstractItemView::AllEditTriggers + + + true + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + true + + + + ID + + + + + Name + + + + + Color + + + + + Depth + + + + + 10 + + + Toto.mhd.toiefkjhfdjvhjhf + + + Red + + + + + + + + + + + + 0 + 0 + + + + Selected ROI + + + + + + + + Visible + + + false + + + + + + + + + + false + + + Color + + + + + + + Reload image + + + false + + + + + + + :/common/icons/rotateright.png:/common/icons/rotateright.png + + + + + + + + + + + + 0 + 0 + + + + Opacity + + + + + + + 100 + + + Qt::Horizontal + + + + + + + 100 + + + + + + + + + + + Contour + + + false + + + + + + + + + + false + + + Color + + + + + + + + + + 0 + 0 + + + + Width + + + + + + + 1 + + + 10 + + + + + + + + + + + + + + 0 + 0 + + + + Name : Lung + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Depth + + + + + + + 1 + + + 999999 + + + + + + + + + + + + + 0 + 0 + + + + All ROI + + + + 1 + + + 1 + + + + + 0 + + + 1 + + + + + Set all ROI visible + + + false + + + true + + + + + + + Set all contours visible + + + false + + + true + + + + + + + + + + + + + + + + mOpacitySlider + valueChanged(int) + mOpacitySpinBox + setValue(int) + + + 219 + 385 + + + 376 + 376 + + + + + mOpacitySpinBox + valueChanged(int) + mOpacitySlider + setValue(int) + + + 376 + 367 + + + 222 + 373 + + + + + diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx new file mode 100644 index 0000000..77a65d3 --- /dev/null +++ b/vv/vvToolROIManager.cxx @@ -0,0 +1,122 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + ===========================================================================**/ + +// vv +#include "vvToolROIManager.h" +#include "vvImageReader.h" +#include "vvROIActor.h" +#include "vvSlicer.h" +#include "vvROIActor.h" + +// Qt +#include +#include +#include +#include + +// vtk +#include +#include + +//------------------------------------------------------------------------------ +// Create the tool and automagically (I like this word) insert it in +// the main window menu. +ADD_TOOL(vvToolROIManager); +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f): + // vvToolWidgetBase(parent, f), + // if Qt::Widget -> No dialog in this case (in tab) ; PB = "invisible widget on menu" ! + // if "f" normal widget + QWidget(parent->GetTab()->widget(4)), + vvToolBase(parent), + Ui::vvToolROIManager() +{ + // Insert the current QWidget into the tab layout (required) + QWidget * mother = qFindChild(parent->GetTab(), "ROItab"); + mother->layout()->addWidget(this); + + // Build the UI + Ui_vvToolROIManager::setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + // Select the current image as the target + int i = parent->GetSlicerManagerCurrentIndex(); + InputIsSelected(parent->GetSlicerManagers()[i]); + + // Connect event from mainwindow to this widget + connect(parent, SIGNAL(AnImageIsBeingClosed(vvSlicerManager *)), + this, SLOT(AnImageIsBeingClosed(vvSlicerManager *))); + connect(parent, SIGNAL(SelectedImageHasChanged(vvSlicerManager *)), + this, SLOT(SelectedImageHasChanged(vvSlicerManager *))); + + // mMainWindowBase->GetTab()->setTabIcon(mTabNumber, GetToolIcon()); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +vvToolROIManager::~vvToolROIManager() +{ + std::cout << "vvToolROIManager::~vvToolROIManager()" << std::endl; +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +// STATIC +void vvToolROIManager::Initialize() { + SetToolName("ROIManager"); + SetToolMenuName("Display ROI (binary image)"); + SetToolIconFilename(":/common/icons/tool-roi.png"); + SetToolTip("Display ROI from a binary image."); + SetToolExperimental(true); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolROIManager::InputIsSelected(vvSlicerManager *m) +{ + std::cout << "vvToolROIManager::InputIsSelected()" << std::endl; + mSlicerManager = m; + + // Signal/slot + connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close())); + + // Initialization + +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) +{ + if (m == mSlicerManager) close(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) { + if (m != mSlicerManager) hide(); + else show(); +} +//------------------------------------------------------------------------------ diff --git a/vv/vvToolROIManager.h b/vv/vvToolROIManager.h new file mode 100644 index 0000000..2d91264 --- /dev/null +++ b/vv/vvToolROIManager.h @@ -0,0 +1,58 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + ===========================================================================**/ + +#ifndef VVTOOLROIMANAGER_H +#define VVTOOLROIMANAGER_H + +#include +#include + +#include "vvToolBase.h" +#include "vvROIActor.h" +#include "clitkDicomRT_ROI.h" +#include "ui_vvToolROIManager.h" + +class vvROIActor; + +//------------------------------------------------------------------------------ +class vvToolROIManager: + public QWidget, + public vvToolBase, + public Ui::vvToolROIManager +{ + Q_OBJECT + public: + vvToolROIManager(vvMainWindowBase* parent=0, Qt::WindowFlags f=Qt::Dialog); + virtual ~vvToolROIManager(); + + static void Initialize(); + virtual void InputIsSelected(vvSlicerManager *m); + + public slots: + void AnImageIsBeingClosed(vvSlicerManager *); + void SelectedImageHasChanged(vvSlicerManager *); + +protected: + Ui::vvToolROIManager ui; + vvSlicerManager * mSlicerManager; + +}; // end class vvToolROIManager +//------------------------------------------------------------------------------ + +#endif +