]> Creatis software - clitk.git/blob - vv/vvStructureSetActor.cxx
- now work in 3D with
[clitk.git] / vv / vvStructureSetActor.cxx
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://oncora1.lyon.fnclcc.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 #include "vvStructureSetActor.h"
20 #include "vvROIActor.h"
21
22 //------------------------------------------------------------------------------
23 vvStructureSetActor::vvStructureSetActor()
24 {
25
26 }
27 //------------------------------------------------------------------------------
28
29
30 //------------------------------------------------------------------------------
31 vvStructureSetActor::~vvStructureSetActor()
32 {
33 }
34 //------------------------------------------------------------------------------
35
36
37 //------------------------------------------------------------------------------
38 int vvStructureSetActor::GetNumberOfROIs() 
39
40   return mROIActors.size(); 
41 }
42 //------------------------------------------------------------------------------
43
44
45 //------------------------------------------------------------------------------
46 std::vector<vvROIActor*> & vvStructureSetActor::GetROIList() 
47
48   return mROIActors; 
49 }
50 //------------------------------------------------------------------------------
51
52
53 //------------------------------------------------------------------------------
54 void vvStructureSetActor::SetStructureSet(clitk::DicomRT_StructureSet * s)
55 {
56   mStructureSet = s;
57 }
58 //------------------------------------------------------------------------------
59
60
61 //------------------------------------------------------------------------------
62 void vvStructureSetActor::SetSlicerManager(vvSlicerManager * s)
63 {
64   mSlicerManager = s;
65 }
66 //------------------------------------------------------------------------------
67
68
69 //------------------------------------------------------------------------------
70 vvROIActor * vvStructureSetActor::GetROIActor(int n)
71 {
72   if (mMapROIIndex.find(n) == mMapROIIndex.end()) {
73     std::cerr << "No ROI number " << n << std::endl;
74     return NULL;
75   }
76   return mROIActors[mMapROIIndex[n]];
77 }
78 //------------------------------------------------------------------------------
79
80
81 //------------------------------------------------------------------------------
82 void vvStructureSetActor::CreateNewROIActor(int n)
83 {
84   // Check
85   clitk::DicomRT_ROI * roi = mStructureSet->GetROI(n);
86   if (roi == NULL) {
87     std::cerr << "Error. No ROI number " << n << std::endl;
88     exit(0);
89   }
90
91   // If already exist : delete it
92   int old = -1;
93   if (mMapROIIndex.find(n) != mMapROIIndex.end()) {
94     delete mROIActors[mMapROIIndex[n]];
95     old = mMapROIIndex[n];
96   }
97
98   // Add ROI Actors
99   vvROIActor * actor = new vvROIActor;
100   if (old == -1) mROIActors.push_back(actor);
101   else mROIActors[old] = actor;
102   actor->SetROI(roi);
103   actor->SetSlicerManager(mSlicerManager);
104   actor->Initialize();
105   mMapROIIndex[n] = mROIActors.size()-1;
106 }
107 //------------------------------------------------------------------------------
108
109