1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 /*=========================================================================
29 Module: $RCSfile: wxQuantificationWidgetCT.h,v $
31 Date: $Date: 2012/11/15 14:15:17 $
32 Version: $Revision: 1.2 $
34 Copyright: (c) 2002, 2003
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.
41 =========================================================================*/
43 #ifndef __WX__MARACAS__QUANTIF__CT__WDG__HXX__
44 #define __WX__MARACAS__QUANTIF__CT__WDG__HXX__
47 #include "vtk3DQuantSurfaceWidget.h"
48 #include "vtk2DQuantSliceWidget.h"
49 #include "wxImageViewerWidget.h"
54 #include <wx/slider.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"
63 #include "../manualContourContainer.h"
68 class wxQuantificationWidgetCT : public wxQuantificationWidget_base
73 ID_QUANTIF3D = wxID_HIGHEST + 1
77 ID_BUTTON_CONTOUR = wxID_HIGHEST + 1,
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,
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);
110 ~wxQuantificationWidgetCT( );
114 // void Set_control( );
115 // void Do_layout( );
118 //EED void Positionate( );
120 void Reload_Axis(bool mask, bool step);
121 void Show_Max_Min_Diameters( );
123 void AddAxisActors();
124 void Clean3D( bool eraseAxe = false );
127 //EED void Refresh_Quant( );
128 void Point_Intensity(double x, double y);
129 void Set_plane_3D( double x, double y );
135 void OnContour_BT(wxCommandEvent& event);
136 void OnClean_BT(wxCommandEvent& event);
137 void OnCleanAll_BT(wxCommandEvent& event);
140 void OnAutoQuantification_BT(wxCommandEvent& event);
144 void DetectHealthySickSlice( bool minSurf , bool maxSurf );
147 void OnHealthySlice_CB(wxCommandEvent& event);
148 void OnShowSurface_CB(wxCommandEvent& event);
149 void OnVisibleRing_CB(wxCommandEvent& event);
150 void OnPerpendicular_CB(wxCommandEvent& event);
153 void OnGreyScale_RB(wxCommandEvent& event);
154 void OnColor_RB(wxCommandEvent& event);
157 void OnSliderSliceScroll(wxScrollEvent& event);
158 void OnSliderIsovalueScroll(wxScrollEvent& event);
159 void OnSliderOpacityScroll(wxScrollEvent& event);
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);
170 void MoveSlider(int actualQuant);
173 void ShowMARACASData( marInterfaceCT* mar );
174 void CallBackOnMouseWheel( wxMouseEvent& event );
175 void CallBackOnLeftDClick( wxMouseEvent& event );
177 void Set3DRegionSliceActor( int type, int k1,int k2 );
178 void Set3DStartRegionSliceActor( int type, int k );
179 void Set3DEndRegionSliceActor( int type, int k );
181 void Show3DRegionSliceActor(int type );
182 void Show3DStartRegionSliceActor(int type );
183 void Show3DEndRegionSliceActor(int type );
185 void Hide3DRegionSliceActor(int type );
186 void Hide3DStartRegionSliceActor(int type );
187 void Hide3DEndRegionSliceActor(int type );
189 void GetSliceLimites(int type, int &sliceStart,int &sliceEnd);
191 int GetAnalysisTypeStenosis();
192 void SetAnalysisTypeStenosis(int analysisTypeStenosis);
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();
202 kVolume *GetVolumeAxisExtended(int wz1,int wz2);
206 void RefreshView(marImageData *marimagedata);
207 void ConfigureVTK(marImageData *marimagedata);
209 void OnContourWall();
210 void OnContourLumen();
211 void OnContourHypo();
212 void OnContourCalc();
213 void OnReplaceContourWall();
214 void OnReplaceContourLumen();
215 void OnReplaceContourHypo();
216 void OnReplaceContourCalc();
218 void OnSliderDiscontinuityScroll(int percentage);
219 void OnSliderLumenPercentageScroll(int percentage);
220 void OnSliderCalcPercentageScroll(int percentage);
221 void OnCalibration();
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);
238 WALL = 1, /*!< Wall Type. */
239 CALCIFICATION, /*!< Calcification Type. */
240 HYPODENSE, /*!< Hypodense Type. */
241 ELUMEN /*!< Extracted Lumen */
247 marInterfaceCT *_mar;
250 vtk3DQuantSurfaceWidget *_3DWorld;
251 // vtk2DQuantSliceWidget *_2DWorld;
254 wxVtk2DBaseView *_imageviewer2D_1;
256 vtkBaseData *_vtkbasedata_1;
259 //Manual Contour Wall
260 /*manualContourControler *_manContourControlWall;
261 manualContourModel *_mContourModelWall;
262 manualViewContour *_mViewContourWall;
264 //Manual Contour Lumen
265 manualContourControler *_manContourControlLumen;
266 manualContourModel *_mContourModelLumen;
267 manualViewContour *_mViewContourLumen;
269 //Manual Contour Calc
270 std::vector <manualContourControler *> _manContourControlCalc;
271 std::vector <manualContourModel *> _mContourModelCalc;
272 std::vector <manualViewContour *> _mViewContourCalc;
274 //Manual Contour Hypo
275 std::vector <manualContourControler *> _manContourControlHypo;
276 std::vector <manualContourModel *> _mContourModelHypo;
277 std::vector <manualViewContour *> _mViewContourHypo;
280 std::vector <manualContourContainer *> _manContours;
281 //Default contours, points and lines viewing
282 ContourView *_contourViewer;
283 LineView *_lineViewer;
284 PointView *_pointViewer;
290 wxWindow *_wxStenosisPanel;
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;
300 wxButton *_bt_AddContour3D;
301 wxButton *_bt_CleanContour3D;
302 wxButton *_bt_CleanAllContours3D;
303 wxButton *_bt_Healthy;
305 wxPanelControlsHealthySickSliceCT *_pl_cntlHealthySick2;
308 // wxButton *_bt_ContourCalculated;
309 // wxButton *_bt_Pause;
310 // wxButton *_bt_Delete;
311 // wxButton *_bt_Point;
314 wxRadioButton *_rb_GreyScale;
315 wxRadioButton *_rb_Color;
317 wxCheckBox *_cb_HealthySlice;
318 wxCheckBox *_cb_Perpendicular;
320 wxCheckBox *_cb_VisibleRings;
321 wxCheckBox *_cb_ShowSurface;
323 wxSlider *_sl_Isovalue;
324 wxSlider *_sl_Opacity;
325 wxStaticText *_st_Slice;
326 wxStaticText *_st_Isovalue;
327 wxStaticText *_st_Opacity;
331 // wxStaticText *_st_Label0;
332 // wxStaticText *_st_Value0;
333 wxStaticText *_txt_Position;
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;
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;
375 wxStaticText *_st_LabelRef101;
376 wxStaticText *_st_ValueRef101;
377 wxStaticText *_st_LabelRef102;
378 wxStaticText *_st_ValueRef102;
379 wxStaticText *_st_LabelRef103;
380 wxStaticText *_st_ValueRef103;
388 int _width, _height, _depth;
389 int _bak_ActualSlice;
390 int _bak_ActualSlice2;
404 int _first_point_quant;
405 int _last_point_quant;
410 int _sizeHealthyRegion;
418 // float _real_first_point_quant;
419 // float _real_last_point_quant;
428 float _actual_partial;
430 float _ip[3], _fp[3];
433 wxList *_rings_index;
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;
446 DECLARE_EVENT_TABLE( );
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);
458 wxSplitterWindow *_splitPanelPrincipal;
459 wxSplitterWindow *_splitpanel_left;
460 wxSplitterWindow *_splitpanel_right;
461 wxSplitterWindow *_splitpanel_right_down;
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);
476 #endif // __WX__MARACAS__QUANTIF__CT__WDG__HXX__