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