]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
b3be47c7724a7f917617aeb84cf692ebb7906d7a
[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/04/14 12:47:30 $
7   Version:   $Revision: 1.3 $
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(int 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         **
114         **/
115         vtkPolyDataMapper* _dataMapper;
116         vtkPolyData* _polydata;
117         /**
118         ** Get's the max grey level of the image
119         **/
120         int getMaxLevel(vtkImageData* img);
121         
122
123         
124 };
125
126 class wxMaracasIRMViewManager  {
127
128 public:
129         wxMaracasIRMViewManager();
130         ~wxMaracasIRMViewManager();
131
132         /**
133         **      Sets the renderer to manage the prop3D from the view
134         **/
135         void setRenderer(vtkRenderer*  renderer);
136         /**
137         **      Adds a prop3D to the manager and returns the identifier
138         **/
139         int addProp3D(vtkProp3D* prop3D, std::string dataname) throw (char*);
140         /**
141         **      Adds a prop3D to the manager and returns the identifier
142         **/
143         int addPropMHD(vtkImageData* imagedata, std::string dataname);
144         /**
145         **      Changes the opacity in a prop3D
146         **/
147         void changeOpacity(int propid, int value)throw(char*);
148
149         /**
150         **      changes the isovalue in a prop3D
151         **/
152         void changeIsoValue(int propid, int value)throw(char*);
153
154         /**
155         **      loads a prop3D from a nSTL file
156         **/
157         vtkProp3D* getProp3D(std::string filename);
158
159         /**
160         **      loads a MHD file to convert it into an actor
161         **/
162         vtkImageData* getImageData(std::string filename);
163
164         /**
165         **      adds or removes an actor depending of the bool value
166         **/
167         void addRemoveActor(int propid, bool addremove)throw(char*);
168         /**
169         **      Check if the variables are setted correctly
170         **/
171         void checkInvariant()throw(char*);
172
173         /**
174         **      Given an id search the data in the vector
175         **/
176         wxMaracasIRMViewManagerData* getViewData(int id)throw(char*);
177
178         /**
179         **      Given the id, return the max iso value from the imagedata
180         **/
181         int getMaxIsoValue(int propid)throw(char*);
182
183
184         /**
185         **      Changes the color of the actor
186         **/
187         void changeColor(int propid, double red, double green, double blue) throw(char*);
188         
189 private:        
190         std::vector<wxMaracasIRMViewManagerData*> prop3Dvect;
191
192         vtkRenderer*  _renderer;
193
194         int _idCount;
195
196         
197
198         
199 };
200
201 #endif