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