1 /*=========================================================================
4 Module: $RCSfile: wxMaracasIRMViewManager.h,v $
6 Date: $Date: 2009/05/04 07:35:42 $
7 Version: $Revision: 1.4 $
9 Copyright: (c) 2002, 2003
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.
16 =========================================================================*/
21 #ifndef __wxMaracasIRMViewManagerH__
22 #define __wxMaracasIRMViewManagerH__
27 #include "vtkProp3D.h"
28 #include "vtkRenderer.h"
29 #include "vtkSTLReader.h"
30 #include "vtkPolyDataMapper.h"
32 #include "vtkProperty.h"
33 #include "vtkMetaImageReader.h"
34 #include "vtkMarchingCubes.h"
35 #include "vtkCleanPolyData.h"
36 #include "vtkImageData.h"
41 class wxMaracasIRMViewManagerData {
44 wxMaracasIRMViewManagerData(vtkProp3D* _prop3Dvect, std::string dataname="");
45 wxMaracasIRMViewManagerData(vtkImageData* imagedata, std::string dataname="");
46 ~wxMaracasIRMViewManagerData();
50 ** Adds a prop3D to the world of the application
52 void setVtkImageData(vtkImageData* imagedata);
54 ** Adds a prop3D to the world of the application
56 void setProp3D(vtkProp3D* prop3D);
58 ** Changes the opacity in a prop3D
60 void changeOpacity(int value);
62 ** changes the isovalue in a prop3D
64 void changeIsoValue(double value);
66 ** Check if the variables are setted correctly
68 void checkInvariant();
72 vtkProp3D* getProp3D();
74 ** return the id from the daat
80 void setId(int propid);
84 std::string getDataname();
88 void setDataname(std::string dataname);
90 ** Returns the grey max level of the image
93 int getMaxGreyLevel();
98 void contourExtractor(int isovalue);
101 ** Changes the color of the actor
103 void changeColor(double red, double green, double blue);
107 vtkImageData* _imagedata;
109 std::string _dataname;
113 ** to the image render
115 vtkMarchingCubes* _cubesFilter;
116 vtkCleanPolyData* _cleanFilter;
117 vtkPolyDataMapper* _dataMapper;
120 ** Get's the max grey level of the image
122 int getMaxLevel(vtkImageData* img);
128 class wxMaracasIRMViewManager {
131 wxMaracasIRMViewManager();
132 ~wxMaracasIRMViewManager();
135 ** Sets the renderer to manage the prop3D from the view
137 void setRenderer(vtkRenderer* renderer);
139 ** Adds a prop3D to the manager and returns the identifier
141 int addProp3D(vtkProp3D* prop3D, std::string dataname) throw (char*);
143 ** Adds a prop3D to the manager and returns the identifier
145 int addPropMHD(vtkImageData* imagedata, std::string dataname) throw(char*);
147 ** Changes the opacity in a prop3D
149 void changeOpacity(int propid, int value)throw(char*);
152 ** changes the isovalue in a prop3D
154 void changeIsoValue(int propid, double value)throw(char*);
157 ** loads a prop3D from a nSTL file
159 vtkProp3D* getProp3D(std::string filename);
162 ** loads a MHD file to convert it into an actor
164 vtkImageData* getImageData(std::string filename);
167 ** adds or removes an actor depending of the bool value
169 void addRemoveActor(int propid, bool addremove)throw(char*);
171 ** Check if the variables are setted correctly
173 void checkInvariant()throw(char*);
176 ** Given an id search the data in the vector
178 wxMaracasIRMViewManagerData* getViewData(int id)throw(char*);
181 ** Given the id, return the max iso value from the imagedata
183 int getMaxIsoValue(int propid)throw(char*);
187 ** Changes the color of the actor
189 void changeColor(int propid, double red, double green, double blue) throw(char*);
191 void deleteActor(int propid)throw (char *);
194 std::vector<wxMaracasIRMViewManagerData*> prop3Dvect;
196 vtkRenderer* _renderer;