]> Creatis software - clitk.git/blob - vv/vvToolStructureSetManager.h
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvToolStructureSetManager.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ===========================================================================**/
18
19 #ifndef VVTOOLSTRUCTURESETMANAGER_H
20 #define VVTOOLSTRUCTURESETMANAGER_H
21
22 #if QT_VERSION >= 0x050000
23 #include <QtUiPlugin/QDesignerExportWidget>
24 #else
25 #include <QtDesigner/QDesignerExportWidget>
26 #endif
27 #include "vvToolBase.h"
28 #include "vvToolWidgetBase.h"
29 #include "clitkDicomRT_StructureSet.h"
30 #include "ui_vvToolStructureSetManager.h"
31 #include "vvROIActor.h"
32
33 #include <QSharedPointer>
34
35 class vvStructureSetActor;
36
37 //------------------------------------------------------------------------------
38 class vvToolStructureSetManager:
39   public vvToolWidgetBase,
40   public vvToolBase<vvToolStructureSetManager>, 
41   private Ui::vvToolStructureSetManager
42 {
43   Q_OBJECT
44   public:
45   vvToolStructureSetManager(vvMainWindowBase* parent=0, Qt::WindowFlags f=0, vvSlicerManager * c = NULL);
46   virtual ~vvToolStructureSetManager();
47
48   static void Initialize();
49   virtual void InputIsSelected(vvSlicerManager *m);
50
51   int AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet);
52   void UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s);
53   void AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * w);
54
55   static vvToolStructureSetManager * AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool modeBG=true);    
56   void AddImage(vvImage * image, std::string filename, double BG, bool modeBG=true);
57   void UpdateImage();
58
59 public slots:
60   virtual void apply();
61   void Open(int type);
62   void OpenBinaryImage();
63   void SelectedItemChangedInTree();
64   void VisibleROIToggled(bool b);
65   void VisibleContourROIToggled(bool b);
66   void OpacityChanged(int v);
67   void ChangeColor();
68   void ChangeContourColor();
69   void ChangeContourWidth(int n);
70   void ChangeDepth(int n);
71   void AllVisibleROIToggled(int b);
72   void AllVisibleContourROIToggled(bool b);
73   void ReloadCurrentROI();
74
75 protected:
76   Ui::vvToolStructureSetManager ui;
77   clitk::DicomRT_StructureSet* mCurrentStructureSet;
78   vvStructureSetActor * mCurrentStructureSetActor;
79   int mCurrentStructureSetIndex;
80   clitk::DicomRT_ROI::Pointer mCurrentROI;
81   vvROIActor * mCurrentROIActor;
82   vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
83   bool mIsAllVisibleEnabled;
84   int mNumberOfVisibleROI;
85   int mNumberOfVisibleContourROI;
86   std::vector<clitk::DicomRT_StructureSet::Pointer > mStructureSetsList;
87   std::vector< QSharedPointer<vvStructureSetActor> > mStructureSetActorsList;
88   std::vector< QSharedPointer<QTreeWidgetItem> > mTreeWidgetList;
89   std::map<clitk::DicomRT_ROI::Pointer, QTreeWidgetItem *> mMapROIToTreeWidget;
90   std::map<QTreeWidgetItem *, clitk::DicomRT_ROI::Pointer> mMapTreeWidgetToROI;
91   std::vector<int> mLoadedROIIndex;
92   std::vector<vvImage::Pointer> mOpenedBinaryImage;
93  
94   void setCurrentSelectedROI(clitk::DicomRT_ROI * roi);
95   void UpdateAllROIStatus();
96   virtual bool close();
97   virtual void closeEvent(QCloseEvent *event);
98
99   // Management of all instances
100   virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index);
101   static std::vector<vvSlicerManager*> mListOfInputs;
102   static std::map<vvSlicerManager*, vvToolStructureSetManager*> mListOfOpenTool;
103   static int m_NumberOfTool;
104   bool MustOpenDialogWhenCreated;
105  
106 }; // end class vvToolStructureSetManager
107 //------------------------------------------------------------------------------
108
109 #endif
110