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