]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
bd3e8923b6e328a1926bce0cb95456d81b0d435e
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasIRMViewManager.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: wxMaracasIRMViewManager.h,v $
5   Language:  C++
6   Date:      $Date: 2009/05/04 07:35:42 $
7   Version:   $Revision: 1.4 $
8
9   Copyright: (c) 2002, 2003
10   License:
11   
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17
18
19
20
21 #ifndef __wxMaracasIRMViewManagerH__
22 #define __wxMaracasIRMViewManagerH__
23
24 #include <iostream>
25 #include <vector>
26
27 #include "vtkProp3D.h"
28 #include "vtkRenderer.h"
29 #include "vtkSTLReader.h"
30 #include "vtkPolyDataMapper.h"
31 #include "vtkActor.h"
32 #include "vtkProperty.h"
33 #include "vtkMetaImageReader.h"
34 #include "vtkMarchingCubes.h"
35 #include "vtkCleanPolyData.h"
36 #include "vtkImageData.h"
37
38
39
40
41 class wxMaracasIRMViewManagerData  {
42
43 public:
44         wxMaracasIRMViewManagerData(vtkProp3D* _prop3Dvect, std::string dataname="");
45         wxMaracasIRMViewManagerData(vtkImageData* imagedata, std::string dataname="");
46         ~wxMaracasIRMViewManagerData();
47
48         
49         /**
50         **      Adds a prop3D to the world of the application
51         **/
52         void setVtkImageData(vtkImageData* imagedata);
53         /**
54         **      Adds a prop3D to the world of the application
55         **/
56         void setProp3D(vtkProp3D* prop3D);
57         /**
58         **      Changes the opacity in a prop3D
59         **/
60         void changeOpacity(int value);
61         /**
62         **      changes the isovalue in a prop3D
63         **/
64         void changeIsoValue(double value);      
65         /**
66         **      Check if the variables are setted correctly
67         **/
68         void checkInvariant();
69         /**
70         **      get the prop3D 
71         **/
72         vtkProp3D* getProp3D();
73         /**
74         **      return the id from the daat
75         **/
76         int getId();
77         /**
78         **      set data id
79         **/
80         void setId(int propid);
81         /**
82         **      Get the filanme
83         **/
84     std::string getDataname();
85         /**
86         ** Set the filanme
87         **/
88     void setDataname(std::string dataname);
89         /**
90         **      Returns the grey max level of the image
91         **/
92
93         int getMaxGreyLevel();
94
95         /**
96         **      creates the image 
97         **/
98         void contourExtractor(int isovalue);
99
100         /**
101         **      Changes the color of the actor
102         **/
103         void changeColor(double red, double green, double blue);        
104         
105 private:        
106         vtkProp3D* _prop3D;
107         vtkImageData* _imagedata;
108         int _id; 
109         std::string _dataname;
110         int _maxgreylevel;
111
112         /**
113         ** to the image render
114         **/
115         vtkMarchingCubes* _cubesFilter;
116         vtkCleanPolyData* _cleanFilter; 
117         vtkPolyDataMapper* _dataMapper;
118         
119         /**
120         ** Get's the max grey level of the image
121         **/
122         int getMaxLevel(vtkImageData* img);
123         
124
125         
126 };
127
128 class wxMaracasIRMViewManager  {
129
130 public:
131         wxMaracasIRMViewManager();
132         ~wxMaracasIRMViewManager();
133
134         /**
135         **      Sets the renderer to manage the prop3D from the view
136         **/
137         void setRenderer(vtkRenderer*  renderer);
138         /**
139         **      Adds a prop3D to the manager and returns the identifier
140         **/
141         int addProp3D(vtkProp3D* prop3D, std::string dataname) throw (char*);
142         /**
143         **      Adds a prop3D to the manager and returns the identifier
144         **/
145         int addPropMHD(vtkImageData* imagedata, std::string dataname) throw(char*);
146         /**
147         **      Changes the opacity in a prop3D
148         **/
149         void changeOpacity(int propid, int value)throw(char*);
150
151         /**
152         **      changes the isovalue in a prop3D
153         **/
154         void changeIsoValue(int propid, double value)throw(char*);
155
156         /**
157         **      loads a prop3D from a nSTL file
158         **/
159         vtkProp3D* getProp3D(std::string filename);
160
161         /**
162         **      loads a MHD file to convert it into an actor
163         **/
164         vtkImageData* getImageData(std::string filename);
165
166         /**
167         **      adds or removes an actor depending of the bool value
168         **/
169         void addRemoveActor(int propid, bool addremove)throw(char*);
170         /**
171         **      Check if the variables are setted correctly
172         **/
173         void checkInvariant()throw(char*);
174
175         /**
176         **      Given an id search the data in the vector
177         **/
178         wxMaracasIRMViewManagerData* getViewData(int id)throw(char*);
179
180         /**
181         **      Given the id, return the max iso value from the imagedata
182         **/
183         int getMaxIsoValue(int propid)throw(char*);
184
185
186         /**
187         **      Changes the color of the actor
188         **/
189         void changeColor(int propid, double red, double green, double blue) throw(char*);
190
191         void deleteActor(int propid)throw (char *);
192         
193 private:        
194         std::vector<wxMaracasIRMViewManagerData*> prop3Dvect;
195
196         vtkRenderer*  _renderer;
197
198         int _idCount;
199
200         
201
202         
203 };
204
205 #endif