]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/wxQuantificationWidget.h
9f648ebe20a5cb80cb8f03f04906b3dc870858f9
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / wxQuantificationWidget.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: wxQuantificationWidget.h,v $
5   Language:  C++
6   Date:      $Date: 2009/05/14 13:54:57 $
7   Version:   $Revision: 1.1 $
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 #ifndef __WX__MARACAS__QUANTIF__WDG__HXX__
19 #define __WX__MARACAS__QUANTIF__WDG__HXX__
20
21
22 #include "vtk3DQuantSurfaceWidget.h"
23 #include "vtk2DQuantSliceWidget.h"
24 #include "wxImageViewerWidget.h"
25
26 #include "wxChart.h"
27
28 #include <wx/wx.h>
29 #include <wx/slider.h>
30 #include <wx/panel.h>
31 #include <wx/minifram.h>
32 #include <wx/splitter.h>
33 #include <kernel/marInterface.h>
34 #include "wxQuantificationWidget_base.h"
35
36
37
38
39
40 class wxQuantificationWidget : public wxQuantificationWidget_base
41 {
42 public:
43
44   enum WidgetsIDs { 
45     ID_QUANTIF3D = wxID_HIGHEST + 1 
46   };
47
48   enum  FunctionIDs {
49     ID_BUTTON_CONTOUR = wxID_HIGHEST + 1,
50     ID_BUTTON_CLEAN,
51     ID_BUTTON_CLEAN_ALL,
52     ID_BUTTON_SAVE_CONTOURS3D,
53     ID_BUTTON_AUTOQUANT,
54     ID_BUTTON_HEALTHY,
55     ID_BUTTON_CALCULATED,
56     ID_BUTTON_PAUSE,
57     ID_BUTTON_DELETE,
58     ID_BUTTON_POINT
59   };
60   
61   enum  ParamIDs {
62     ID_CHECKBOX_HEALTHY = wxID_HIGHEST + 1,
63     ID_CHECKBOX_PERPENDICULAR,
64     ID_CHECKBOX_VISIBLE_RINGS,
65     ID_CHECKBOX_SHOW_SURFACE,
66     ID_RADIOBUTTON_GREYSCALE,
67     ID_RADIOBUTTON_COLOR,
68     ID_SLIDER_SLICE,
69     ID_SLIDER_SLICE22,
70     ID_SLIDER_ISOVALUE,
71     ID_SLIDER_OPACITY
72 };
73
74   // Constructor &  Destructor
75   wxQuantificationWidget(wxWindow* parent, wxWindowID id = -1,
76                          const wxPoint& pos = wxDefaultPosition,
77                          const wxSize& size = wxDefaultSize,
78                          long style = 0/*wxScrolledWindowStyle*/,
79                          const wxString& name = wxPanelNameStr);
80   
81   ~wxQuantificationWidget( );
82     
83   // Initialize
84   void Set_control( );
85   void Do_layout( );
86   void Set_Data( );
87
88 //EED  void Positionate( );
89   void Forget( );
90   void Reload_Axis(bool mask, bool step);
91   void Show_Max_Min_Diameters( );
92   int  Back( );
93   void AddAxisActors();
94   void Clean3D( bool eraseAxe = false  );
95   void ResetAxis( );
96   virtual void RefreshAxis( );
97 //EED  void Refresh_Quant( );
98   void Point_Intensity(double x, double y);
99   void Set_plane_3D( double  x, double y );
100   void CleanContour();
101
102   void OnContourWall();
103   void OnContourLumen();
104   void OnContourHypo();
105   void OnContourCalc();
106   void OnReplaceContourWall();
107   void OnReplaceContourLumen();
108   void OnReplaceContourHypo();
109   void OnReplaceContourCalc();
110   void OnSliderDiscontinuityScroll(int percentage);
111   void OnSliderLumenPercentageScroll(int percentage);
112   void OnSliderCalcPercentageScroll(int percentage);
113   void OnCalibration();
114   void OnFile();
115   void OnShowAll(bool value); 
116   void OnShowWall(bool value);
117   void OnShowLumen(bool value);
118   void OnShowCalc(bool value);
119   void OnShowHypo(bool value);
120
121   wxPanel* CreateStenosisPanel();
122
123   //Button
124   void Do_Quant( );
125   void OnContour_BT(wxCommandEvent& event);
126   void OnClean_BT(wxCommandEvent& event);
127   void OnCleanAll_BT(wxCommandEvent& event);
128   void OnSaveContours3D_BT(wxCommandEvent& event);
129
130   void OnAutoQuantification_BT(wxCommandEvent& event);
131
132
133
134   virtual void DetectHealthySickSlice( bool minSurf , bool maxSurf );
135
136   
137   //CheckBox
138   void OnHealthySlice_CB(wxCommandEvent& event);
139   void OnShowSurface_CB(wxCommandEvent& event);
140   void OnVisibleRing_CB(wxCommandEvent& event);
141   void OnPerpendicular_CB(wxCommandEvent& event);
142     
143   // RadioButton
144   void OnGreyScale_RB(wxCommandEvent& event);
145   void OnColor_RB(wxCommandEvent& event);
146     
147   //Slider
148   void OnSliderSliceScroll(wxScrollEvent& event);
149   void OnSliderIsovalueScroll(wxScrollEvent& event);
150   void OnSliderOpacityScroll(wxScrollEvent& event);
151   virtual int  GetActualSlice();
152   virtual int  GetMaxActualSlice();
153   virtual int  GetHealthySlice();
154   void GetHealthySliceRange(int &healthySliceStart,int &healthySliceEnd);
155   virtual int  GetSizeHealthyRegion();
156   virtual void SetSizeHealthyRegion(int size);
157   virtual void SetHealthySlice(int healthySlice=-1);    
158
159   void ShowMARACASData( marInterface* mar );
160   void CallBackOnMouseWheel( wxMouseEvent& event );
161   void CallBackOnLeftDClick( wxMouseEvent& event );
162
163   virtual void Set3DRegionSliceActor( int type, int k1,int k2 );
164   virtual void Set3DStartRegionSliceActor( int type, int k );
165   void Set3DEndRegionSliceActor( int type, int k );
166
167   void Show3DRegionSliceActor(int type );
168   virtual void Show3DStartRegionSliceActor(int type );
169   void Show3DEndRegionSliceActor(int type );
170
171   void Hide3DRegionSliceActor(int type );
172   virtual void Hide3DStartRegionSliceActor(int type );
173   virtual void Hide3DEndRegionSliceActor(int type );
174  
175   virtual void GetSliceLimites(int type, int &sliceStart,int &sliceEnd);
176
177   int  GetAnalysisTypeStenosis();
178   virtual void SetAnalysisTypeStenosis(int analysisTypeStenosis);
179
180   void SetSlider_Isovalue_Opacity(int isovalue,int opacity);
181   virtual void SetManualContour_2DWorld(bool ok);
182   virtual void SetManualContour_AddPoint_2DWorld();
183   void SetManualContour_InsertPoint_2DWorld();
184   void SetManualContour_ErasePoint_2DWorld();
185   void SetManualContour_MovePoint_2DWorld();
186   virtual void SetManualContour_ReplaceContour();
187
188   virtual kVolume *GetVolumeAxisExtended(int wz1,int wz2);
189
190 private:
191
192   // App
193   marInterface                          *_mar;
194   
195   // VTK
196   vtk3DQuantSurfaceWidget       *_3DWorld;
197   vtk2DQuantSliceWidget         *_2DWorld;
198
199   // Chart
200
201   // EED
202   //wxChart                                     *_Chart;
203   wxPanel                                       *_wxStenosisPanel;
204   wxSplitterWindow                      *panel_splitter; 
205   wxSplitterWindow                      *panel_splitter_right; 
206   wxSplitterWindow                      *panel_splitter_left; 
207 //  wxPanel                                     *panel_left;
208   wxPanel                                       *panel_left_up;
209   wxPanel                                       *panel_left_down;
210   wxPanel                                       *panel_right;
211   wxPanel                                       *panel_right_up;
212   wxPanel                                       *panel_right_down;
213
214   // Group button
215   wxButton                                      *_bt_AddContour3D;
216   wxButton                                      *_bt_CleanContour3D;
217   wxButton                                      *_bt_CleanAllContours3D;
218   wxButton                                      *_bt_SaveContours3D;
219   wxButton                                      *_bt_Healthy;
220
221   wxPanelControlsHealthySickSlice2 *_pl_cntlHealthySick2;
222
223
224 //  wxButton                            *_bt_ContourCalculated;
225 //  wxButton                            *_bt_Pause;
226 //  wxButton                            *_bt_Delete;
227 //  wxButton                            *_bt_Point;
228
229   // Tool graph
230   wxRadioButton                         *_rb_GreyScale;
231   wxRadioButton                         *_rb_Color;
232
233   wxCheckBox                            *_cb_HealthySlice;
234   wxCheckBox                            *_cb_Perpendicular;
235
236   wxCheckBox                            *_cb_VisibleRings;
237   wxCheckBox                            *_cb_ShowSurface;
238   wxSlider                                      *_sl_Slice;
239   wxSlider                                      *_sl_Isovalue;
240   wxSlider                                      *_sl_Opacity;
241   wxStaticText                          *_st_Slice;
242   wxStaticText                          *_st_Isovalue;
243   wxStaticText                          *_st_Opacity; 
244
245   // Status Text
246 //  wxStaticText        *_st_Label0;
247 //  wxStaticText        *_st_Value0;
248   wxStaticText          *_st_Label1;
249   wxStaticText          *_st_Value1;
250   wxStaticText          *_st_Label2;
251   wxStaticText          *_st_Value2;
252   wxStaticText          *_st_Label3;
253   wxStaticText          *_st_Value3;
254 //  wxStaticText        *_st_Label4;
255 //  wxStaticText        *_st_Value4;
256 //  wxStaticText        *_st_Label5;
257 //  wxStaticText        *_st_Value5;
258   wxStaticText          *_st_Label6;
259   wxStaticText          *_st_Value6;
260   wxStaticText          *_st_Label7;
261   wxStaticText          *_st_Value7;
262   wxStaticText          *_st_Label8;
263   wxStaticText          *_st_Value8;
264 //  wxStaticText        *_st_Label9;
265 //  wxStaticText        *_st_Value9;
266
267
268   wxStaticText          *_st_Label100;
269   wxStaticText          *_st_Value100;
270   wxStaticText          *_st_Label101;
271   wxStaticText          *_st_Value101;
272 //  wxStaticText        *_st_Label102;
273 //  wxStaticText        *_st_Value102;
274 //  wxStaticText        *_st_Label103;
275 //  wxStaticText        *_st_Value103;
276 //  wxStaticText        *_st_Label104;
277 //  wxStaticText        *_st_Value104;
278 //  wxStaticText        *_st_Label105;
279 //  wxStaticText        *_st_Value105;
280 //  wxStaticText        *_st_Label106;
281 //  wxStaticText        *_st_Value106;
282 //  wxStaticText        *_st_Label107;
283 //  wxStaticText        *_st_Value107;
284 //  wxStaticText        *_st_Label108;
285 //  wxStaticText        *_st_Value108;
286
287
288   wxStaticText          *_st_LabelRef101;
289   wxStaticText          *_st_ValueRef101;
290   wxStaticText          *_st_LabelRef102;
291   wxStaticText          *_st_ValueRef102;
292   wxStaticText          *_st_LabelRef103;
293   wxStaticText          *_st_ValueRef103;
294
295
296
297   // Quantification
298   // int
299   int _numpoint;
300   int _axis_index;
301   int _width, _height, _depth;
302   int _bak_ActualSlice;
303
304   int _given_points;
305   int _typ;
306   int _actual_actor;
307   int _perpe;
308   int _shown;
309   int _quant_shown;
310   int _show_rings;
311   int _show_hs;
312   int _showS;
313   
314   int _first_quant;
315   int _last_quant;
316   int _first_point_quant;
317   int _last_point_quant;
318   int _bounds;
319   int _intRange;
320   int _nClicks;
321   int _quantifing;
322   int _sizeHealthyRegion;
323
324   int _initX;
325   int _initY;
326   int _initWindow;
327   int _initLevel;
328
329   // float
330 //  float _real_first_point_quant;
331 //  float _real_last_point_quant;
332   float _actual_area;
333   float _actual_peri;
334   float _actual_darea;
335   float _actual_dperi;
336   float _actual_dmax;
337   float _actual_dmin;
338   float _actual_davg;
339   float _actual_sten;
340   float _actual_partial;
341   float _actual_total;
342   float _ip[3], _fp[3];
343
344   // wxList
345   wxList  *_rings_index;
346   wxList  *_quant_sten;
347   wxList  *_man_points;
348   wxList  *_actual_quant_x;
349   wxList  *_actual_quant_area;
350   wxList  *_actual_quant_peri;
351   wxList  *_actual_quant_darea;
352   wxList  *_actual_quant_dperi;
353   wxList  *_actual_quant_dmax;
354   wxList  *_actual_quant_dmin;
355   wxList  *_actual_quant_davg;
356   wxList  *_actual_quant_sten;
357
358   DECLARE_EVENT_TABLE( );
359         
360   void          MoveSlider(int actualQuant);
361   void          Reset_sl_Slider();
362   void          showVariables();
363   wxString      strStenosis(double stenosis);
364   double        doubleStenosis(double healthy, double sick);
365   double        GetStenosisArea(int sickSlice);
366   double        GetStenosisDiameter(int sickSlice);
367
368 };
369
370 #endif // __WX__MARACAS__QUANTIF__WDG
371