]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/wxQuantificationWidgetCT.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / wxQuantificationWidgetCT.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: wxQuantificationWidgetCT.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__CT__WDG__HXX__
44 #define __WX__MARACAS__QUANTIF__CT__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/marInterfaceCT.h>
59 #include "wxQuantificationWidget_base.h"
60 #include "ContourView.h"
61 #include "PointView.h"
62 #include "LineView.h"
63 #include "../manualContourContainer.h"
64 #include <vector>
65
66
67
68 class wxQuantificationWidgetCT : public wxQuantificationWidget_base
69 {
70 public:
71
72   enum WidgetsIDs { 
73     ID_QUANTIF3D = wxID_HIGHEST + 1 
74   };
75
76   enum  FunctionIDs {
77     ID_BUTTON_CONTOUR = wxID_HIGHEST + 1,
78     ID_BUTTON_CLEAN,
79     ID_BUTTON_CLEAN_ALL,
80     ID_BUTTON_AUTOQUANT,
81     ID_BUTTON_HEALTHY,
82     ID_BUTTON_CALCULATED,
83     ID_BUTTON_PAUSE,
84     ID_BUTTON_DELETE,
85     ID_BUTTON_POINT
86   };
87   
88   enum  ParamIDs {
89     ID_CHECKBOX_HEALTHY = wxID_HIGHEST + 1,
90     ID_CHECKBOX_PERPENDICULAR,
91     ID_CHECKBOX_VISIBLE_RINGS,
92     ID_CHECKBOX_SHOW_SURFACE,
93     ID_RADIOBUTTON_GREYSCALE,
94     ID_RADIOBUTTON_COLOR,
95     ID_SLIDER_SLICE,
96     ID_SLIDER_SLICE22,
97     ID_SLIDER_ISOVALUE,
98     ID_SLIDER_OPACITY
99 };
100
101   
102
103   // Constructor &  Destructor
104   wxQuantificationWidgetCT(wxWindow* parent, wxWindowID id = -1,
105                          const wxPoint& pos = wxDefaultPosition,
106                          const wxSize& size = wxDefaultSize,
107                          long style = 0/*wxScrolledWindowStyle*/,
108                          const wxString& name = wxPanelNameStr);
109   
110   ~wxQuantificationWidgetCT( );
111     
112   // Initialize
113
114 //  void Set_control( );
115 //  void Do_layout( );
116   void Set_Data( );
117
118 //EED  void Positionate( );
119   void Forget( );
120   void Reload_Axis(bool mask, bool step);
121   void Show_Max_Min_Diameters( );
122   int  Back( );
123   void AddAxisActors();
124   void Clean3D( bool eraseAxe = false  );
125   void ResetAxis( );
126   void RefreshAxis( );
127 //EED  void Refresh_Quant( );
128   void Point_Intensity(double x, double y);
129   void Set_plane_3D( double  x, double y );
130   void CleanContour();
131
132
133   //Button
134   void Do_Quant( );
135   void OnContour_BT(wxCommandEvent& event);
136   void OnClean_BT(wxCommandEvent& event);
137   void OnCleanAll_BT(wxCommandEvent& event);
138
139
140   void OnAutoQuantification_BT(wxCommandEvent& event);
141
142
143
144   void DetectHealthySickSlice( bool minSurf , bool maxSurf );
145     
146   //CheckBox
147   void OnHealthySlice_CB(wxCommandEvent& event);
148   void OnShowSurface_CB(wxCommandEvent& event);
149   void OnVisibleRing_CB(wxCommandEvent& event);
150   void OnPerpendicular_CB(wxCommandEvent& event);
151     
152   // RadioButton
153   void OnGreyScale_RB(wxCommandEvent& event);
154   void OnColor_RB(wxCommandEvent& event);
155     
156   //Slider
157   void OnSliderSliceScroll(wxScrollEvent& event);
158   void OnSliderIsovalueScroll(wxScrollEvent& event);
159   void OnSliderOpacityScroll(wxScrollEvent& event);
160   
161   int  GetActualSlice();
162   void SetActualSlice(int slice);
163   int  GetMaxActualSlice();
164   int  GetHealthySlice();
165   void GetHealthySliceRange(int &healthySliceStart,int &healthySliceEnd);
166   int  GetSizeHealthyRegion();
167   void SetSizeHealthyRegion(int size);
168   void SetHealthySlice(int healthySlice=-1);    
169
170   void  MoveSlider(int actualQuant);
171
172
173   void ShowMARACASData( marInterfaceCT* mar );
174   void CallBackOnMouseWheel( wxMouseEvent& event );
175   void CallBackOnLeftDClick( wxMouseEvent& event );
176
177   void Set3DRegionSliceActor( int type, int k1,int k2 );
178   void Set3DStartRegionSliceActor( int type, int k );
179   void Set3DEndRegionSliceActor( int type, int k );
180
181   void Show3DRegionSliceActor(int type );
182   void Show3DStartRegionSliceActor(int type );
183   void Show3DEndRegionSliceActor(int type );
184
185   void Hide3DRegionSliceActor(int type );
186   void Hide3DStartRegionSliceActor(int type );
187   void Hide3DEndRegionSliceActor(int type );
188  
189   void GetSliceLimites(int type, int &sliceStart,int &sliceEnd);
190
191   int  GetAnalysisTypeStenosis();
192   void SetAnalysisTypeStenosis(int analysisTypeStenosis);
193
194   void SetSlider_Isovalue_Opacity(int isovalue,int opacity);
195   void SetManualContour_2DWorld(bool ok);
196   void SetManualContour_AddPoint_2DWorld();
197   void SetManualContour_InsertPoint_2DWorld();
198   void SetManualContour_ErasePoint_2DWorld();
199   void SetManualContour_MovePoint_2DWorld();
200   void SetManualContour_ReplaceContour();
201
202   kVolume *GetVolumeAxisExtended(int wz1,int wz2);
203
204
205   void Refresh();
206   void RefreshView(marImageData *marimagedata);
207   void ConfigureVTK(marImageData *marimagedata);
208
209   void OnContourWall();
210   void OnContourLumen();
211   void OnContourHypo();
212   void OnContourCalc();
213   void OnReplaceContourWall();
214   void OnReplaceContourLumen();
215   void OnReplaceContourHypo();
216   void OnReplaceContourCalc();
217
218   void OnSliderDiscontinuityScroll(int percentage);
219   void OnSliderLumenPercentageScroll(int percentage);
220   void OnSliderCalcPercentageScroll(int percentage);
221   void OnCalibration();
222   void OnFile();
223
224   void OnShowAll(bool value); 
225   void OnShowWall(bool value);
226   void OnShowLumen(bool value);
227   void OnShowCalc(bool value);
228   void OnShowHypo(bool value);
229
230   void performXOR();
231   void performAND();
232   void getIndex();
233
234 private:
235
236 enum ContourTypes
237         {
238                 WALL = 1,              /*!< Wall Type. */ 
239                 CALCIFICATION,     /*!< Calcification Type. */  
240                 HYPODENSE,          /*!< Hypodense Type. */
241                 ELUMEN                          /*!< Extracted Lumen */
242         };
243
244         
245
246   // App
247   marInterfaceCT                        *_mar;
248   
249   // VTK
250   vtk3DQuantSurfaceWidget       *_3DWorld;
251 //  vtk2DQuantSliceWidget               *_2DWorld;
252
253   //Visualization
254   wxVtk2DBaseView                       *_imageviewer2D_1;
255   vtkImageData                          *_data;
256   vtkBaseData                           *_vtkbasedata_1;
257
258
259   //Manual Contour Wall
260   /*manualContourControler      *_manContourControlWall;
261   manualContourModel            *_mContourModelWall;
262   manualViewContour                     *_mViewContourWall;
263
264   //Manual Contour Lumen
265   manualContourControler        *_manContourControlLumen;
266   manualContourModel            *_mContourModelLumen;
267   manualViewContour                     *_mViewContourLumen;
268
269   //Manual Contour Calc
270   std::vector <manualContourControler *> _manContourControlCalc;
271   std::vector <manualContourModel *> _mContourModelCalc;
272   std::vector <manualViewContour *> _mViewContourCalc;
273
274   //Manual Contour Hypo
275   std::vector <manualContourControler *> _manContourControlHypo;
276   std::vector <manualContourModel *> _mContourModelHypo;
277   std::vector <manualViewContour *> _mViewContourHypo;  
278   
279 */
280   std::vector <manualContourContainer *> _manContours;
281   //Default contours, points and lines viewing
282   ContourView                           *_contourViewer;
283   LineView                                      *_lineViewer;
284   PointView                                     *_pointViewer;
285
286   // Chart
287
288   // EED
289   //wxChart                                     *_Chart;
290   wxWindow                                      *_wxStenosisPanel;
291
292 //  wxSplitterWindow                    *panel_splitter; 
293 //  wxSplitterWindow                    *panel_splitter_right; 
294 //  wxPanel                                     *panel_left;
295 //  wxPanel                                     *panel_right_up;
296 //  wxPanel                                     *panel_right_down;
297 //  wxPanel                                     *panel_rightm_up;
298
299   // Group button
300   wxButton                                      *_bt_AddContour3D;
301   wxButton                                      *_bt_CleanContour3D;
302   wxButton                                      *_bt_CleanAllContours3D;
303   wxButton                                      *_bt_Healthy;
304
305   wxPanelControlsHealthySickSliceCT *_pl_cntlHealthySick2;
306
307
308 //  wxButton                            *_bt_ContourCalculated;
309 //  wxButton                            *_bt_Pause;
310 //  wxButton                            *_bt_Delete;
311 //  wxButton                            *_bt_Point;
312
313   // Tool graph
314   wxRadioButton                         *_rb_GreyScale;
315   wxRadioButton                         *_rb_Color;
316
317   wxCheckBox                            *_cb_HealthySlice;
318   wxCheckBox                            *_cb_Perpendicular;
319
320   wxCheckBox                            *_cb_VisibleRings;
321   wxCheckBox                            *_cb_ShowSurface;
322   wxSlider                                      *_sl_Slice;
323   wxSlider                                      *_sl_Isovalue;
324   wxSlider                                      *_sl_Opacity;
325   wxStaticText                          *_st_Slice;
326   wxStaticText                          *_st_Isovalue;
327   wxStaticText                          *_st_Opacity; 
328   
329
330   // Status Text
331 //  wxStaticText        *_st_Label0;
332 //  wxStaticText        *_st_Value0;
333   wxStaticText          *_txt_Position;
334
335   wxStaticText          *_st_Label1;
336   wxStaticText          *_st_Value1;
337   wxStaticText          *_st_Label2;
338   wxStaticText          *_st_Value2;
339   wxStaticText          *_st_Label3;
340   wxStaticText          *_st_Value3;
341 //  wxStaticText        *_st_Label4;
342 //  wxStaticText        *_st_Value4;
343 //  wxStaticText        *_st_Label5;
344 //  wxStaticText        *_st_Value5;
345   wxStaticText          *_st_Label6;
346   wxStaticText          *_st_Value6;
347   wxStaticText          *_st_Label7;
348   wxStaticText          *_st_Value7;
349   wxStaticText          *_st_Label8;
350   wxStaticText          *_st_Value8;
351 //  wxStaticText        *_st_Label9;
352 //  wxStaticText        *_st_Value9;
353
354
355   wxStaticText          *_st_Label100;
356   wxStaticText          *_st_Value100;
357   wxStaticText          *_st_Label101;
358   wxStaticText          *_st_Value101;
359 //  wxStaticText        *_st_Label102;
360 //  wxStaticText        *_st_Value102;
361 //  wxStaticText        *_st_Label103;
362 //  wxStaticText        *_st_Value103;
363 //  wxStaticText        *_st_Label104;
364 //  wxStaticText        *_st_Value104;
365 //  wxStaticText        *_st_Label105;
366 //  wxStaticText        *_st_Value105;
367 //  wxStaticText        *_st_Label106;
368 //  wxStaticText        *_st_Value106;
369 //  wxStaticText        *_st_Label107;
370 //  wxStaticText        *_st_Value107;
371 //  wxStaticText        *_st_Label108;
372 //  wxStaticText        *_st_Value108;
373
374
375   wxStaticText          *_st_LabelRef101;
376   wxStaticText          *_st_ValueRef101;
377   wxStaticText          *_st_LabelRef102;
378   wxStaticText          *_st_ValueRef102;
379   wxStaticText          *_st_LabelRef103;
380   wxStaticText          *_st_ValueRef103;
381
382
383
384   // Quantification
385   // int
386   int _numpoint;
387   int _axis_index;
388   int _width, _height, _depth;
389   int _bak_ActualSlice;
390   int _bak_ActualSlice2;
391
392   int _given_points;
393   int _typ;
394   int _actual_actor;
395   int _perpe;
396   int _shown;
397   int _quant_shown;
398   int _show_rings;
399   int _show_hs;
400   int _showS;
401   
402   int _first_quant;
403   int _last_quant;
404   int _first_point_quant;
405   int _last_point_quant;
406   int _bounds;
407   int _intRange;
408   int _nClicks;
409   int _quantifing;
410   int _sizeHealthyRegion;
411
412   int _initX;
413   int _initY;
414   int _initWindow;
415   int _initLevel;
416
417   // float
418 //  float _real_first_point_quant;
419 //  float _real_last_point_quant;
420   float _actual_area;
421   float _actual_peri;
422   float _actual_darea;
423   float _actual_dperi;
424   float _actual_dmax;
425   float _actual_dmin;
426   float _actual_davg;
427   float _actual_sten;
428   float _actual_partial;
429   float _actual_total;
430   float _ip[3], _fp[3];
431
432   // wxList
433   wxList  *_rings_index;
434   wxList  *_quant_sten;
435   wxList  *_man_points;
436   wxList  *_actual_quant_x;
437   wxList  *_actual_quant_area;
438   wxList  *_actual_quant_peri;
439   wxList  *_actual_quant_darea;
440   wxList  *_actual_quant_dperi;
441   wxList  *_actual_quant_dmax;
442   wxList  *_actual_quant_dmin;
443   wxList  *_actual_quant_davg;
444   wxList  *_actual_quant_sten;
445
446   DECLARE_EVENT_TABLE( );
447         
448   void          Reset_sl_Slider();
449   void          showVariables();
450   wxString      strStenosis(double stenosis);
451   double        doubleStenosis(double healthy, double sick);
452   double        GetStenosisArea(int sickSlice);
453   double        GetStenosisDiameter(int sickSlice);
454   wxWindow* CreateView2DPanel(wxWindow *parent);
455   void          CreateManualContours();
456   void          addManualContours(int type);
457
458         wxSplitterWindow *_splitPanelPrincipal;
459         wxSplitterWindow *_splitpanel_left;
460         wxSplitterWindow *_splitpanel_right;
461         wxSplitterWindow *_splitpanel_right_down;
462
463         wxWindow* CreatePanelPrincipal(wxWindow *parent);
464         wxWindow* CreatePanelStatus(wxWindow *parent);
465         wxWindow* CreatePanel_Left(wxWindow *parent);
466         wxWindow* CreatePanel_Right(wxWindow *parent);
467         wxWindow* CreateStenosisPanel(wxWindow *parent);
468         wxWindow* CreateControlPanel3D(wxWindow *parent);
469         wxWindow* CreatePanel_Right_Down(wxWindow *parent);
470
471 };
472
473
474
475
476 #endif // __WX__MARACAS__QUANTIF__CT__WDG__HXX__
477