]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/wxQuantificationWidgetCT.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / wxQuantificationWidgetCT.cxx
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.cxx,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 #include "wxQuantificationWidgetCT.h"
44 #include "../marDictionary.h"
45 #include "vtkPolyDataWriter.h"
46
47
48
49
50
51 //------------------------------------------------------------------------
52 //------------------------------------------------------------------------
53 //------------------------------------------------------------------------
54 BEGIN_EVENT_TABLE( wxQuantificationWidgetCT, wxPanel )
55         EVT_BUTTON(ID_BUTTON_CONTOUR    , wxQuantificationWidgetCT::OnContour_BT                                                )
56         EVT_BUTTON(ID_BUTTON_CLEAN              , wxQuantificationWidgetCT::OnClean_BT                                          )
57         EVT_BUTTON(ID_BUTTON_CLEAN_ALL  , wxQuantificationWidgetCT::OnCleanAll_BT                                               )
58         EVT_CHECKBOX(ID_CHECKBOX_HEALTHY,                       wxQuantificationWidgetCT::OnHealthySlice_CB             )
59         EVT_CHECKBOX(ID_CHECKBOX_SHOW_SURFACE,          wxQuantificationWidgetCT::OnShowSurface_CB              )
60         EVT_CHECKBOX(ID_CHECKBOX_VISIBLE_RINGS,         wxQuantificationWidgetCT::OnVisibleRing_CB              )
61         EVT_CHECKBOX(ID_CHECKBOX_PERPENDICULAR,         wxQuantificationWidgetCT::OnPerpendicular_CB            )
62
63         EVT_RADIOBUTTON(ID_RADIOBUTTON_GREYSCALE,       wxQuantificationWidgetCT::OnGreyScale_RB                        )
64         EVT_RADIOBUTTON(ID_RADIOBUTTON_COLOR,           wxQuantificationWidgetCT::OnColor_RB                            )
65
66         EVT_COMMAND_SCROLL(ID_SLIDER_SLICE,                     wxQuantificationWidgetCT::OnSliderSliceScroll           )
67
68         EVT_COMMAND_SCROLL(ID_SLIDER_OPACITY,           wxQuantificationWidgetCT::OnSliderOpacityScroll )
69         EVT_COMMAND_SCROLL_THUMBRELEASE(ID_SLIDER_ISOVALUE, wxQuantificationWidgetCT::OnSliderIsovalueScroll    )
70         
71 END_EVENT_TABLE( );
72
73 //--------------------------------------------------------------------------------
74 // Constructor
75 //--------------------------------------------------------------------------------
76 wxQuantificationWidgetCT::wxQuantificationWidgetCT(wxWindow* parent, wxWindowID id,
77                                                const wxPoint& pos, const wxSize& size, long style,
78                                                const wxString& name)
79 : wxQuantificationWidget_base( parent, id, pos, size, style, name )
80 {
81 /*
82     panel_splitter               = new wxSplitterWindow( this                   , -1, wxDefaultPosition, wxSize(400,400 ), wxSP_3D );
83         panel_left                       = new wxPanel(panel_splitter                   , -1, wxDefaultPosition, wxSize(400,400));
84     panel_splitter_right = new wxSplitterWindow( panel_splitter , -1, wxDefaultPosition, wxSize(400,400 ), wxSP_3D );
85         panel_right_up           = new wxPanel(panel_splitter_right             , -1, wxDefaultPosition, wxSize(600,600));
86         panel_right_down         = new wxPanel(panel_splitter_right             , -1, wxDefaultPosition, wxSize(600,600));
87         panel_rightm_up          = CreateViewPanel(panel_right_up);
88
89         // maracas
90         _mar = NULL;
91         SetSizeHealthyRegion( 5 );
92
93 //EEDxx 2.6
94 //      this->SetBackgroundColour(*wxLIGHT_GREY);
95
96         _3DWorld = new vtk3DQuantSurfaceWidget( panel_left, ID_QUANTIF3D );
97
98         
99 //EED OJO Este NULL es solo para que compile    
100         _3DWorld->SetInterfaceVtkPanelWidgets(NULL);
101
102 //      _2DWorld = new vtk2DQuantSliceWidget( panel_right_up, -1 );
103 //      _2DWorld->SetSize(200,200);
104
105 //EED OJO Este NULL es solo para que compile    
106 //      _2DWorld->SetInterfaceVtkPanelWidgets(NULL);
107         
108         
109         this->Set_control();
110         this->Do_layout();
111         this->Set_Data();
112 */
113         _bak_ActualSlice=-1;
114         _bak_ActualSlice2=-1;
115
116         _mar = NULL;
117
118         wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
119         sizer->Add( CreatePanelPrincipal(this), 1, wxALL|wxEXPAND, 0 );
120         sizer->Add( CreatePanelStatus(this) , 0, wxALL|wxEXPAND, 0 );
121
122         SetSizer(sizer);
123         Layout();       
124
125
126
127 }
128
129
130 //--------------------------------------------------------------------------------
131 // Destructor
132 // ----------------------------------------------------------------------------
133 wxQuantificationWidgetCT::~wxQuantificationWidgetCT( ){
134         _3DWorld->Delete( );
135         delete _contourViewer;
136         delete _lineViewer;
137         delete _pointViewer;
138 //      delete _2DWorld;
139         
140         for (int i = 0; i < _manContours.size(); i++)
141         {
142                 delete _manContours[i];
143                 _manContours[i] = NULL;
144         }
145         delete _imageviewer2D_1;
146 }
147 // ----------------------------------------------------------------------------
148 wxWindow* wxQuantificationWidgetCT::CreatePanelPrincipal(wxWindow *parent)
149 {
150         wxPanel *panel                  = new wxPanel(parent,-1);
151         _splitPanelPrincipal    = new wxSplitterWindow(panel, -1);
152         _splitPanelPrincipal->SetMinimumPaneSize(50);
153
154         wxWindow *principal_Left        = CreatePanel_Left(_splitPanelPrincipal) ;
155         wxWindow *principal_Right       = CreatePanel_Right(_splitPanelPrincipal);
156
157         _splitPanelPrincipal->SplitVertically(principal_Left , principal_Right,600 );
158
159
160         wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
161         sizer->Add( _splitPanelPrincipal, 1,wxGROW,0 );
162         panel->SetSizer(sizer);
163         panel->Layout();        
164         return panel;
165 }
166
167 // ----------------------------------------------------------------------------
168 wxWindow* wxQuantificationWidgetCT::CreatePanel_Left(wxWindow *parent)
169 {
170         wxPanel *panel          = new wxPanel(parent,-1);
171         _splitpanel_left        = new wxSplitterWindow(panel, -1);
172         _splitpanel_left->SetMinimumPaneSize(50);
173
174         _3DWorld = new vtk3DQuantSurfaceWidget( _splitpanel_left, ID_QUANTIF3D );
175         _3DWorld->SetInterfaceVtkPanelWidgets(NULL);
176         wxWindow *controlPanel3D        = CreateControlPanel3D(_splitpanel_left);
177
178         _splitpanel_left->SplitHorizontally(_3DWorld , controlPanel3D,0 );
179
180
181         wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
182         sizer->Add( _splitpanel_left, 1,wxGROW,0 );
183         panel->SetSizer(sizer);
184         panel->Layout();        
185         return panel;
186 }
187
188
189 // ----------------------------------------------------------------------------
190 wxWindow* wxQuantificationWidgetCT::CreateControlPanel3D(wxWindow *parent)
191 {
192         wxPanel *panel                                          = new wxPanel(parent,-1);
193         marDictionary marDict;
194         
195         _cb_HealthySlice        = new wxCheckBox( panel, ID_CHECKBOX_HEALTHY, wxString( marDict.GetString(205) , wxConvUTF8)); // "Healthy slice"
196         _cb_HealthySlice->SetValue(true);
197         _cb_Perpendicular       = new wxCheckBox( panel, ID_CHECKBOX_PERPENDICULAR, wxString(marDict.GetString(210), wxConvUTF8)); //"Perpendicular section"
198         _cb_Perpendicular->SetValue(true);
199
200         _rb_GreyScale           = new wxRadioButton( panel, ID_RADIOBUTTON_GREYSCALE, wxString(marDict.GetString(230), wxConvUTF8), wxDefaultPosition,wxDefaultSize,wxRB_GROUP ); //"greyscale    "
201         _rb_GreyScale->SetValue(true);
202
203         _rb_Color                       = new wxRadioButton( panel, ID_RADIOBUTTON_COLOR, wxString(marDict.GetString(235), wxConvUTF8), wxDefaultPosition,wxDefaultSize );//"color    "
204         _rb_Color->SetValue(false);
205
206         _cb_VisibleRings        = new wxCheckBox( panel, ID_CHECKBOX_VISIBLE_RINGS, wxString(marDict.GetString(215), wxConvUTF8));//"Visible rings"
207         _cb_VisibleRings->SetValue(true);
208         _cb_ShowSurface         = new wxCheckBox( panel, ID_CHECKBOX_SHOW_SURFACE, wxString(marDict.GetString(220), wxConvUTF8));//"Show Surface"
209         _cb_ShowSurface->SetValue(true);
210
211         
212         _bt_AddContour3D                = new wxButton( panel, ID_BUTTON_CONTOUR, wxString(marDict.GetString(245), wxConvUTF8) ,//"Add mark contour"
213                                        wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
214         _bt_CleanContour3D              = new wxButton( panel, ID_BUTTON_CLEAN, wxString(marDict.GetString(250), wxConvUTF8) ,//"Erase mark contours"
215                                      wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
216
217         _bt_CleanAllContours3D  = new wxButton( panel, ID_BUTTON_CLEAN_ALL, wxString(marDict.GetString(253), wxConvUTF8) ,//"Erase all mark contours"
218                                      wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
219
220         //wxSlider
221         _sl_Slice    = new wxSlider( panel, ID_SLIDER_SLICE     , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
222         _sl_Isovalue = new wxSlider( panel, ID_SLIDER_ISOVALUE  , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
223         _sl_Opacity  = new wxSlider( panel, ID_SLIDER_OPACITY   , 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
224
225
226         // size
227         _sl_Slice->SetSize(800,16);
228         _sl_Isovalue->SetSize(300,16);
229         _sl_Opacity->SetSize(300,16);
230         
231         // Text
232         _st_Slice                       = new wxStaticText(panel, -1, wxString(marDict.GetString( 90), wxConvUTF8) ); //"Slice "
233         _st_Isovalue            = new wxStaticText(panel, -1, wxString(marDict.GetString(240), wxConvUTF8) ); //"Isovalue"
234         _st_Opacity                     = new wxStaticText(panel, -1, wxString(marDict.GetString(225), wxConvUTF8) ); //"Opacity "
235
236         _txt_Position           = new wxStaticText(panel, -1, _T("  ") ); //"Position "
237
238
239 //--
240
241         wxFlexGridSizer         *axe                            = new wxFlexGridSizer(1);
242
243         wxFlexGridSizer         *axe1                           = new wxFlexGridSizer(10);
244         wxBoxSizer                      *axe2                           = new wxBoxSizer(wxHORIZONTAL);
245         wxFlexGridSizer         *axe3                           = new wxFlexGridSizer(10,0);
246         wxFlexGridSizer         *axe4                           = new wxFlexGridSizer(10,0);
247         wxBoxSizer                      *axe5                           = new wxBoxSizer(wxHORIZONTAL);
248
249
250
251         axe1->Add(_st_Slice                             , 10, wxALL|wxEXPAND, 0);
252         axe1->Add(_sl_Slice                             , 10, wxALL|wxGROW, 0);
253         axe1->Add(_txt_Position                 , 10, wxALL|wxEXPAND, 0);
254         axe1->AddGrowableCol(1);
255
256         axe2->Add(_cb_HealthySlice                      , 10, wxALL|wxEXPAND, 0);
257         axe2->Add(_cb_Perpendicular                     , 10, wxALL|wxEXPAND, 0);
258         axe2->Add(_cb_VisibleRings                      , 10, wxALL|wxEXPAND, 0);
259         axe2->Add(_cb_ShowSurface                       , 10, wxALL|wxEXPAND, 0);
260
261         axe3->Add(_st_Opacity                           ,  1, wxALL|wxEXPAND, 0);
262         axe3->Add(_sl_Opacity                           , 10, wxALL|wxGROW, 0);
263         axe3->Add(_rb_GreyScale                         , 10, wxALL|wxEXPAND, 0);
264         axe3->Add(_rb_Color                             , 10, wxALL|wxEXPAND, 0);
265         axe3->AddGrowableCol(1);
266
267         axe4->Add(_st_Isovalue                          ,  1, wxALL|wxEXPAND, 0);
268         axe4->Add(_sl_Isovalue                          ,  1, wxALL|wxGROW, 0);
269         axe4->AddGrowableCol(1);
270
271         axe5->Add(_bt_AddContour3D                      ,  1 );
272         axe5->Add(_bt_CleanContour3D                    ,  1 );
273         axe5->Add(_bt_CleanAllContours3D                ,  1 );
274
275
276         axe->Add(axe1, 2, wxALL|wxGROW, 0);
277         axe->Add(axe2, 2, wxALL, 0);   //wxALIGN_CENTER_HORIZONTAL
278         axe->Add(axe3, 2, wxALL|wxGROW, 0);
279         axe->Add(axe4, 2, wxALL|wxGROW, 0);
280         axe->Add(axe5, 2, wxALL, 0);
281
282
283
284
285         wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
286         sizer->Add( axe, 1,wxALL|wxGROW,5 );
287         panel->SetSizer(sizer);
288         panel->Layout();        
289         return panel;
290
291 }
292
293 // ----------------------------------------------------------------------------
294 wxWindow* wxQuantificationWidgetCT::CreatePanel_Right(wxWindow *parent)
295 {
296         wxPanel *panel          = new wxPanel(parent,-1);
297         _splitpanel_right       = new wxSplitterWindow(panel, -1);
298         _splitpanel_right->SetMinimumPaneSize(50);
299
300         wxWindow *window2D                      = CreateView2DPanel(_splitpanel_right);
301         wxWindow *windowRightDown       = CreatePanel_Right_Down(_splitpanel_right);
302
303         _splitpanel_right->SplitHorizontally(window2D , windowRightDown,0 );
304
305
306         wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
307         sizer->Add( _splitpanel_right, 1,wxGROW,0 );
308         panel->SetSizer(sizer);
309         panel->Layout();        
310         return panel;
311 }
312
313
314 // ----------------------------------------------------------------------------
315 wxWindow* wxQuantificationWidgetCT::CreatePanel_Right_Down(wxWindow *parent)
316 {
317         wxPanel *panel                  = new wxPanel(parent,-1);
318         _splitpanel_right_down  = new wxSplitterWindow(panel, -1);
319         _splitpanel_right_down->SetMinimumPaneSize(10);
320
321         _pl_cntlHealthySick2    = new wxPanelControlsHealthySickSliceCT(_splitpanel_right_down,this);
322         _wxStenosisPanel                = CreateStenosisPanel(_splitpanel_right_down);
323
324         _splitpanel_right_down->SplitHorizontally(_pl_cntlHealthySick2,_wxStenosisPanel  ,300 );
325
326
327         wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
328         sizer->Add( _splitpanel_right_down, 1,wxGROW,0 );
329         panel->SetSizer(sizer);
330         panel->Layout();        
331         return panel;
332 }
333
334
335 // ----------------------------------------------------------------------------
336 wxWindow* wxQuantificationWidgetCT::CreatePanelStatus(wxWindow *parent)
337 {
338         wxPanel *panel = new wxPanel(parent,-1);
339
340         
341 //--    
342         marDictionary marDict;
343         
344         _st_Label1 = new wxStaticText(panel, -1, wxString(marDict.GetString(380), wxConvUTF8) ); //"Total Axis Lenght"
345         _st_Value1 = new wxStaticText(panel, -1, _T("0.00"));
346         _st_Label2 = new wxStaticText(panel, -1, wxString(marDict.GetString(390), wxConvUTF8) );//"Area"
347         _st_Value2 = new wxStaticText(panel, -1, _T("0.00"));
348         _st_Label3 = new wxStaticText(panel, -1, wxString(marDict.GetString(400), wxConvUTF8) );//"Perimeter"
349         _st_Value3 = new wxStaticText(panel, -1, _T("0.00"));
350         _st_Label6 = new wxStaticText(panel, -1, wxString(marDict.GetString(405), wxConvUTF8) );//"Minimum Diameter"
351         _st_Value6 = new wxStaticText(panel, -1, _T("0.00"));
352         _st_Label7 = new wxStaticText(panel, -1, wxString(marDict.GetString(410), wxConvUTF8) );//"Maximum Diameter"
353         _st_Value7 = new wxStaticText(panel, -1, _T("0.00"));
354         _st_Label8 = new wxStaticText(panel, -1, wxString(marDict.GetString(415), wxConvUTF8) );//"Average Diameter"
355         _st_Value8 = new wxStaticText(panel, -1, _T("0.00"));
356
357         _st_LabelRef101 = new wxStaticText(panel, -1, wxString(marDict.GetString(385), wxConvUTF8) );//"Seg. Length"
358         _st_ValueRef101 = new wxStaticText(panel, -1, _T("--"));
359         _st_LabelRef102 = new wxStaticText(panel, -1, wxString(marDict.GetString(395), wxConvUTF8) );//"Ref. Area"
360         _st_ValueRef102 = new wxStaticText(panel, -1, _T("--"));
361         _st_LabelRef103 = new wxStaticText(panel, -1, wxString(marDict.GetString(420), wxConvUTF8) );//"Ref. Average Diam."
362         _st_ValueRef103 = new wxStaticText(panel, -1, _T("--"));
363
364 //--
365         wxBoxSizer                      *status                         = new wxBoxSizer(wxHORIZONTAL);
366         wxBoxSizer                      *status0                        = new wxBoxSizer(wxVERTICAL);
367         wxBoxSizer                      *status1                        = new wxBoxSizer(wxVERTICAL);
368         wxBoxSizer                      *status2                        = new wxBoxSizer(wxVERTICAL);
369         wxBoxSizer                      *status3                        = new wxBoxSizer(wxVERTICAL);
370         wxBoxSizer                      *status6                        = new wxBoxSizer(wxVERTICAL);
371         wxBoxSizer                      *status7                        = new wxBoxSizer(wxVERTICAL);
372         wxBoxSizer                      *status8                        = new wxBoxSizer(wxVERTICAL);
373         wxBoxSizer                      *status9                        = new wxBoxSizer(wxVERTICAL);
374         wxBoxSizer                      *statusRef1                     = new wxBoxSizer(wxVERTICAL);
375         wxBoxSizer                      *statusRef2                     = new wxBoxSizer(wxVERTICAL);
376         wxBoxSizer                      *statusRef3                     = new wxBoxSizer(wxVERTICAL);
377         
378         status1->Add(_st_Label1, 1, wxALL|wxALIGN_CENTER, 5);
379         status1->Add(_st_Value1, 1, wxALL|wxALIGN_CENTER, 5);
380         status2->Add(_st_Label2, 1, wxALL|wxALIGN_CENTER, 5);
381         status2->Add(_st_Value2, 1, wxALL|wxALIGN_CENTER, 5);
382         status3->Add(_st_Label3, 1, wxALL|wxALIGN_CENTER, 5);
383         status3->Add(_st_Value3, 1, wxALL|wxALIGN_CENTER, 5);
384
385         status6->Add(_st_Label6, 1, wxALL|wxALIGN_CENTER, 5);
386         status6->Add(_st_Value6, 1, wxALL|wxALIGN_CENTER, 5);
387         status7->Add(_st_Label7, 1, wxALL|wxALIGN_CENTER, 5);
388         status7->Add(_st_Value7, 1, wxALL|wxALIGN_CENTER, 5);
389         status8->Add(_st_Label8, 1, wxALL|wxALIGN_CENTER, 5);
390         status8->Add(_st_Value8, 1, wxALL|wxALIGN_CENTER, 5);
391
392         
393         statusRef1->Add(_st_LabelRef101, 1, wxALL|wxALIGN_CENTER, 5);
394         statusRef1->Add(_st_ValueRef101, 1, wxALL|wxALIGN_CENTER, 5);
395         statusRef2->Add(_st_LabelRef102, 1, wxALL|wxALIGN_CENTER, 5);
396         statusRef2->Add(_st_ValueRef102, 1, wxALL|wxALIGN_CENTER, 5);
397         statusRef3->Add(_st_LabelRef103, 1, wxALL|wxALIGN_CENTER, 5);
398         statusRef3->Add(_st_ValueRef103, 1, wxALL|wxALIGN_CENTER, 5);
399
400
401
402         status->Add(status1             , 1, wxALL|wxEXPAND, 0);
403         status->Add(statusRef1  , 1, wxALL|wxEXPAND, 0);
404         status->Add(status2             , 1, wxALL|wxEXPAND, 0);
405         status->Add(statusRef2  , 1, wxALL|wxEXPAND, 0);
406         status->Add(status3             , 1, wxALL|wxEXPAND, 0);
407
408         status->Add(status6             , 1, wxALL|wxEXPAND, 0);
409         status->Add(status7             , 1, wxALL|wxEXPAND, 0);
410         status->Add(status8             , 1, wxALL|wxEXPAND, 0);
411         status->Add(statusRef3  , 1, wxALL|wxEXPAND, 0);
412
413
414 //--    
415         
416         wxBoxSizer * sizer = new wxBoxSizer(wxHORIZONTAL);
417         sizer->Add( status, 1,wxALL|wxEXPAND,0 );
418         panel->SetSizer(sizer);
419         panel->Layout();        
420         return panel;
421 }
422 // ----------------------------------------------------------------------------
423 wxWindow* wxQuantificationWidgetCT::CreateStenosisPanel(wxWindow *parent){
424         marDictionary marDict;
425
426         wxPanel* panel = new wxPanel(parent);
427
428         _st_Label100 = new wxStaticText(panel, -1, (wxChar)(marDict.GetString(255)) ); // "Stenosis (area)"
429         _st_Label101 = new wxStaticText(panel, -1, (wxChar)(marDict.GetString(260)) ); // "Stenosis (diameter)"
430         _st_Value100 = new wxStaticText(panel, -1, _T("--                "));
431         _st_Value101 = new wxStaticText(panel, -1, _T("--                "));
432 //      wxStaticText *_st_LabelBlanc = new wxStaticText(panel, -1, "                 ");
433
434 //EEDxx 2.6
435 //      _st_LabelBlanc->SetBackgroundColour(*wxLIGHT_GREY);
436
437 //EEDxx 2.6
438 //      panel->SetBackgroundColour(wxColour(100,0,100));
439 //      _st_Label100->SetBackgroundColour(*wxLIGHT_GREY);
440 //      _st_Label101->SetBackgroundColour(*wxLIGHT_GREY);
441 //      _st_Value100->SetBackgroundColour(*wxLIGHT_GREY);
442 //      _st_Value101->SetBackgroundColour(*wxLIGHT_GREY);
443
444
445         wxFont font(14,wxDEFAULT ,wxNORMAL,wxBOLD);
446         _st_Value100->SetFont(font);
447         _st_Value101->SetFont(font);
448
449
450
451         wxGridSizer*  gridSizer1        = new wxFlexGridSizer(1);
452         gridSizer1->Add(new wxStaticText(panel, -1, _T("                 "))    ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
453         gridSizer1->Add(_st_Value100    ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
454         gridSizer1->Add(_st_Label100    ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
455         gridSizer1->Add(new wxStaticText(panel, -1, _T("                 "))    ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
456         gridSizer1->Add(_st_Value101    ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
457         gridSizer1->Add(_st_Label101    ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
458
459         wxGridSizer*  gridSizer         = new wxFlexGridSizer(4);
460         gridSizer->Add(new wxStaticText(panel, -1, _T("                 "))     ,15, wxALIGN_LEFT , 50);
461         gridSizer->Add(new wxStaticText(panel, -1, _T("                 "))     ,15, wxALIGN_LEFT , 50);
462         gridSizer->Add(new wxStaticText(panel, -1, _T("                 "))     ,15, wxALIGN_LEFT , 50);
463         gridSizer->Add(gridSizer1               ,15, wxALIGN_LEFT , 50);
464
465         panel->SetAutoLayout(true);
466         panel->SetSizer(gridSizer);
467         panel->Layout();
468 //EEDxx 2.6
469 //      panel->SetBackgroundColour(*wxLIGHT_GREY);
470         panel->SetSize(400,300);
471         panel->SetSize( gridSizer->GetMinSize() );
472
473         return panel;
474 }
475
476 //--------------------------------------------------------
477 /*
478 void wxQuantificationWidgetCT::Set_control(){
479         marDictionary marDict;
480         
481     _wxStenosisPanel = CreateStenosisPanel();
482
483         _cb_HealthySlice        = new wxCheckBox( panel_left, ID_CHECKBOX_HEALTHY, wxT( marDict.GetString(205) )); // "Healthy slice"
484         _cb_HealthySlice->SetValue(true);
485 //EEDxx 2.6
486 //      _cb_HealthySlice->SetBackgroundColour(*wxLIGHT_GREY);
487         _cb_Perpendicular       = new wxCheckBox( panel_left, ID_CHECKBOX_PERPENDICULAR, wxT(marDict.GetString(210))); //"Perpendicular section"
488         _cb_Perpendicular->SetValue(true);
489 //EEDxx 2.6
490 //      _cb_Perpendicular->SetBackgroundColour(*wxLIGHT_GREY);
491
492         _rb_GreyScale           = new wxRadioButton( panel_left, ID_RADIOBUTTON_GREYSCALE, wxT(marDict.GetString(230)), wxDefaultPosition,wxDefaultSize,wxRB_GROUP ); //"greyscale    "
493         _rb_GreyScale->SetValue(true);
494 //EEDxx 2.6
495 //      _rb_GreyScale->SetBackgroundColour(*wxLIGHT_GREY);
496
497         _rb_Color                       = new wxRadioButton( panel_left, ID_RADIOBUTTON_COLOR, wxT(marDict.GetString(235)), wxDefaultPosition,wxDefaultSize );//"color    "
498         _rb_Color->SetValue(false);
499 //EEDxx 2.6
500 //      _rb_Color->SetBackgroundColour(*wxLIGHT_GREY);
501
502         _cb_VisibleRings        = new wxCheckBox( panel_left, ID_CHECKBOX_VISIBLE_RINGS, wxT(marDict.GetString(215)));//"Visible rings"
503         _cb_VisibleRings->SetValue(true);
504 //EEDxx 2.6
505 //      _cb_VisibleRings->SetBackgroundColour(*wxLIGHT_GREY);
506         _cb_ShowSurface         = new wxCheckBox( panel_left, ID_CHECKBOX_SHOW_SURFACE, wxT(marDict.GetString(220)));//"Show Surface"
507         _cb_ShowSurface->SetValue(true);
508 //EEDxx 2.6
509 //      _cb_ShowSurface->SetBackgroundColour(*wxLIGHT_GREY);
510
511         
512         _bt_AddContour3D                = new wxButton( panel_left, ID_BUTTON_CONTOUR, marDict.GetString(245) ,//"Add mark contour"
513                                        wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
514         _bt_CleanContour3D              = new wxButton( panel_left, ID_BUTTON_CLEAN, marDict.GetString(250) ,//"Erase mark contours"
515                                      wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
516
517         _bt_CleanAllContours3D  = new wxButton( panel_left, ID_BUTTON_CLEAN_ALL, marDict.GetString(253) ,//"Erase all mark contours"
518                                      wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
519
520         //wxSlider
521         _sl_Slice    = new wxSlider( panel_left, ID_SLIDER_SLICE        , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
522         _sl_Isovalue = new wxSlider( panel_left, ID_SLIDER_ISOVALUE     , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
523         _sl_Opacity  = new wxSlider( panel_left, ID_SLIDER_OPACITY      , 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
524 //EEDxx 2.6
525 //      _sl_Slice->SetBackgroundColour(*wxLIGHT_GREY);
526 //      _sl_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
527 //      _sl_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
528
529         // size
530         _sl_Slice->SetSize(800,16);
531         _sl_Isovalue->SetSize(300,16);
532         _sl_Opacity->SetSize(300,16);
533         
534         // Text
535         _st_Slice                       = new wxStaticText(panel_left, -1, marDict.GetString( 90) ); //"Slice "
536         _st_Isovalue            = new wxStaticText(panel_left, -1, marDict.GetString(240) ); //"Isovalue"
537         _st_Opacity                     = new wxStaticText(panel_left, -1, marDict.GetString(225) ); //"Opacity "
538
539         _txt_Position           = new wxStaticText(panel_left, -1, "  " ); //"Position "
540
541 //EEDxx 2.6
542 //      _st_Slice->SetBackgroundColour(*wxLIGHT_GREY);
543 //      _st_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
544 //      _st_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
545         
546
547         _st_Label1 = new wxStaticText(this, -1, marDict.GetString(380) ); //"Total Axis Lenght"
548         _st_Value1 = new wxStaticText(this, -1, "0.00");
549 //EEDxx 2.6
550 //      _st_Label1->SetBackgroundColour(*wxLIGHT_GREY);
551 //      _st_Value1->SetBackgroundColour(*wxLIGHT_GREY);
552         _st_Label2 = new wxStaticText(this, -1, marDict.GetString(390) );//"Area"
553         _st_Value2 = new wxStaticText(this, -1, "0.00");
554 //EEDxx 2.6
555 //      _st_Label2->SetBackgroundColour(*wxLIGHT_GREY);
556 //      _st_Value2->SetBackgroundColour(*wxLIGHT_GREY);
557         _st_Label3 = new wxStaticText(this, -1, marDict.GetString(400) );//"Perimeter"
558         _st_Value3 = new wxStaticText(this, -1, "0.00");
559 //EEDxx 2.6
560 //      _st_Label3->SetBackgroundColour(*wxLIGHT_GREY);
561 //      _st_Value3->SetBackgroundColour(*wxLIGHT_GREY);
562         _st_Label6 = new wxStaticText(this, -1, marDict.GetString(405) );//"Minimum Diameter"
563         _st_Value6 = new wxStaticText(this, -1, "0.00");
564 //EEDxx 2.6
565 //      _st_Label6->SetBackgroundColour(*wxLIGHT_GREY);
566 //      _st_Value6->SetBackgroundColour(*wxLIGHT_GREY);
567         _st_Label7 = new wxStaticText(this, -1, marDict.GetString(410) );//"Maximum Diameter"
568         _st_Value7 = new wxStaticText(this, -1, "0.00");
569 //EEDxx 2.6
570 //      _st_Label7->SetBackgroundColour(*wxLIGHT_GREY);
571 //      _st_Value7->SetBackgroundColour(*wxLIGHT_GREY);
572         _st_Label8 = new wxStaticText(this, -1, marDict.GetString(415) );//"Average Diameter"
573         _st_Value8 = new wxStaticText(this, -1, "0.00");
574 //EEDxx 2.6
575 //      _st_Label8->SetBackgroundColour(*wxLIGHT_GREY);
576 //      _st_Value8->SetBackgroundColour(*wxLIGHT_GREY);
577
578         _st_LabelRef101 = new wxStaticText(this, -1, marDict.GetString(385) );//"Seg. Length"
579         _st_ValueRef101 = new wxStaticText(this, -1, "--");
580 //EEDxx 2.6
581 //      _st_LabelRef101->SetBackgroundColour(*wxLIGHT_GREY);
582 //      _st_ValueRef101->SetBackgroundColour(*wxLIGHT_GREY);
583         _st_LabelRef102 = new wxStaticText(this, -1, marDict.GetString(395) );//"Ref. Area"
584         _st_ValueRef102 = new wxStaticText(this, -1, "--");
585 //EEDxx 2.6
586 //      _st_LabelRef102->SetBackgroundColour(*wxLIGHT_GREY);
587 //      _st_ValueRef102->SetBackgroundColour(*wxLIGHT_GREY);
588         _st_LabelRef103 = new wxStaticText(this, -1, marDict.GetString(420) );//"Ref. Average Diam."
589         _st_ValueRef103 = new wxStaticText(this, -1, "--");
590 //EEDxx 2.6
591 //      _st_LabelRef103->SetBackgroundColour(*wxLIGHT_GREY);
592 //      _st_ValueRef103->SetBackgroundColour(*wxLIGHT_GREY);
593
594         _pl_cntlHealthySick2 = new wxPanelControlsHealthySickSliceCT(panel_right_down,this);
595
596 //EEDxx 2.6
597 //    panel_left->SetBackgroundColour(*wxLIGHT_GREY);
598 //      panel_right_up->SetBackgroundColour(*wxLIGHT_GREY);
599 //      panel_right_down->SetBackgroundColour(*wxLIGHT_GREY);
600 //      panel_splitter_right->SetBackgroundColour(*wxLIGHT_GREY);
601 //      panel_splitter->SetBackgroundColour(*wxLIGHT_GREY);
602  
603 }
604 */
605 //--------------------------------------------------------
606 /*
607 void wxQuantificationWidgetCT::Do_layout()
608 {
609         
610         //Do the layout:
611         
612         wxBoxSizer                      *sizer_principal        = new wxBoxSizer(wxVERTICAL);
613         wxBoxSizer                      *status                         = new wxBoxSizer(wxHORIZONTAL);
614         
615 // EED 25 sep 2006
616 //      wxFlexGridSizer         *medium_right_up        = new wxFlexGridSizer(1,0);
617 //      wxFlexGridSizer         *medium_right_down      = new wxFlexGridSizer(1,0);
618         wxBoxSizer                  *medium_right_up    = new wxBoxSizer(wxVERTICAL);
619         wxBoxSizer                  *medium_right_down  = new wxBoxSizer(wxVERTICAL);
620
621         //MIS TESTS
622 //      wxFlexGridSizer         *right_up_div           = new wxFlexGridSizer(1,0);
623
624 // EED 25 sep 2006
625         wxBoxSizer                  *right_up_div               = new wxBoxSizer(wxVERTICAL);
626
627
628         wxBoxSizer                      *medium_left            = new wxBoxSizer(wxVERTICAL);
629
630
631         wxStaticBoxSizer        *axe                            = new wxStaticBoxSizer(new wxStaticBox(this, -1, ""), wxVERTICAL);
632
633
634 //      wxFlexGridSizer         *axe1                           = new wxFlexGridSizer(10,0);
635         wxBoxSizer                      *axe1                           = new wxBoxSizer(wxHORIZONTAL);
636
637         wxBoxSizer                      *axe2                           = new wxBoxSizer(wxHORIZONTAL);
638         wxFlexGridSizer         *axe3                           = new wxFlexGridSizer(10,0);
639         wxFlexGridSizer         *axe4                           = new wxFlexGridSizer(10,0);
640         wxBoxSizer                      *axe5                           = new wxBoxSizer(wxHORIZONTAL);
641         wxFlexGridSizer         *axe6                           = new wxFlexGridSizer(10,0);
642         wxFlexGridSizer         *axe7                           = new wxFlexGridSizer(10,0);
643         wxFlexGridSizer         *axe8                           = new wxFlexGridSizer(10,0);
644         
645         wxBoxSizer                      *status0                        = new wxBoxSizer(wxVERTICAL);
646         wxBoxSizer                      *status1                        = new wxBoxSizer(wxVERTICAL);
647         wxBoxSizer                      *status2                        = new wxBoxSizer(wxVERTICAL);
648         wxBoxSizer                      *status3                        = new wxBoxSizer(wxVERTICAL);
649         wxBoxSizer                      *status6                        = new wxBoxSizer(wxVERTICAL);
650         wxBoxSizer                      *status7                        = new wxBoxSizer(wxVERTICAL);
651         wxBoxSizer                      *status8                        = new wxBoxSizer(wxVERTICAL);
652         wxBoxSizer                      *status9                        = new wxBoxSizer(wxVERTICAL);
653         wxBoxSizer                      *statusRef1                     = new wxBoxSizer(wxVERTICAL);
654         wxBoxSizer                      *statusRef2                     = new wxBoxSizer(wxVERTICAL);
655         wxBoxSizer                      *statusRef3                     = new wxBoxSizer(wxVERTICAL);
656         
657
658         axe1->Add(_st_Slice                                     , 10, wxALL|wxEXPAND, 0);
659         axe1->Add(_sl_Slice                                     , 10, wxALL|wxEXPAND, 0);
660         axe1->Add(_txt_Position                         , 10, wxALL|wxEXPAND, 0);
661
662         axe2->Add(_cb_HealthySlice                      , 10, wxALL|wxEXPAND, 0);
663         axe2->Add(_cb_Perpendicular                     , 10, wxALL|wxEXPAND, 0);
664         axe2->Add(_cb_VisibleRings                      , 10, wxALL|wxEXPAND, 0);
665         axe2->Add(_cb_ShowSurface                       , 10, wxALL|wxEXPAND, 0);
666
667         axe3->Add(_st_Opacity                           ,  1, wxALL|wxEXPAND, 0);
668         axe3->Add(_sl_Opacity                           , 10, wxALL|wxEXPAND, 0);
669         axe3->Add(_rb_GreyScale                         , 10, wxALL|wxEXPAND, 0);
670         axe3->Add(_rb_Color                                     , 10, wxALL|wxEXPAND, 0);
671
672         axe4->Add(_st_Isovalue                          ,  1, wxALL|wxEXPAND, 0);
673         axe4->Add(_sl_Isovalue                          ,  1, wxALL|wxEXPAND, 0);
674
675         axe5->Add(_bt_AddContour3D                      ,  1                            );
676         axe5->Add(_bt_CleanContour3D            ,  1                            );
677         axe5->Add(_bt_CleanAllContours3D        ,  1                            );
678
679
680
681         status1->Add(_st_Label1, 1, wxALL|wxALIGN_CENTER, 5);
682         status1->Add(_st_Value1, 1, wxALL|wxALIGN_CENTER, 5);
683         status2->Add(_st_Label2, 1, wxALL|wxALIGN_CENTER, 5);
684         status2->Add(_st_Value2, 1, wxALL|wxALIGN_CENTER, 5);
685         status3->Add(_st_Label3, 1, wxALL|wxALIGN_CENTER, 5);
686         status3->Add(_st_Value3, 1, wxALL|wxALIGN_CENTER, 5);
687
688         status6->Add(_st_Label6, 1, wxALL|wxALIGN_CENTER, 5);
689         status6->Add(_st_Value6, 1, wxALL|wxALIGN_CENTER, 5);
690         status7->Add(_st_Label7, 1, wxALL|wxALIGN_CENTER, 5);
691         status7->Add(_st_Value7, 1, wxALL|wxALIGN_CENTER, 5);
692         status8->Add(_st_Label8, 1, wxALL|wxALIGN_CENTER, 5);
693         status8->Add(_st_Value8, 1, wxALL|wxALIGN_CENTER, 5);
694
695         
696         statusRef1->Add(_st_LabelRef101, 1, wxALL|wxALIGN_CENTER, 5);
697         statusRef1->Add(_st_ValueRef101, 1, wxALL|wxALIGN_CENTER, 5);
698         statusRef2->Add(_st_LabelRef102, 1, wxALL|wxALIGN_CENTER, 5);
699         statusRef2->Add(_st_ValueRef102, 1, wxALL|wxALIGN_CENTER, 5);
700         statusRef3->Add(_st_LabelRef103, 1, wxALL|wxALIGN_CENTER, 5);
701         statusRef3->Add(_st_ValueRef103, 1, wxALL|wxALIGN_CENTER, 5);
702
703
704
705         status->Add(status1             , 1, wxALL|wxEXPAND, 0);
706         status->Add(statusRef1  , 1, wxALL|wxEXPAND, 0);
707         status->Add(status2             , 1, wxALL|wxEXPAND, 0);
708         status->Add(statusRef2  , 1, wxALL|wxEXPAND, 0);
709         status->Add(status3             , 1, wxALL|wxEXPAND, 0);
710
711         status->Add(status6             , 1, wxALL|wxEXPAND, 0);
712         status->Add(status7             , 1, wxALL|wxEXPAND, 0);
713         status->Add(status8             , 1, wxALL|wxEXPAND, 0);
714         status->Add(statusRef3  , 1, wxALL|wxEXPAND, 0);
715
716         
717         axe->Add(axe1, 2, wxALL|wxEXPAND, 0);
718         axe->Add(axe2, 2, wxALL|wxEXPAND, 0);   //wxALIGN_CENTER_HORIZONTAL
719         axe->Add(axe3, 2, wxALL|wxEXPAND, 0);
720         axe->Add(axe4, 2, wxALL|wxEXPAND, 0);
721         axe->Add(axe6, 2, wxALL|wxEXPAND, 0);
722         axe->Add(axe7, 2, wxALL|wxEXPAND, 0);
723         axe->Add(axe8, 2, wxALL|wxEXPAND, 0);
724         axe->Add(axe5, 2);
725         
726
727 //      right_up_div->Add(_2DWorld, 1, wxALL|wxEXPAND, 5);
728         right_up_div->Add(panel_rightm_up, 1, wxALL|wxEXPAND, 5);
729         medium_left->Add(_3DWorld                                       , 1, wxEXPAND, 0);
730         medium_left->Add(axe                                            , 0, wxALL|wxEXPAND, 0);
731         medium_right_up->Add( right_up_div      , 1, wxALL|wxEXPAND, 5);
732 //      medium_right_up->Add(           , 2, wxALL|wxEXPAND, 5);
733         medium_right_down->Add(_pl_cntlHealthySick2     , 1, wxALL, 5);
734         medium_right_down->Add(_wxStenosisPanel         , 1, wxALL, 5);
735
736
737         
738         
739         panel_left->SetAutoLayout(true);
740         panel_left->SetSizer(medium_left);
741         panel_left->Layout();
742
743         panel_right_up->SetAutoLayout(true);
744         panel_right_up->SetSizer(medium_right_up);
745         panel_right_up->Layout();
746
747         panel_right_down->SetAutoLayout(true);
748         panel_right_down->SetSizer(medium_right_down);
749         panel_right_down->Layout();
750
751     panel_splitter_right->SetMinimumPaneSize( 50 );
752     panel_splitter_right->SplitHorizontally( panel_right_up, panel_right_down, 400 );
753
754
755
756     panel_splitter->SetMinimumPaneSize( 50 );
757     panel_splitter->SplitVertically( panel_left, panel_splitter_right, 420 );
758
759         
760         sizer_principal->Add(panel_splitter, 1, wxALL|wxEXPAND, 0);
761         sizer_principal->Add(status, 0, wxALL|wxEXPAND, 0);
762         
763         this->SetAutoLayout(true);
764         this->SetSizer(sizer_principal);
765         this->Layout();
766
767 //EEDxx2.4
768 //      FitInside();
769 }
770
771 */
772
773 //--------------------------------------------------------
774 void wxQuantificationWidgetCT::Set_Data( )
775 {
776         _axis_index                             = -1;
777         _given_points                   = 0;
778         _nClicks                                = 0;
779         _quantifing                             = 0;
780         
781
782         
783         _shown                                  = 0;
784         _quant_shown                    = 0;
785         
786         _actual_area                    = 0.00;
787         _actual_peri                    = 0.00;
788         _actual_darea                   = 0.00;
789         _actual_dperi                   = 0.00;
790         _actual_dmax                    = 0.00;
791         _actual_dmin                    = 0.00;
792         _actual_davg                    = 0.00;
793         _actual_sten                    = 0.00;
794         _actual_partial                 = 0.00;
795         
796
797 }
798
799
800
801
802 //--------------------------------------------------------
803 void wxQuantificationWidgetCT::Forget( )
804 {
805         _shown = false;
806 }
807
808 // ----------------------------------------------------------------------------
809 void wxQuantificationWidgetCT::ShowMARACASData( marInterfaceCT* mar )
810 {
811         double        min, max;
812         vtkImageData* imagedata;
813         int nos;
814         int actualQuant=-1;
815         
816         wxBusyCursor wait;
817         _mar = mar;
818         
819         _mar->prepareQuantification();
820         nos = _mar->getNumberOfSlices();
821
822         //MAZV se a�ade para manejo de contornos manuales
823         for (int i = 0; i < nos; i++)
824         {
825                 _manContours.push_back(NULL);
826         }
827
828
829         actualQuant = (int) (nos-1)/2 ;
830         imagedata = _mar->getSliceImage(actualQuant);
831         
832         _mar->setActualQuant( actualQuant ) ;
833         _mar->getMinMax(min, max);
834         
835         
836         _3DWorld->ShowMARACASDataAndAxeCT( mar );
837         _3DWorld->InitCameraReset( );
838 //      _2DWorld->ConstructVTK( imagedata );
839         
840
841         ConfigureVTK( new marImageData(imagedata) );
842         
843         // GUI
844         _sl_Isovalue->SetRange( (int)min, (int)max);
845         _sl_Isovalue->SetValue( (int)(max/4) );
846         _sl_Opacity->SetValue( 50 );
847         Reset_sl_Slider();
848
849 // EED 02Dic2006
850 //      int ww1,hh1;
851 //      int ww2,hh2;
852 //      int wwT,hhT;
853 //      int ss;
854 //      this->GetSize(&wwT,&hhT);
855 //      _wxStenosisPanel->GetSize(&ww1,&hh1);
856 //      _pl_cntlHealthySick2->GetSize(&ww2,&hh2);
857
858 //      ss=hhT-(hh1+hh2+85);
859
860 //      panel_splitter_right->SetSashPosition(ss,true);
861
862         _splitPanelPrincipal    -> SetSashPosition(600,true);
863         _splitpanel_left                -> SetSashPosition(360,true);
864         _splitpanel_right               -> SetSashPosition(200,true);
865         _splitpanel_right_down  -> SetSashPosition(230,true);
866 }
867 //----------------------------------------------------------------------------
868 void wxQuantificationWidgetCT::Reset_sl_Slider()
869 {
870         int nos = _mar->getNumberOfSlices();
871         
872         _sl_Slice->SetRange(0, nos-1);
873         _sl_Slice->SetValue( (nos-1)/2 );
874
875 }
876 //----------------------------------------------------------------------------
877 void wxQuantificationWidgetCT::SetSlider_Isovalue_Opacity(int isovalue,int opacity){
878         _sl_Isovalue->SetValue(isovalue);
879         _sl_Opacity->SetValue(opacity);
880         _3DWorld->SetSurfaceIsoValue( isovalue );
881         _3DWorld->SetSurfaceOpacity( opacity );
882 }
883 //----------------------------------------------------------------------------
884 void wxQuantificationWidgetCT::OnShowSurface_CB(wxCommandEvent& event)
885 {
886     _3DWorld->SetSurfaceVisibility( _cb_ShowSurface->GetValue() );
887 }
888 // ---------------------------------------------------------------------------
889 void wxQuantificationWidgetCT::ResetAxis(){     
890         Reset_sl_Slider();
891         _mar->setActualQuant( _sl_Slice->GetValue() );
892
893         _3DWorld->Hide3DHealthySliceActor();
894         _mar->setHealthySlice( 0,-1,0 );
895         _mar->setActualQuant( _sl_Slice->GetValue() );
896
897 }
898 // ---------------------------------------------------------------------------
899 void wxQuantificationWidgetCT::RefreshAxis( ){  
900         int actualQuant = _mar->getActualQuant();
901         vtkImageData* imagedata;
902         vtkProbeFilter* image3D;
903         vtkPolyData* vtkPolydata_2Dcontour;
904
905 // EED 26 sep 2006
906 //      vtkPoints* vtkPoints_2DDiameterMin;
907 //      vtkPoints* vtkPoints_2DDiameterMax;
908
909         int contours = _mar->getNumberOfContours(actualQuant);
910
911         image3D                                 = _mar->get3DSlice                      ( actualQuant );
912         imagedata                               = _mar->getSliceImage           ( actualQuant );
913
914         
915         _contourViewer->DeleteContours();
916         _lineViewer->DeleteLines();
917         _pointViewer->DeletePoints();
918         
919
920
921         
922         _pointViewer->CreateNewPoint(64,64,0);
923         for (int i = 0; i < contours; i++)
924         {
925                 ;
926                 vtkPolydata_2Dcontour   = _mar->get2Dcontour( actualQuant, i );
927                 
928 //              vtkPoints_2DDiameterMin = _mar->get2DDiameterMin        ( actualQuant, 0 );
929 //              vtkPoints_2DDiameterMax = _mar->get2DDiameterMax        ( actualQuant, 0 );
930
931                 if (_cb_VisibleRings->GetValue()==true){
932 //                      _2DWorld->SetContour( vtkPolydata_2Dcontour );
933                         _contourViewer->CreateNewContour(vtkPolydata_2Dcontour,  _mar->getContourType(actualQuant, i));
934 //                      _2DWorld->SetDiameterMin( vtkPoints_2DDiameterMin , true );
935 //                      _2DWorld->SetDiameterMax( vtkPoints_2DDiameterMax , true );
936                 }
937         }
938
939         int puntos = _mar->getPointSize();
940
941         for (int j = 0; j < puntos; j++)
942         {
943                 marPoint *p = _mar->getPoint(j);
944                 _pointViewer->CreateNewPoint(p->getX(),p->getY(),p->getType());
945         }
946         
947
948         _3DWorld->SetImage(image3D);
949         _3DWorld->Render( );
950 //      _2DWorld->SetImage(imagedata);
951         
952         RefreshView( new marImageData(imagedata) );
953
954         
955
956         
957         showVariables( );
958
959
960
961
962 }
963
964
965 // ----------------------------------------------------------------------------
966 void wxQuantificationWidgetCT::MoveSlider(int actualQuant){
967
968         if (actualQuant!=_bak_ActualSlice2)
969         {
970            _bak_ActualSlice2=actualQuant;
971                 if (_bak_ActualSlice!=-1){
972                         SetManualContour_ReplaceContour();
973                         SetManualContour_2DWorld(false);
974                 }
975                 _mar->setActualQuant( actualQuant );
976                 RefreshAxis();
977
978 // EED 17 NOV 2006
979                 double *p;
980                 p = _mar->GetExperiment()->getAxis()->getPoints( actualQuant );
981                 double spc[3];
982                 _mar->getDynData()->GetMarImageData()->GetImageData()->GetSpacing(spc);
983                 int nX=0,nY=0,nZ=0;
984                 nX = _mar->getDynData()->GetMarImageData()->GetXOriginal( (int)(p[0]/spc[0]) );
985                 nY = _mar->getDynData()->GetMarImageData()->GetYOriginal( (int)(p[1]/spc[1]) );
986                 nZ = _mar->getDynData()->GetMarImageData()->GetZOriginal( (int)(p[2]/spc[2]) );
987                 char resultText[50],temp[50];
988                 strcpy(resultText," \n        (");
989
990 //              ltoa ((int)nX,temp,10);
991                 sprintf(temp,"%d",(int)nX);
992
993                 strcat(resultText,temp);
994                 strcat(resultText,",");
995
996 //              ltoa ((int)nY,temp,10);
997                 sprintf(temp,"%d",(int)nY);
998
999                 strcat(resultText,temp);
1000                 strcat(resultText,",");
1001
1002 //              ltoa ((int)nZ,temp,10);
1003                 sprintf(temp,"%d",(int)nZ);
1004
1005                 strcat(resultText,temp);
1006                 strcat(resultText,")");
1007                 _txt_Position->SetLabel( wxString(resultText, wxConvUTF8) );
1008         } // 
1009 }
1010 // ----------------------------------------------------------------------------
1011 void wxQuantificationWidgetCT::OnSliderSliceScroll(wxScrollEvent& event){
1012         MoveSlider( event.GetPosition() );
1013 }
1014
1015 // ----------------------------------------------------------------------------
1016 double wxQuantificationWidgetCT::GetStenosisDiameter(int sickSlice){
1017         double healthyAverageDiameter = _mar->getReferenceAverDiam() ;
1018         marContour *marcontourSick = _mar->getContour( sickSlice, sickSlice );
1019         return doubleStenosis( healthyAverageDiameter , marcontourSick->getMinimumDiameter() );
1020 }
1021 // ----------------------------------------------------------------------------
1022 double wxQuantificationWidgetCT::GetStenosisArea( int sickSlice){
1023         double healthyArea = _mar->getReferenceArea();
1024         marContour *marcontourSick = _mar->getContour( sickSlice, sickSlice );
1025         return doubleStenosis( healthyArea , marcontourSick->getArea() );
1026 }
1027 // ----------------------------------------------------------------------------
1028
1029
1030
1031
1032
1033
1034 // ----------------------------------------------------------------------------
1035 void wxQuantificationWidgetCT::showVariables()
1036 {
1037 // EED 26 sep 2006
1038 //      marContour* marcontour;
1039
1040         int actualQuant;
1041         int healthySlice; 
1042         int healthySliceStart; 
1043         int healthySliceEnd; 
1044         
1045         actualQuant = _mar->getActualQuant( );
1046 //      marcontour=_mar->getContour( actualQuant, actualQuant );
1047         
1048         wxString tmpString;
1049
1050         tmpString.Printf( _T("%.2f mm")   , 20)/*_mar->getTotalLength() )*/;             _st_Value1->SetLabel(tmpString);
1051
1052
1053         tmpString.Printf( _T("%.2f mm^2") , 20)/*marcontour->getArea())*/;                                               _st_Value2->SetLabel(tmpString);
1054         tmpString.Printf( _T("%.2f mm")   , 20)/*marcontour->getPerimeter())*/;                          _st_Value3->SetLabel(tmpString);
1055
1056         tmpString.Printf( _T("%.2f mm")   , 20)/*marcontour->getMinimumDiameter())*/;                    _st_Value6->SetLabel(tmpString);
1057         tmpString.Printf( _T("%.2f mm")   , 20)/*marcontour->getMaximumDiameter())*/;                    _st_Value7->SetLabel(tmpString);
1058         tmpString.Printf( _T("%.2f mm")   , 20)/*marcontour->getAverageDiameter())*/;                    _st_Value8->SetLabel(tmpString);
1059
1060         healthySlice            = _mar->getHealthySlice( );
1061         healthySliceStart       = _mar->getHealthySliceStart( );
1062         healthySliceEnd         = _mar->getHealthySliceEnd( );
1063         if ( (healthySlice!=-1) ) {
1064                 _st_Value100->SetLabel( strStenosis( GetStenosisArea(actualQuant)     ) );
1065                 _st_Value101->SetLabel( strStenosis( GetStenosisDiameter(actualQuant) ) );
1066                 tmpString.Printf( _T("%.2f mm^2") , _mar->getReferenceArea() );  _st_ValueRef102->SetLabel(tmpString);
1067                 tmpString.Printf( _T("%.2f mm")   , _mar->getReferenceAverDiam() ); _st_ValueRef103->SetLabel(tmpString);
1068                 //CAMBIAR ESTOS DOS
1069         } else {
1070                 _st_Value100->SetLabel(_T("--"));
1071                 _st_Value101->SetLabel(_T("--"));
1072                 _st_ValueRef101->SetLabel(_T("--"));
1073                 _st_ValueRef102->SetLabel(_T("--"));
1074                 _st_ValueRef103->SetLabel(_T("--"));
1075         }
1076
1077         int startSlice  = _mar->getQuantStart();
1078         int finishSlice = _mar->getQuantFinish();
1079     if ((startSlice!=-1) && (finishSlice!=-1)){
1080                 tmpString.Printf( _T("%.2f mm")   , _mar->getSubAxisLength() );  _st_ValueRef101->SetLabel(tmpString);
1081         } else {
1082                 _st_ValueRef101->SetLabel(_T("--"));
1083         }
1084
1085 }
1086 // ----------------------------------------------------------------------------
1087 double wxQuantificationWidgetCT::doubleStenosis(double healthy, double sick){
1088         double result;
1089         if (healthy==0) {       
1090                 result=-1;      
1091         } else {  
1092                 result = (    (healthy-sick)/healthy) * 100 ;   
1093         }
1094
1095         return result;
1096 }
1097 // ----------------------------------------------------------------------------
1098 wxString wxQuantificationWidgetCT::strStenosis(double stenosis){
1099         wxString tmpString;
1100         if (stenosis==-1) {
1101                 tmpString.Printf(_T("%d"),-1);  
1102         } else {
1103                 tmpString.Printf(_T("%.2f"), stenosis );        
1104         }
1105         return tmpString + _T(" \%");
1106 }
1107 // ----------------------------------------------------------------------------
1108 void wxQuantificationWidgetCT::OnSliderIsovalueScroll(wxScrollEvent& event)
1109 {
1110         wxBusyCursor wait;
1111         _3DWorld->SetSurfaceIsoValue( event.GetPosition() );
1112 }
1113 // ----------------------------------------------------------------------------
1114 void wxQuantificationWidgetCT::OnSliderOpacityScroll(wxScrollEvent& event)
1115 {
1116         _3DWorld->SetSurfaceOpacity( event.GetPosition() );
1117 }
1118 //----------------------------------------------------------------------------
1119 void wxQuantificationWidgetCT::AddAxisActors(){
1120
1121         marAxis *maraxis = _mar->getAxis( );
1122         if (maraxis!=NULL) _3DWorld->SetAxis( maraxis->Draw( ) );
1123
1124 }
1125 //----------------------------------------------------------------------------
1126 void wxQuantificationWidgetCT::Clean3D( bool eraseAxe )
1127 {
1128         _first_quant = -1;
1129         _last_quant = -1;
1130
1131         _quant_shown = false;
1132         
1133         _3DWorld->InitListContourActor( -1,_mar->getNumberOfSlices() );
1134         if (eraseAxe==true) { _3DWorld->RemoveAxis(); }
1135
1136
1137         
1138
1139 }
1140
1141 void wxQuantificationWidgetCT::Reload_Axis(bool mask , bool step )
1142 {
1143
1144 }
1145
1146
1147 void wxQuantificationWidgetCT::Show_Max_Min_Diameters()
1148 {
1149
1150 }
1151
1152
1153
1154 int wxQuantificationWidgetCT::Back( )
1155 {
1156         int ret;
1157         
1158         ret = _shown;
1159         _shown = 0;
1160         return ret;
1161 }
1162
1163
1164 void wxQuantificationWidgetCT::Set_plane_3D( double  x, double y )
1165 {
1166
1167 }
1168
1169
1170
1171
1172
1173 void  wxQuantificationWidgetCT::Point_Intensity(double x, double y)
1174 {
1175
1176 }
1177
1178
1179 void wxQuantificationWidgetCT::CleanContour()
1180 {
1181
1182 }
1183
1184
1185 //-----------------------------------------------------------------
1186 // Button
1187 void wxQuantificationWidgetCT::Do_Quant()
1188 {
1189
1190 }
1191
1192
1193 //-----------------------------------------------------------------
1194 void wxQuantificationWidgetCT::OnContour_BT(wxCommandEvent& event){
1195         int slice=_sl_Slice->GetValue();
1196     _3DWorld->Set3DContourActor( slice , _mar->get3Dcontour(slice, slice) , _cb_VisibleRings->GetValue() ,0 );
1197 }
1198 //-----------------------------------------------------------------
1199 void wxQuantificationWidgetCT::OnClean_BT(wxCommandEvent& event){
1200         int slice=_sl_Slice->GetValue();
1201         _3DWorld->Erase3DContourActor( slice );
1202 }
1203
1204 //-----------------------------------------------------------------
1205 void wxQuantificationWidgetCT::OnCleanAll_BT(wxCommandEvent& event){
1206         marDictionary marDict;
1207         char tmp[256];
1208
1209         wxMessageDialog *wxdiag;
1210         strcpy( tmp , marDict.GetString(870) ); strcat(tmp,"\n"); strcat(tmp,marDict.GetString(875));
1211         wxdiag= new wxMessageDialog(this, wxString(tmp, wxConvUTF8), wxString(marDict.GetString(865), wxConvUTF8) , wxOK | wxCANCEL);//"This option erase all 3D contours.\n Do you want to continue?","Alert"
1212     if ( wxdiag->ShowModal() == wxID_OK ) {
1213                 _3DWorld->InitListContourActor( 0, _mar->getNumberOfSlices() );
1214         }            
1215         wxdiag->Destroy();
1216 }
1217
1218
1219
1220
1221
1222 //------------------------------------------------------------------------
1223 void wxQuantificationWidgetCT::DetectHealthySickSlice( bool minSurf , bool maxSurf ){   
1224
1225         //ESTE ES EL METODO QUE SE MODIFICA PARA CALCULAR LA ESTENOSIS 
1226         /*
1227         wxBusyCursor wait;
1228         double          stenosis;
1229         double          areaB;
1230         int                     iSlice;
1231         int                     startslice;
1232         int                     endslice;
1233         double          maxStenosis                     =       -9999999;
1234         double          maxArea                         =       -9999999;
1235         int                     sickSlice                       =       0;
1236         int                     healthySlice            =       0;
1237         int                     sizeHealthyRegion       =       GetSizeHealthyRegion();
1238         int                     analysisTypeStenosis=   GetAnalysisTypeStenosis();
1239
1240
1241
1242
1243
1244
1245         GetSliceLimites(0,startslice,endslice);
1246
1247     if (startslice>endslice){
1248                 int temp=endslice;
1249                 endslice=startslice;
1250                 startslice=temp;
1251         }
1252
1253         int backSlice;
1254         if (minSurf==false) { backSlice = _sl_Slice->GetValue(); }
1255
1256         for (iSlice=startslice; iSlice<=endslice;iSlice++){
1257
1258                 if (minSurf==true){
1259                         // this is equal to the minimum surface/diameter
1260                         if (analysisTypeStenosis==1 ){ stenosis = GetStenosisDiameter(iSlice);  }
1261                         if (analysisTypeStenosis==2 ){ stenosis = GetStenosisArea(iSlice);              }
1262                 }
1263
1264                 if (maxSurf==true){
1265                         areaB = _mar->getAverageArea(iSlice-sizeHealthyRegion,iSlice+sizeHealthyRegion);
1266                         _3DWorld->InitListContourActor( 0, _mar->getNumberOfSlices() );
1267
1268                 }
1269
1270                 if ((stenosis>maxStenosis) &&(minSurf==true)){
1271                         maxStenosis=stenosis;
1272                         sickSlice=iSlice;
1273                 }
1274                 if ((areaB>maxArea) && (maxSurf==true)){
1275                         maxArea=areaB;
1276                         healthySlice=iSlice;
1277                 }
1278                 MoveSlider( iSlice );
1279                 _sl_Slice->SetValue( iSlice );
1280         }
1281
1282
1283
1284         if (minSurf==true){
1285                 MoveSlider( sickSlice );
1286                 _sl_Slice->SetValue( sickSlice );
1287         }
1288
1289         if (maxSurf==true){
1290                 MoveSlider( healthySlice );
1291                 _sl_Slice->SetValue( healthySlice );
1292         }
1293 */
1294 }
1295
1296
1297
1298
1299 //------------------------------------------------------------------------
1300 int wxQuantificationWidgetCT::GetHealthySlice(){
1301         return _mar->getHealthySlice( );
1302 }
1303 //------------------------------------------------------------------------
1304 void wxQuantificationWidgetCT::SetHealthySlice(int healthySlice){       
1305         if (healthySlice==-1) {
1306                 healthySlice=_sl_Slice->GetValue();
1307         }
1308         /*int sizeHealthyRegion = GetSizeHealthyRegion();
1309         int maxSlider                   = GetMaxActualSlice();
1310         int healthySliceStart   = healthySlice - sizeHealthyRegion;
1311         int healthySliceEnd             = healthySlice + sizeHealthyRegion;
1312         if (healthySliceStart < 0)         { healthySliceStart = 0;                     }
1313         if (healthySliceEnd   < 0)         { healthySliceEnd   = 0;                     }
1314         if (healthySliceStart > maxSlider) { healthySliceStart = maxSlider; }
1315         if (healthySliceEnd   > maxSlider) { healthySliceEnd   = maxSlider; }
1316         _mar->setHealthySlice( healthySliceStart, healthySlice , healthySliceEnd);
1317
1318         _3DWorld->Set3DHealthySliceActor(  );
1319         _3DWorld->Show3DHealthySliceActor();
1320         _cb_HealthySlice->SetValue(true);
1321         _3DWorld->InitListContourActor( 1, _mar->getNumberOfSlices() );
1322         int iHealthySlice;
1323         for ( iHealthySlice=healthySliceStart ; iHealthySlice<=healthySliceEnd ; iHealthySlice++){
1324                 _3DWorld->Set3DContourActor( iHealthySlice , _mar->get3Dcontour(iHealthySlice, iHealthySlice) , true ,1);
1325         }
1326         showVariables();*/
1327 }
1328
1329
1330
1331
1332
1333 //--------------------------------------------------------------------
1334 // CheckBox
1335 void wxQuantificationWidgetCT::OnHealthySlice_CB(wxCommandEvent& event)
1336 {
1337
1338
1339         int healthySlice = _mar->getHealthySlice( );
1340         if (healthySlice!=-1) {
1341                 if ( _cb_HealthySlice->GetValue() )
1342                         _3DWorld->Show3DHealthySliceActor();
1343                 else
1344                         _3DWorld->Hide3DHealthySliceActor();
1345         }
1346 }
1347
1348
1349 //--------------------------------------------------------------------
1350 void wxQuantificationWidgetCT::OnVisibleRing_CB(wxCommandEvent& event){
1351         if ( _cb_VisibleRings->GetValue() ){
1352                 _3DWorld->Show3DContourActor();
1353 //              _2DWorld->Show2DContourDiameters();
1354                 RefreshAxis();
1355         } else {
1356                 _3DWorld->Hide3DContourActor();
1357 //              _2DWorld->Hide2DContourDiameters();
1358         }
1359
1360
1361 }
1362 //--------------------------------------------------------------------
1363 void wxQuantificationWidgetCT::OnPerpendicular_CB(wxCommandEvent& event)
1364 {
1365         if ( _cb_Perpendicular->GetValue() )
1366                 _3DWorld->Show3DSliceActor();
1367         else
1368                 _3DWorld->Hide3DSliceActor();
1369 }
1370 //--------------------------------------------------------------------
1371 // RadioButton
1372 void wxQuantificationWidgetCT::OnGreyScale_RB(wxCommandEvent& event){
1373         if ( _rb_GreyScale->GetValue() ){
1374                 _3DWorld->SetBWLookUp();
1375         }
1376 }
1377 //--------------------------------------------------------------------
1378 void wxQuantificationWidgetCT::OnColor_RB(wxCommandEvent& event){
1379         if ( _rb_Color->GetValue() ){
1380                 _3DWorld->SetColorLookUp();
1381         }
1382 }
1383 //--------------------------------------------------------------------
1384 void wxQuantificationWidgetCT::CallBackOnLeftDClick( wxMouseEvent& event ){
1385
1386         double pp[3], cp[3];
1387         _3DWorld->GetLast3DClickPoint(pp,cp);
1388
1389         int i,iback,maxPoints;
1390         double *c, cc[3];
1391         double dist,distMin=-1;
1392         iback=-1;
1393         
1394     marAxis *maraxis = _mar->getAxis( );
1395         maxPoints = maraxis->getNumberOfSplinePoints();
1396         for ( i=0 ; i<maxPoints ; i++ ){
1397                 c = maraxis->getSplinePoint(i); 
1398                 cc[0]=c[0]-pp[0];
1399                 cc[1]=c[1]-pp[1];
1400                 cc[2]=c[2]-pp[2];
1401                 dist=sqrt( cc[0]*cc[0] + cc[1]*cc[1] + cc[2]*cc[2] );
1402                 if ((distMin==-1) || (dist<distMin)) {
1403                         iback=i;
1404                         distMin=dist;
1405                 }
1406         }
1407         _sl_Slice->SetValue(iback);
1408         MoveSlider(iback);
1409
1410 }
1411
1412 //--------------------------------------------------------------------
1413 void wxQuantificationWidgetCT::CallBackOnMouseWheel( wxMouseEvent& event ){
1414         int slice=_sl_Slice->GetValue();
1415         if (event.GetWheelRotation()>0){ slice++; }
1416         if (event.GetWheelRotation()<0){ slice--; }
1417     if (slice < _sl_Slice->GetMin() ) { slice=_sl_Slice->GetMin(); }
1418     if (slice > _sl_Slice->GetMax() ) { slice=_sl_Slice->GetMax(); }
1419     _sl_Slice->SetValue(slice);
1420         MoveSlider(slice);
1421 }
1422 //--------------------------------------------------------------------
1423 int wxQuantificationWidgetCT::GetActualSlice(){
1424         return _sl_Slice->GetValue();
1425 }
1426 //--------------------------------------------------------------------
1427 void wxQuantificationWidgetCT::SetActualSlice(int slice){
1428         _sl_Slice->SetValue(slice);
1429         MoveSlider(slice);
1430 }
1431 //--------------------------------------------------------------------
1432 int wxQuantificationWidgetCT::GetMaxActualSlice(){
1433         return _sl_Slice->GetMax();
1434 }
1435 //--------------------------------------------------------------------
1436 int  wxQuantificationWidgetCT::GetSizeHealthyRegion(){
1437         return _sizeHealthyRegion;
1438 }
1439 //--------------------------------------------------------------------
1440 void wxQuantificationWidgetCT::SetSizeHealthyRegion(int size){
1441         _sizeHealthyRegion = size;
1442 }
1443 //--------------------------------------------------------------------
1444 void wxQuantificationWidgetCT::GetHealthySliceRange(int &healthySliceStart,int &healthySliceEnd){
1445         healthySliceStart       = _mar->getHealthySliceStart( );
1446         healthySliceEnd         = _mar->getHealthySliceEnd( );
1447         
1448 }
1449 //--------------------------------------------------------------------
1450 void wxQuantificationWidgetCT::Set3DRegionSliceActor( int type, int k1,int k2 ){
1451         _3DWorld->Set3DRegionSliceActor(type,k1,k2);
1452 }
1453 //--------------------------------------------------------------------
1454 void wxQuantificationWidgetCT::Set3DStartRegionSliceActor( int type, int k){
1455 //      _3DWorld->Set3DStartRegionSliceActor(type,k);
1456 }
1457 //--------------------------------------------------------------------
1458 void wxQuantificationWidgetCT::Set3DEndRegionSliceActor( int type, int k){
1459 //      _3DWorld->Set3DEndRegionSliceActor(type,k);
1460 }
1461 //--------------------------------------------------------------------
1462 void wxQuantificationWidgetCT::Show3DRegionSliceActor( int type ){
1463         _3DWorld->Show3DRegionSliceActor(type);
1464 }
1465 //--------------------------------------------------------------------
1466 void wxQuantificationWidgetCT::Show3DStartRegionSliceActor( int type ){
1467         _3DWorld->Show3DStartRegionSliceActor(type);
1468 }
1469 //--------------------------------------------------------------------
1470 void wxQuantificationWidgetCT::Show3DEndRegionSliceActor( int type ){
1471         _3DWorld->Show3DEndRegionSliceActor(type);
1472 }
1473 //--------------------------------------------------------------------
1474 void wxQuantificationWidgetCT::Hide3DRegionSliceActor( int type ){
1475         _3DWorld->Hide3DRegionSliceActor(type);
1476 }
1477 //--------------------------------------------------------------------
1478 void wxQuantificationWidgetCT::Hide3DStartRegionSliceActor( int type ){
1479         _3DWorld->Hide3DStartRegionSliceActor(type);
1480 }
1481 //--------------------------------------------------------------------
1482 void wxQuantificationWidgetCT::Hide3DEndRegionSliceActor( int type ){
1483         _3DWorld->Hide3DEndRegionSliceActor(type);
1484 }
1485 //--------------------------------------------------------------------
1486 void wxQuantificationWidgetCT::GetSliceLimites(int type, int &sliceStart, int &sliceEnd){
1487         _3DWorld->GetSliceLimites(type,sliceStart,sliceEnd);
1488 }
1489 //--------------------------------------------------------------------
1490 int wxQuantificationWidgetCT::GetAnalysisTypeStenosis(){
1491         return _3DWorld->GetAnalysisTypeStenosis();
1492 }
1493 //--------------------------------------------------------------------
1494 void wxQuantificationWidgetCT::SetAnalysisTypeStenosis(int analysisTypeStenosis){
1495         _3DWorld->SetAnalysisTypeStenosis(analysisTypeStenosis);
1496 }
1497 //--------------------------------------------------------------------
1498 void wxQuantificationWidgetCT::SetManualContour_2DWorld(bool ok){
1499
1500         if (ok==false){ 
1501 //              _2DWorld->SetState(1);
1502 //              _2DWorld->EraseManualContour();
1503         }
1504         if (ok==true){  
1505         //      _2DWorld->SetState(2);
1506         //      _2DWorld->CreateNewManualContour();
1507         }
1508
1509 }
1510 //--------------------------------------------------------------------
1511 //TODO: SIM - MODIFICAR PARA VARIOS CONTORNOS
1512 void wxQuantificationWidgetCT::SetManualContour_AddPoint_2DWorld(){
1513         _bak_ActualSlice        = _sl_Slice->GetValue();
1514 //      _2DWorld->Hide2DContourDiameters();
1515         //ESTE NO EXISTE
1516         _mar->EraseContour(_bak_ActualSlice);
1517         
1518         _3DWorld->Erase3DContourActor( _bak_ActualSlice );
1519
1520 //      _2DWorld->SetStateManualContour(0);
1521 }
1522 //--------------------------------------------------------------------
1523 void wxQuantificationWidgetCT::SetManualContour_InsertPoint_2DWorld(){
1524 //      _2DWorld->SetStateManualContour(2);
1525 }
1526 //--------------------------------------------------------------------
1527 void wxQuantificationWidgetCT::SetManualContour_ErasePoint_2DWorld(){
1528 //      _2DWorld->SetStateManualContour(3);
1529 }
1530 //--------------------------------------------------------------------
1531 void wxQuantificationWidgetCT::SetManualContour_MovePoint_2DWorld(){
1532 //      _2DWorld->SetStateManualContour(4);
1533 }
1534 //--------------------------------------------------------------------
1535 void wxQuantificationWidgetCT::SetManualContour_ReplaceContour(){
1536 /*      if (_bak_ActualSlice!=-1){
1537                 int size                = _2DWorld->GetNumberOfPointsSplineManualContour();
1538                 double *vx              = _2DWorld->GetVectorPointsXManualContour();
1539                 double *vy              = _2DWorld->GetVectorPointsYManualContour();
1540                 
1541                 _mar->replaceContour2D(_bak_ActualSlice,size,vx,vy);
1542                 free(vx);
1543                 free(vy);
1544                 RefreshAxis();
1545                 _bak_ActualSlice=-1;
1546         }*/
1547         //TODO El remplazo de contornos debe cambiar
1548 }
1549 //------------------------------------------------------------------------
1550 kVolume* wxQuantificationWidgetCT::GetVolumeAxisExtended(int wz1,int wz2)
1551 {
1552         // Create Volume
1553         vtkImageData *imagedata;
1554         imagedata=_mar->getSliceImage(wz1);
1555         int dims[3];
1556         imagedata->GetDimensions (dims);
1557         int wx=dims[0];
1558         int wy=dims[1];
1559         int wz  = wz2-wz1+1;
1560         kVolume *kvol =new kVolume( kVolume::USHORT, wx, wy, wz,1, 1, 1, malloc(sizeof(unsigned short)*wx*wy*wz ) );
1561         vtkImageData *vol = kvol->castVtk();
1562
1563         // Fill Volume
1564         int i;
1565         for (i=wz1;i<=wz2;i++)
1566         {
1567                 // GetImage
1568                 imagedata=_mar->getSliceImage(i);
1569
1570                 // InsertImage
1571              void *p_imagedata  = imagedata->GetScalarPointer(0,0,0);
1572                  void *p_vol            = vol->GetScalarPointer(0,0,i-wz1);
1573          memcpy( p_vol, p_imagedata , sizeof(unsigned short)*dims[0]*dims[1] );
1574         }
1575         return kvol;
1576 }
1577
1578 //-------------------------------------------------------------------
1579 wxWindow* wxQuantificationWidgetCT::CreateView2DPanel(wxWindow *parent)
1580 {
1581         wxPanel         *panel  =       new wxPanel(parent,-1);
1582     wxBoxSizer  *sizer  =       new wxBoxSizer(wxVERTICAL);
1583
1584         _imageviewer2D_1 = new wxVtk2DBaseView(panel);
1585         wxVTKRenderWindowInteractor *iren   = _imageviewer2D_1->GetWxVTKRenderWindowInteractor();
1586         sizer->Add(iren , 1, wxEXPAND, 0);
1587
1588
1589         panel->SetSizer(sizer);
1590         panel->SetAutoLayout(true);
1591         panel->SetSize(400,400);
1592         panel->Layout();
1593         return panel;
1594 }
1595
1596 //------------------------------------------------------------------------
1597 void wxQuantificationWidgetCT::Refresh()
1598 {
1599         _imageviewer2D_1->Refresh();
1600 }
1601
1602 //------------------------------------------------------------------------
1603 void wxQuantificationWidgetCT::RefreshView(marImageData *marimagedata)
1604 {
1605         vtkImageData *imagedata= marimagedata->GetImageData(); // t=0
1606         _imageviewer2D_1->SetActualSlice(0);
1607         imagedata->UpdateInformation();
1608         imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
1609         imagedata->Update();
1610         _data = imagedata;
1611         
1612         _vtkbasedata_1->SetMarImageData(marimagedata);  
1613         _imageviewer2D_1->ResetView();
1614
1615         int i;
1616         for (i = 0; i < _manContours.size(); i++)
1617         {
1618                 if (_manContours[i] !=NULL)
1619                 {
1620                         _manContours[i]->clear();
1621                 }
1622         }
1623
1624         for (i = 0; i < _manContours.size(); i++)
1625         {
1626                 if (_manContours[i] !=NULL)
1627                 {
1628                         _manContours[i]->refreshWall(_imageviewer2D_1);
1629                         _manContours[i]->refreshLumen(_imageviewer2D_1);
1630
1631                         int j; 
1632                         for (j = 0; j < _manContours[i]->getNumberOfCalcContours(); j++)
1633                         {
1634                                 _manContours[i]->refreshCalc(j,_imageviewer2D_1);
1635                         }
1636
1637                         for (j = 0; j < _manContours[i]->getNumberOfHypoContours(); j++)
1638                         {
1639                                 _manContours[i]->refreshHypo(j,_imageviewer2D_1);
1640                                 
1641                         }
1642
1643                         
1644                 }
1645                         
1646                 
1647
1648         }
1649
1650
1651         
1652                 
1653 /*      _mViewContourWall->ClearContour();
1654         _mViewContourLumen->ClearContour();
1655         
1656         delete _mViewContourWall;
1657         delete _manContourControlWall;
1658         delete _mContourModelWall;
1659         
1660         delete _mViewContourLumen;
1661         delete _manContourControlLumen;
1662         delete _mContourModelLumen;
1663 */
1664         CreateManualContours();
1665
1666 }
1667
1668 //------------------------------------------------------------------------
1669 void wxQuantificationWidgetCT::ConfigureVTK(marImageData *marimagedata)
1670 {
1671    wxBusyCursor wait;
1672
1673         vtkImageData *imagedata=marimagedata->GetImageData(); // t=0
1674         imagedata->UpdateInformation();
1675         imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
1676         imagedata->Update();
1677         _data = imagedata;
1678         _vtkbasedata_1 = new vtkBaseData();
1679         _vtkbasedata_1->SetMarImageData(marimagedata);  
1680         _imageviewer2D_1->SetVtkBaseData( _vtkbasedata_1 );
1681         _imageviewer2D_1->Configure();
1682
1683
1684         _contourViewer = new ContourView();
1685         _contourViewer->SetWxVtkBaseView(_imageviewer2D_1);
1686         _lineViewer = new LineView();
1687         _lineViewer->SetWxVtkBaseView(_imageviewer2D_1);
1688         _pointViewer = new PointView();
1689         _pointViewer->SetWxVtkBaseView(_imageviewer2D_1);
1690         CreateManualContours();
1691         Refresh();      
1692 }
1693
1694 //------------------------------------------------------------------------
1695 void wxQuantificationWidgetCT::OnContourWall()
1696 {
1697         if (_manContours[_mar->getActualQuant()]->getWallController() == NULL)
1698         {
1699                 _manContours[_mar->getActualQuant()]->createWallContour(_imageviewer2D_1);
1700                 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( 
1701                                                 _manContours[_mar->getActualQuant()]->getWallController() );
1702         }
1703         _manContours[_mar->getActualQuant()]->setWallActive();
1704         _manContours[_mar->getActualQuant()]->setWallVisibility(true);
1705 }
1706
1707 //------------------------------------------------------------------------
1708 void wxQuantificationWidgetCT::OnContourLumen()
1709 {
1710         if (_manContours[_mar->getActualQuant()]->getLumenController() == NULL)
1711         {
1712                 _manContours[_mar->getActualQuant()]->createLumenContour(_imageviewer2D_1);
1713                 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( 
1714                                                 _manContours[_mar->getActualQuant()]->getLumenController() );
1715         }
1716         _manContours[_mar->getActualQuant()]->setLumenActive();
1717 }
1718 //------------------------------------------------------------------------
1719 void wxQuantificationWidgetCT::OnContourHypo()
1720 {
1721         
1722
1723
1724         if (_manContours[_mar->getActualQuant()]->getNumberOfHypoContours() > 0)
1725         {
1726
1727                 int answer = wxMessageBox(_T("Create new hypodense contour? (answer no, will modify existing ones)"), 
1728                                                 _T("Confirm"), wxYES_NO | wxCANCEL, this);
1729
1730                 if (answer == wxYES)
1731                 {
1732                         addManualContours(HYPODENSE);
1733                         int tam = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours() - 1;
1734                         _manContours[_mar->getActualQuant()] -> setHypoContourActive(tam);
1735
1736                 }
1737                 else if (answer == wxNO)
1738                 {
1739                         _manContours[_mar->getActualQuant()] ->setHypoActive();
1740                 }
1741         }
1742         else
1743         {
1744                 addManualContours(HYPODENSE);
1745                 int tam = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours() - 1;
1746                 _manContours[_mar->getActualQuant()] -> setHypoContourActive(tam);
1747         }
1748         
1749
1750
1751
1752 }
1753
1754 //------------------------------------------------------------------------
1755 void wxQuantificationWidgetCT::OnContourCalc()
1756 {
1757
1758
1759         if (_manContours[_mar->getActualQuant()]->getNumberOfCalcContours() > 0)
1760         {
1761
1762                 int answer = wxMessageBox(_T("Create new calcification contour? (answer no, will modify existing ones)"), 
1763                                                 _T("Confirm"), wxYES_NO | wxCANCEL, this);
1764
1765                 if (answer == wxYES)
1766                 {
1767                         addManualContours(CALCIFICATION);
1768                         int tam = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours() - 1;
1769                         _manContours[_mar->getActualQuant()] -> setCalcContourActive(tam);
1770
1771                 }
1772                 else if (answer == wxNO)
1773                 {
1774                         _manContours[_mar->getActualQuant()] ->setCalcActive();
1775                 }
1776         }
1777         else
1778         {
1779                 addManualContours(CALCIFICATION);
1780                 int tam = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours() - 1;
1781                 _manContours[_mar->getActualQuant()] -> setCalcContourActive(tam);
1782         }
1783
1784 }
1785
1786
1787
1788 //------------------------------------------------------------------------
1789 void wxQuantificationWidgetCT::OnReplaceContourWall()
1790 {
1791
1792         int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
1793         double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
1794         double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();
1795
1796
1797         _mar->cleanContours(WALL);
1798         _mar->replaceContour2D(size,vx,vy,WALL);
1799         _manContours[_mar->getActualQuant()]->clearWall();
1800         _manContours[_mar->getActualQuant()]->restartWallContour(_imageviewer2D_1);
1801         RefreshAxis();
1802
1803
1804
1805 }
1806 //------------------------------------------------------------------------
1807 void wxQuantificationWidgetCT::OnReplaceContourLumen()
1808 {
1809         int size = _manContours[_mar->getActualQuant()]->getNumberOfLumenContourPoints();
1810         double *vx = _manContours[_mar->getActualQuant()]->getXVectorLumenPoints();
1811         double *vy = _manContours[_mar->getActualQuant()]->getYVectorLumenPoints();
1812
1813         _mar->cleanContours(ELUMEN);
1814         _mar->replaceContour2D(size,vx,vy,ELUMEN);
1815         _manContours[_mar->getActualQuant()]->clearLumen();
1816         _manContours[_mar->getActualQuant()]->restartLumenContour(_imageviewer2D_1);
1817         RefreshAxis();
1818
1819 }
1820 //------------------------------------------------------------------------
1821 void wxQuantificationWidgetCT::OnReplaceContourCalc()
1822 {
1823         int conts = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours();
1824
1825         _mar->cleanContours(CALCIFICATION);
1826         for (int i = 0; i < conts; i++)
1827         {
1828                 int size = _manContours[_mar->getActualQuant()]->getNumberOfCalcContourPoints(i);
1829                 double *vx = _manContours[_mar->getActualQuant()]->getXVectorCalcPoints(i);
1830                 double *vy = _manContours[_mar->getActualQuant()]->getYVectorCalcPoints(i);
1831                 _mar->replaceContour2D(size,vx,vy,CALCIFICATION);
1832         }
1833         _manContours[_mar->getActualQuant()]->clearCalc();
1834         _manContours[_mar->getActualQuant()]->restartCalcContours();
1835         RefreshAxis();
1836 }
1837
1838 //------------------------------------------------------------------------
1839 void wxQuantificationWidgetCT::OnReplaceContourHypo()
1840 {
1841 /*      int conts = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours();
1842
1843         _mar->cleanContours(HYPODENSE);
1844         for (int i = 0; i < conts; i++)
1845         {
1846                 int size = _manContours[_mar->getActualQuant()]->getNumberOfHypoContourPoints(i);
1847                 double *vx = _manContours[_mar->getActualQuant()]->getXVectorHypoPoints(i);
1848                 double *vy = _manContours[_mar->getActualQuant()]->getYVectorHypoPoints(i);
1849         }
1850
1851         _manContours[_mar->getActualQuant()]->clearHypo();
1852         _manContours[_mar->getActualQuant()]->restartHypoContours();
1853         RefreshAxis();*/
1854         performXOR();
1855 }
1856
1857 //------------------------------------------------------------------------
1858 void wxQuantificationWidgetCT::performXOR()
1859 {
1860         if (_manContours [_mar->getActualQuant()]->getWallController() != NULL)
1861         {
1862                 int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
1863                 double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
1864                 double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();      
1865
1866                 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1867                 std::vector<marIsocontour *> walls;
1868
1869                 walls.push_back(m);
1870
1871                 double intersection = _mar->performUnion(WALL,walls);
1872                 double xor_ = _mar->performXOR(WALL,walls);
1873                 
1874                 xor_ = xor_ / intersection;
1875                 wxLogMessage(wxString("Indice XOR (pared): %f", wxConvUTF8), xor_*100);
1876
1877                 double and_ = _mar->performAND(WALL,walls);
1878                 and_ = and_/ intersection;
1879                 
1880                 
1881                 wxLogMessage(wxString("Indice AND (pared): %f", wxConvUTF8), and_*100);
1882
1883                 
1884                 wxLogMessage(wxString("Indice Uni�n (pared): %f", wxConvUTF8), intersection);
1885
1886                 double razon = 0;
1887
1888
1889                 if (and_ == 0)
1890                 {
1891                         razon = -1;
1892                 }
1893                 else
1894                 {
1895                         razon = xor_ / and_;
1896                 }
1897
1898                 wxLogMessage(wxString("Raz�n (pared): %f", wxConvUTF8), razon);
1899         }
1900                 else
1901         {
1902                 wxLogMessage(wxString("SIN INFORMACION PARED", wxConvUTF8));
1903         }       
1904
1905         //LUMEN
1906
1907         if (_manContours [_mar->getActualQuant()]->getLumenController() != NULL)
1908         {
1909                 int size = _manContours[_mar->getActualQuant()]->getNumberOfLumenContourPoints();
1910                 double* vx = _manContours[_mar->getActualQuant()]->getXVectorLumenPoints();
1911                 double* vy = _manContours[_mar->getActualQuant()]->getYVectorLumenPoints();
1912                 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1913                 std::vector<marIsocontour *> lumen;
1914
1915
1916                 lumen.push_back(m);
1917                 double intersection = _mar->performUnion(ELUMEN,lumen);
1918                 double xor_ = _mar->performXOR(ELUMEN,lumen);
1919                 xor_ = xor_ / intersection;
1920                 wxLogMessage(wxString("Indice OR (lumen): %f", wxConvUTF8), xor_*100);
1921
1922                 double and_ = _mar->performAND(ELUMEN,lumen);
1923                 and_ = and_/ intersection;
1924                 wxLogMessage(wxString("Indice AND (lumen): %f", wxConvUTF8), and_*100);
1925
1926                 
1927                 wxLogMessage(wxString("Indice Uni�n (pared): %f", wxConvUTF8), intersection);
1928
1929                 double razon = 0;
1930
1931                 if (and_ == 0)
1932                 {
1933                         razon = -1;
1934                 }
1935                 else
1936                 {
1937                         razon = xor_ / and_;
1938                 }
1939                 wxLogMessage(wxString("Raz�n (lumen): %f", wxConvUTF8), razon);
1940         }
1941         else
1942         {
1943                 wxLogMessage(wxString("SIN INFORMACION LUMEN", wxConvUTF8));
1944         }
1945         
1946
1947         
1948
1949         //CALC
1950         int conts = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours();
1951
1952         std::vector<marIsocontour *> calc;
1953         for (int i = 0; i < conts; i++)
1954         {
1955                 int size = _manContours[_mar->getActualQuant()]->getNumberOfCalcContourPoints(i);
1956                 double* vx = _manContours[_mar->getActualQuant()]->getXVectorCalcPoints(i);
1957                 double* vy = _manContours[_mar->getActualQuant()]->getYVectorCalcPoints(i);
1958                 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1959                 calc.push_back(m);
1960         }
1961
1962         if (conts > 0)
1963         {
1964                 double intersection = _mar->performUnion(CALCIFICATION,calc);
1965                 double xor_ = _mar->performXOR(CALCIFICATION,calc);
1966                 xor_ = xor_ /intersection;
1967
1968                 wxLogMessage(wxString("Indice OR (calc): %f", wxConvUTF8), xor_*100);
1969
1970                 double and_ = _mar->performAND(CALCIFICATION,calc);
1971                 and_ = and_ / intersection;
1972                 wxLogMessage(wxString("Indice AND (calc): %f", wxConvUTF8), and_*100);
1973
1974                 
1975                 wxLogMessage(wxString("Indice Uni�n (pared): %f", wxConvUTF8), intersection);
1976
1977                 double razon = 0;
1978
1979                 if (and_ == 0)
1980                 {
1981                         razon = -1;
1982                 }
1983                 else
1984                 {
1985                         razon = xor_ / and_;
1986                 }
1987
1988                 wxLogMessage(wxString("Raz�n (calc): %f", wxConvUTF8), razon);
1989         }
1990         else
1991         {
1992                 wxLogMessage(_T("INFORMACION NO DISPONIBLE PARA CALCIFICACION"));
1993         }
1994         
1995 }
1996
1997 void wxQuantificationWidgetCT::performAND()
1998 {
1999
2000         int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
2001         double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
2002         double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();      
2003
2004         marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
2005         std::vector<marIsocontour *> walls;
2006
2007         walls.push_back(m);
2008
2009         
2010
2011
2012 }
2013
2014 void wxQuantificationWidgetCT::getIndex()
2015 {
2016 }
2017
2018 //------------------------------------------------------------------------
2019 void wxQuantificationWidgetCT::OnSliderDiscontinuityScroll(int percentage)
2020 {
2021         _mar->updateDiscontinuityThreshold(percentage);
2022         RefreshAxis();
2023         
2024 }
2025
2026
2027 //------------------------------------------------------------------------
2028 void wxQuantificationWidgetCT::OnSliderLumenPercentageScroll(int percentage)
2029 {
2030         _mar->updateLumenPercentage(percentage);
2031         _contourViewer->Refresh();
2032 }
2033
2034
2035 //------------------------------------------------------------------------
2036 void wxQuantificationWidgetCT::OnCalibration() 
2037 {
2038
2039         int actual = _mar->getActualQuant();
2040         _mar->ClearContoursPartial(actual - 1);
2041         _mar->setStartIndex(actual);
2042         _mar->setCalibration(true);
2043
2044         wxLogMessage(_T("Contours calibrated"));
2045         _mar->markUpLumen(actual);
2046         RefreshAxis(); 
2047 }
2048
2049 //------------------------------------------------------------------------
2050 void wxQuantificationWidgetCT::OnFile()
2051 {
2052         
2053         _mar->generateFile();
2054 }
2055
2056 //------------------------------------------------------------------------
2057 void wxQuantificationWidgetCT::OnShowAll(bool value) 
2058 {
2059         OnShowWall(value);
2060         OnShowLumen(value);
2061         OnShowCalc(value);
2062         OnShowHypo(value);
2063 }
2064
2065 //------------------------------------------------------------------------
2066 void wxQuantificationWidgetCT::OnShowWall(bool value)
2067 {
2068
2069         _manContours[_mar->getActualQuant()]->setWallVisibility(value);
2070         _imageviewer2D_1->Refresh();
2071         _imageviewer2D_1->RefreshView();
2072 }
2073 //------------------------------------------------------------------------
2074 void wxQuantificationWidgetCT::OnShowLumen(bool value)
2075 {
2076         _manContours[_mar->getActualQuant()]->setLumenVisibility(value);
2077         _imageviewer2D_1->Refresh();
2078         _imageviewer2D_1->RefreshView();
2079 }
2080
2081 //------------------------------------------------------------------------
2082 void wxQuantificationWidgetCT::OnShowCalc(bool value)
2083 {
2084         _manContours[_mar->getActualQuant()]->setCalcVisibility(value);
2085         _imageviewer2D_1->Refresh();
2086         _imageviewer2D_1->RefreshView();
2087 }
2088
2089 //------------------------------------------------------------------------
2090 void wxQuantificationWidgetCT::OnShowHypo(bool value)
2091 {
2092         _manContours[_mar->getActualQuant()]->setHypoVisibility(value);
2093         _imageviewer2D_1->Refresh();
2094         _imageviewer2D_1->RefreshView();
2095 }
2096
2097 //------------------------------------------------------------------------
2098 void wxQuantificationWidgetCT::OnSliderCalcPercentageScroll(int percentage)
2099 {
2100         int actual = _mar->getActualQuant();
2101         _mar->updateCalcPercentage(percentage);
2102         _contourViewer->Refresh();
2103         //_mar->markUpLumen(actual);
2104         RefreshAxis();
2105         
2106 }
2107
2108
2109 //------------------------------------------------------------------------
2110 void wxQuantificationWidgetCT::CreateManualContours()
2111 {
2112         
2113
2114         for (int i = 0; i < _mar->getNumberOfSlices(); i++)
2115         {
2116                 if (_manContours[i] != NULL && _mar->getActualQuant() != i)
2117                 {
2118                         _manContours[i]->setWallVisibility(false);
2119                         _manContours[i]->setLumenVisibility(false);
2120                         _manContours[i]->setCalcVisibility(false);
2121                         _manContours[i]->setHypoVisibility(false);
2122                         _manContours[i]->inactivate();  
2123                 }
2124         }
2125
2126         _imageviewer2D_1->Refresh();
2127
2128 // EED 31 Mai 2007
2129 //_imageviewer2D_1->RefreshView();
2130
2131         if (_manContours[_mar->getActualQuant()] == NULL)
2132         {
2133                 _manContours[_mar->getActualQuant()] = new manualContourContainer();
2134                 
2135         /*      _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getWallController() );
2136                 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getLumenController() );*/
2137         }
2138         else
2139         {
2140                 _manContours[_mar->getActualQuant()]->setWallVisibility(true);
2141                 _manContours[_mar->getActualQuant()]->setLumenVisibility(true);
2142                 _manContours[_mar->getActualQuant()]->setCalcVisibility(true);
2143                 _manContours[_mar->getActualQuant()]->setHypoVisibility(true);
2144                 _imageviewer2D_1->Refresh();
2145                 _imageviewer2D_1->RefreshView();
2146         }
2147
2148
2149 }
2150
2151 //------------------------------------------------------------------------
2152 void wxQuantificationWidgetCT::addManualContours(int type)
2153 {
2154         int tam = 0;
2155         
2156         if (type == CALCIFICATION)
2157         {
2158                 tam = _manContours[_mar->getActualQuant()]->addCalcificationContour(_imageviewer2D_1);
2159                 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getCalcController(tam) );
2160         }
2161         else if (type == HYPODENSE)
2162         {
2163                 tam = _manContours[_mar->getActualQuant()]->addHypodenseContour(_imageviewer2D_1);
2164                 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getHypoController(tam) );
2165         }
2166 }
2167
2168
2169 // EOF - wxQuantificationWidgetCT.cxx
2170
2171
2172