1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 /*=========================================================================
29 Module: $RCSfile: wxQuantificationWidgetCT.cxx,v $
31 Date: $Date: 2012/11/15 14:15:17 $
32 Version: $Revision: 1.2 $
34 Copyright: (c) 2002, 2003
37 This software is distributed WITHOUT ANY WARRANTY; without even
38 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39 PURPOSE. See the above copyright notice for more information.
41 =========================================================================*/
43 #include "wxQuantificationWidgetCT.h"
44 #include "../marDictionary.h"
45 #include "vtkPolyDataWriter.h"
51 //------------------------------------------------------------------------
52 //------------------------------------------------------------------------
53 //------------------------------------------------------------------------
54 BEGIN_EVENT_TABLE( wxQuantificationWidgetCT, wxPanel )
55 EVT_BUTTON(ID_BUTTON_CONTOUR , wxQuantificationWidgetCT::OnContour_BT )
56 EVT_BUTTON(ID_BUTTON_CLEAN , wxQuantificationWidgetCT::OnClean_BT )
57 EVT_BUTTON(ID_BUTTON_CLEAN_ALL , wxQuantificationWidgetCT::OnCleanAll_BT )
58 EVT_CHECKBOX(ID_CHECKBOX_HEALTHY, wxQuantificationWidgetCT::OnHealthySlice_CB )
59 EVT_CHECKBOX(ID_CHECKBOX_SHOW_SURFACE, wxQuantificationWidgetCT::OnShowSurface_CB )
60 EVT_CHECKBOX(ID_CHECKBOX_VISIBLE_RINGS, wxQuantificationWidgetCT::OnVisibleRing_CB )
61 EVT_CHECKBOX(ID_CHECKBOX_PERPENDICULAR, wxQuantificationWidgetCT::OnPerpendicular_CB )
63 EVT_RADIOBUTTON(ID_RADIOBUTTON_GREYSCALE, wxQuantificationWidgetCT::OnGreyScale_RB )
64 EVT_RADIOBUTTON(ID_RADIOBUTTON_COLOR, wxQuantificationWidgetCT::OnColor_RB )
66 EVT_COMMAND_SCROLL(ID_SLIDER_SLICE, wxQuantificationWidgetCT::OnSliderSliceScroll )
68 EVT_COMMAND_SCROLL(ID_SLIDER_OPACITY, wxQuantificationWidgetCT::OnSliderOpacityScroll )
69 EVT_COMMAND_SCROLL_THUMBRELEASE(ID_SLIDER_ISOVALUE, wxQuantificationWidgetCT::OnSliderIsovalueScroll )
73 //--------------------------------------------------------------------------------
75 //--------------------------------------------------------------------------------
76 wxQuantificationWidgetCT::wxQuantificationWidgetCT(wxWindow* parent, wxWindowID id,
77 const wxPoint& pos, const wxSize& size, long style,
79 : wxQuantificationWidget_base( parent, id, pos, size, style, name )
82 panel_splitter = new wxSplitterWindow( this , -1, wxDefaultPosition, wxSize(400,400 ), wxSP_3D );
83 panel_left = new wxPanel(panel_splitter , -1, wxDefaultPosition, wxSize(400,400));
84 panel_splitter_right = new wxSplitterWindow( panel_splitter , -1, wxDefaultPosition, wxSize(400,400 ), wxSP_3D );
85 panel_right_up = new wxPanel(panel_splitter_right , -1, wxDefaultPosition, wxSize(600,600));
86 panel_right_down = new wxPanel(panel_splitter_right , -1, wxDefaultPosition, wxSize(600,600));
87 panel_rightm_up = CreateViewPanel(panel_right_up);
91 SetSizeHealthyRegion( 5 );
94 // this->SetBackgroundColour(*wxLIGHT_GREY);
96 _3DWorld = new vtk3DQuantSurfaceWidget( panel_left, ID_QUANTIF3D );
99 //EED OJO Este NULL es solo para que compile
100 _3DWorld->SetInterfaceVtkPanelWidgets(NULL);
102 // _2DWorld = new vtk2DQuantSliceWidget( panel_right_up, -1 );
103 // _2DWorld->SetSize(200,200);
105 //EED OJO Este NULL es solo para que compile
106 // _2DWorld->SetInterfaceVtkPanelWidgets(NULL);
114 _bak_ActualSlice2=-1;
118 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
119 sizer->Add( CreatePanelPrincipal(this), 1, wxALL|wxEXPAND, 0 );
120 sizer->Add( CreatePanelStatus(this) , 0, wxALL|wxEXPAND, 0 );
130 //--------------------------------------------------------------------------------
132 // ----------------------------------------------------------------------------
133 wxQuantificationWidgetCT::~wxQuantificationWidgetCT( ){
135 delete _contourViewer;
140 for (int i = 0; i < _manContours.size(); i++)
142 delete _manContours[i];
143 _manContours[i] = NULL;
145 delete _imageviewer2D_1;
147 // ----------------------------------------------------------------------------
148 wxWindow* wxQuantificationWidgetCT::CreatePanelPrincipal(wxWindow *parent)
150 wxPanel *panel = new wxPanel(parent,-1);
151 _splitPanelPrincipal = new wxSplitterWindow(panel, -1);
152 _splitPanelPrincipal->SetMinimumPaneSize(50);
154 wxWindow *principal_Left = CreatePanel_Left(_splitPanelPrincipal) ;
155 wxWindow *principal_Right = CreatePanel_Right(_splitPanelPrincipal);
157 _splitPanelPrincipal->SplitVertically(principal_Left , principal_Right,600 );
160 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
161 sizer->Add( _splitPanelPrincipal, 1,wxGROW,0 );
162 panel->SetSizer(sizer);
167 // ----------------------------------------------------------------------------
168 wxWindow* wxQuantificationWidgetCT::CreatePanel_Left(wxWindow *parent)
170 wxPanel *panel = new wxPanel(parent,-1);
171 _splitpanel_left = new wxSplitterWindow(panel, -1);
172 _splitpanel_left->SetMinimumPaneSize(50);
174 _3DWorld = new vtk3DQuantSurfaceWidget( _splitpanel_left, ID_QUANTIF3D );
175 _3DWorld->SetInterfaceVtkPanelWidgets(NULL);
176 wxWindow *controlPanel3D = CreateControlPanel3D(_splitpanel_left);
178 _splitpanel_left->SplitHorizontally(_3DWorld , controlPanel3D,0 );
181 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
182 sizer->Add( _splitpanel_left, 1,wxGROW,0 );
183 panel->SetSizer(sizer);
189 // ----------------------------------------------------------------------------
190 wxWindow* wxQuantificationWidgetCT::CreateControlPanel3D(wxWindow *parent)
192 wxPanel *panel = new wxPanel(parent,-1);
193 marDictionary marDict;
195 _cb_HealthySlice = new wxCheckBox( panel, ID_CHECKBOX_HEALTHY, wxString( marDict.GetString(205) , wxConvUTF8)); // "Healthy slice"
196 _cb_HealthySlice->SetValue(true);
197 _cb_Perpendicular = new wxCheckBox( panel, ID_CHECKBOX_PERPENDICULAR, wxString(marDict.GetString(210), wxConvUTF8)); //"Perpendicular section"
198 _cb_Perpendicular->SetValue(true);
200 _rb_GreyScale = new wxRadioButton( panel, ID_RADIOBUTTON_GREYSCALE, wxString(marDict.GetString(230), wxConvUTF8), wxDefaultPosition,wxDefaultSize,wxRB_GROUP ); //"greyscale "
201 _rb_GreyScale->SetValue(true);
203 _rb_Color = new wxRadioButton( panel, ID_RADIOBUTTON_COLOR, wxString(marDict.GetString(235), wxConvUTF8), wxDefaultPosition,wxDefaultSize );//"color "
204 _rb_Color->SetValue(false);
206 _cb_VisibleRings = new wxCheckBox( panel, ID_CHECKBOX_VISIBLE_RINGS, wxString(marDict.GetString(215), wxConvUTF8));//"Visible rings"
207 _cb_VisibleRings->SetValue(true);
208 _cb_ShowSurface = new wxCheckBox( panel, ID_CHECKBOX_SHOW_SURFACE, wxString(marDict.GetString(220), wxConvUTF8));//"Show Surface"
209 _cb_ShowSurface->SetValue(true);
212 _bt_AddContour3D = new wxButton( panel, ID_BUTTON_CONTOUR, wxString(marDict.GetString(245), wxConvUTF8) ,//"Add mark contour"
213 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
214 _bt_CleanContour3D = new wxButton( panel, ID_BUTTON_CLEAN, wxString(marDict.GetString(250), wxConvUTF8) ,//"Erase mark contours"
215 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
217 _bt_CleanAllContours3D = new wxButton( panel, ID_BUTTON_CLEAN_ALL, wxString(marDict.GetString(253), wxConvUTF8) ,//"Erase all mark contours"
218 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
221 _sl_Slice = new wxSlider( panel, ID_SLIDER_SLICE , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
222 _sl_Isovalue = new wxSlider( panel, ID_SLIDER_ISOVALUE , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
223 _sl_Opacity = new wxSlider( panel, ID_SLIDER_OPACITY , 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
227 _sl_Slice->SetSize(800,16);
228 _sl_Isovalue->SetSize(300,16);
229 _sl_Opacity->SetSize(300,16);
232 _st_Slice = new wxStaticText(panel, -1, wxString(marDict.GetString( 90), wxConvUTF8) ); //"Slice "
233 _st_Isovalue = new wxStaticText(panel, -1, wxString(marDict.GetString(240), wxConvUTF8) ); //"Isovalue"
234 _st_Opacity = new wxStaticText(panel, -1, wxString(marDict.GetString(225), wxConvUTF8) ); //"Opacity "
236 _txt_Position = new wxStaticText(panel, -1, _T(" ") ); //"Position "
241 wxFlexGridSizer *axe = new wxFlexGridSizer(1);
243 wxFlexGridSizer *axe1 = new wxFlexGridSizer(10);
244 wxBoxSizer *axe2 = new wxBoxSizer(wxHORIZONTAL);
245 wxFlexGridSizer *axe3 = new wxFlexGridSizer(10,0);
246 wxFlexGridSizer *axe4 = new wxFlexGridSizer(10,0);
247 wxBoxSizer *axe5 = new wxBoxSizer(wxHORIZONTAL);
251 axe1->Add(_st_Slice , 10, wxALL|wxEXPAND, 0);
252 axe1->Add(_sl_Slice , 10, wxALL|wxGROW, 0);
253 axe1->Add(_txt_Position , 10, wxALL|wxEXPAND, 0);
254 axe1->AddGrowableCol(1);
256 axe2->Add(_cb_HealthySlice , 10, wxALL|wxEXPAND, 0);
257 axe2->Add(_cb_Perpendicular , 10, wxALL|wxEXPAND, 0);
258 axe2->Add(_cb_VisibleRings , 10, wxALL|wxEXPAND, 0);
259 axe2->Add(_cb_ShowSurface , 10, wxALL|wxEXPAND, 0);
261 axe3->Add(_st_Opacity , 1, wxALL|wxEXPAND, 0);
262 axe3->Add(_sl_Opacity , 10, wxALL|wxGROW, 0);
263 axe3->Add(_rb_GreyScale , 10, wxALL|wxEXPAND, 0);
264 axe3->Add(_rb_Color , 10, wxALL|wxEXPAND, 0);
265 axe3->AddGrowableCol(1);
267 axe4->Add(_st_Isovalue , 1, wxALL|wxEXPAND, 0);
268 axe4->Add(_sl_Isovalue , 1, wxALL|wxGROW, 0);
269 axe4->AddGrowableCol(1);
271 axe5->Add(_bt_AddContour3D , 1 );
272 axe5->Add(_bt_CleanContour3D , 1 );
273 axe5->Add(_bt_CleanAllContours3D , 1 );
276 axe->Add(axe1, 2, wxALL|wxGROW, 0);
277 axe->Add(axe2, 2, wxALL, 0); //wxALIGN_CENTER_HORIZONTAL
278 axe->Add(axe3, 2, wxALL|wxGROW, 0);
279 axe->Add(axe4, 2, wxALL|wxGROW, 0);
280 axe->Add(axe5, 2, wxALL, 0);
285 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
286 sizer->Add( axe, 1,wxALL|wxGROW,5 );
287 panel->SetSizer(sizer);
293 // ----------------------------------------------------------------------------
294 wxWindow* wxQuantificationWidgetCT::CreatePanel_Right(wxWindow *parent)
296 wxPanel *panel = new wxPanel(parent,-1);
297 _splitpanel_right = new wxSplitterWindow(panel, -1);
298 _splitpanel_right->SetMinimumPaneSize(50);
300 wxWindow *window2D = CreateView2DPanel(_splitpanel_right);
301 wxWindow *windowRightDown = CreatePanel_Right_Down(_splitpanel_right);
303 _splitpanel_right->SplitHorizontally(window2D , windowRightDown,0 );
306 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
307 sizer->Add( _splitpanel_right, 1,wxGROW,0 );
308 panel->SetSizer(sizer);
314 // ----------------------------------------------------------------------------
315 wxWindow* wxQuantificationWidgetCT::CreatePanel_Right_Down(wxWindow *parent)
317 wxPanel *panel = new wxPanel(parent,-1);
318 _splitpanel_right_down = new wxSplitterWindow(panel, -1);
319 _splitpanel_right_down->SetMinimumPaneSize(10);
321 _pl_cntlHealthySick2 = new wxPanelControlsHealthySickSliceCT(_splitpanel_right_down,this);
322 _wxStenosisPanel = CreateStenosisPanel(_splitpanel_right_down);
324 _splitpanel_right_down->SplitHorizontally(_pl_cntlHealthySick2,_wxStenosisPanel ,300 );
327 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
328 sizer->Add( _splitpanel_right_down, 1,wxGROW,0 );
329 panel->SetSizer(sizer);
335 // ----------------------------------------------------------------------------
336 wxWindow* wxQuantificationWidgetCT::CreatePanelStatus(wxWindow *parent)
338 wxPanel *panel = new wxPanel(parent,-1);
342 marDictionary marDict;
344 _st_Label1 = new wxStaticText(panel, -1, wxString(marDict.GetString(380), wxConvUTF8) ); //"Total Axis Lenght"
345 _st_Value1 = new wxStaticText(panel, -1, _T("0.00"));
346 _st_Label2 = new wxStaticText(panel, -1, wxString(marDict.GetString(390), wxConvUTF8) );//"Area"
347 _st_Value2 = new wxStaticText(panel, -1, _T("0.00"));
348 _st_Label3 = new wxStaticText(panel, -1, wxString(marDict.GetString(400), wxConvUTF8) );//"Perimeter"
349 _st_Value3 = new wxStaticText(panel, -1, _T("0.00"));
350 _st_Label6 = new wxStaticText(panel, -1, wxString(marDict.GetString(405), wxConvUTF8) );//"Minimum Diameter"
351 _st_Value6 = new wxStaticText(panel, -1, _T("0.00"));
352 _st_Label7 = new wxStaticText(panel, -1, wxString(marDict.GetString(410), wxConvUTF8) );//"Maximum Diameter"
353 _st_Value7 = new wxStaticText(panel, -1, _T("0.00"));
354 _st_Label8 = new wxStaticText(panel, -1, wxString(marDict.GetString(415), wxConvUTF8) );//"Average Diameter"
355 _st_Value8 = new wxStaticText(panel, -1, _T("0.00"));
357 _st_LabelRef101 = new wxStaticText(panel, -1, wxString(marDict.GetString(385), wxConvUTF8) );//"Seg. Length"
358 _st_ValueRef101 = new wxStaticText(panel, -1, _T("--"));
359 _st_LabelRef102 = new wxStaticText(panel, -1, wxString(marDict.GetString(395), wxConvUTF8) );//"Ref. Area"
360 _st_ValueRef102 = new wxStaticText(panel, -1, _T("--"));
361 _st_LabelRef103 = new wxStaticText(panel, -1, wxString(marDict.GetString(420), wxConvUTF8) );//"Ref. Average Diam."
362 _st_ValueRef103 = new wxStaticText(panel, -1, _T("--"));
365 wxBoxSizer *status = new wxBoxSizer(wxHORIZONTAL);
366 wxBoxSizer *status0 = new wxBoxSizer(wxVERTICAL);
367 wxBoxSizer *status1 = new wxBoxSizer(wxVERTICAL);
368 wxBoxSizer *status2 = new wxBoxSizer(wxVERTICAL);
369 wxBoxSizer *status3 = new wxBoxSizer(wxVERTICAL);
370 wxBoxSizer *status6 = new wxBoxSizer(wxVERTICAL);
371 wxBoxSizer *status7 = new wxBoxSizer(wxVERTICAL);
372 wxBoxSizer *status8 = new wxBoxSizer(wxVERTICAL);
373 wxBoxSizer *status9 = new wxBoxSizer(wxVERTICAL);
374 wxBoxSizer *statusRef1 = new wxBoxSizer(wxVERTICAL);
375 wxBoxSizer *statusRef2 = new wxBoxSizer(wxVERTICAL);
376 wxBoxSizer *statusRef3 = new wxBoxSizer(wxVERTICAL);
378 status1->Add(_st_Label1, 1, wxALL|wxALIGN_CENTER, 5);
379 status1->Add(_st_Value1, 1, wxALL|wxALIGN_CENTER, 5);
380 status2->Add(_st_Label2, 1, wxALL|wxALIGN_CENTER, 5);
381 status2->Add(_st_Value2, 1, wxALL|wxALIGN_CENTER, 5);
382 status3->Add(_st_Label3, 1, wxALL|wxALIGN_CENTER, 5);
383 status3->Add(_st_Value3, 1, wxALL|wxALIGN_CENTER, 5);
385 status6->Add(_st_Label6, 1, wxALL|wxALIGN_CENTER, 5);
386 status6->Add(_st_Value6, 1, wxALL|wxALIGN_CENTER, 5);
387 status7->Add(_st_Label7, 1, wxALL|wxALIGN_CENTER, 5);
388 status7->Add(_st_Value7, 1, wxALL|wxALIGN_CENTER, 5);
389 status8->Add(_st_Label8, 1, wxALL|wxALIGN_CENTER, 5);
390 status8->Add(_st_Value8, 1, wxALL|wxALIGN_CENTER, 5);
393 statusRef1->Add(_st_LabelRef101, 1, wxALL|wxALIGN_CENTER, 5);
394 statusRef1->Add(_st_ValueRef101, 1, wxALL|wxALIGN_CENTER, 5);
395 statusRef2->Add(_st_LabelRef102, 1, wxALL|wxALIGN_CENTER, 5);
396 statusRef2->Add(_st_ValueRef102, 1, wxALL|wxALIGN_CENTER, 5);
397 statusRef3->Add(_st_LabelRef103, 1, wxALL|wxALIGN_CENTER, 5);
398 statusRef3->Add(_st_ValueRef103, 1, wxALL|wxALIGN_CENTER, 5);
402 status->Add(status1 , 1, wxALL|wxEXPAND, 0);
403 status->Add(statusRef1 , 1, wxALL|wxEXPAND, 0);
404 status->Add(status2 , 1, wxALL|wxEXPAND, 0);
405 status->Add(statusRef2 , 1, wxALL|wxEXPAND, 0);
406 status->Add(status3 , 1, wxALL|wxEXPAND, 0);
408 status->Add(status6 , 1, wxALL|wxEXPAND, 0);
409 status->Add(status7 , 1, wxALL|wxEXPAND, 0);
410 status->Add(status8 , 1, wxALL|wxEXPAND, 0);
411 status->Add(statusRef3 , 1, wxALL|wxEXPAND, 0);
416 wxBoxSizer * sizer = new wxBoxSizer(wxHORIZONTAL);
417 sizer->Add( status, 1,wxALL|wxEXPAND,0 );
418 panel->SetSizer(sizer);
422 // ----------------------------------------------------------------------------
423 wxWindow* wxQuantificationWidgetCT::CreateStenosisPanel(wxWindow *parent){
424 marDictionary marDict;
426 wxPanel* panel = new wxPanel(parent);
428 _st_Label100 = new wxStaticText(panel, -1, (wxChar)(marDict.GetString(255)) ); // "Stenosis (area)"
429 _st_Label101 = new wxStaticText(panel, -1, (wxChar)(marDict.GetString(260)) ); // "Stenosis (diameter)"
430 _st_Value100 = new wxStaticText(panel, -1, _T("-- "));
431 _st_Value101 = new wxStaticText(panel, -1, _T("-- "));
432 // wxStaticText *_st_LabelBlanc = new wxStaticText(panel, -1, " ");
435 // _st_LabelBlanc->SetBackgroundColour(*wxLIGHT_GREY);
438 // panel->SetBackgroundColour(wxColour(100,0,100));
439 // _st_Label100->SetBackgroundColour(*wxLIGHT_GREY);
440 // _st_Label101->SetBackgroundColour(*wxLIGHT_GREY);
441 // _st_Value100->SetBackgroundColour(*wxLIGHT_GREY);
442 // _st_Value101->SetBackgroundColour(*wxLIGHT_GREY);
445 wxFont font(14,wxDEFAULT ,wxNORMAL,wxBOLD);
446 _st_Value100->SetFont(font);
447 _st_Value101->SetFont(font);
451 wxGridSizer* gridSizer1 = new wxFlexGridSizer(1);
452 gridSizer1->Add(new wxStaticText(panel, -1, _T(" ")) ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
453 gridSizer1->Add(_st_Value100 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
454 gridSizer1->Add(_st_Label100 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
455 gridSizer1->Add(new wxStaticText(panel, -1, _T(" ")) ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
456 gridSizer1->Add(_st_Value101 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
457 gridSizer1->Add(_st_Label101 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
459 wxGridSizer* gridSizer = new wxFlexGridSizer(4);
460 gridSizer->Add(new wxStaticText(panel, -1, _T(" ")) ,15, wxALIGN_LEFT , 50);
461 gridSizer->Add(new wxStaticText(panel, -1, _T(" ")) ,15, wxALIGN_LEFT , 50);
462 gridSizer->Add(new wxStaticText(panel, -1, _T(" ")) ,15, wxALIGN_LEFT , 50);
463 gridSizer->Add(gridSizer1 ,15, wxALIGN_LEFT , 50);
465 panel->SetAutoLayout(true);
466 panel->SetSizer(gridSizer);
469 // panel->SetBackgroundColour(*wxLIGHT_GREY);
470 panel->SetSize(400,300);
471 panel->SetSize( gridSizer->GetMinSize() );
476 //--------------------------------------------------------
478 void wxQuantificationWidgetCT::Set_control(){
479 marDictionary marDict;
481 _wxStenosisPanel = CreateStenosisPanel();
483 _cb_HealthySlice = new wxCheckBox( panel_left, ID_CHECKBOX_HEALTHY, wxT( marDict.GetString(205) )); // "Healthy slice"
484 _cb_HealthySlice->SetValue(true);
486 // _cb_HealthySlice->SetBackgroundColour(*wxLIGHT_GREY);
487 _cb_Perpendicular = new wxCheckBox( panel_left, ID_CHECKBOX_PERPENDICULAR, wxT(marDict.GetString(210))); //"Perpendicular section"
488 _cb_Perpendicular->SetValue(true);
490 // _cb_Perpendicular->SetBackgroundColour(*wxLIGHT_GREY);
492 _rb_GreyScale = new wxRadioButton( panel_left, ID_RADIOBUTTON_GREYSCALE, wxT(marDict.GetString(230)), wxDefaultPosition,wxDefaultSize,wxRB_GROUP ); //"greyscale "
493 _rb_GreyScale->SetValue(true);
495 // _rb_GreyScale->SetBackgroundColour(*wxLIGHT_GREY);
497 _rb_Color = new wxRadioButton( panel_left, ID_RADIOBUTTON_COLOR, wxT(marDict.GetString(235)), wxDefaultPosition,wxDefaultSize );//"color "
498 _rb_Color->SetValue(false);
500 // _rb_Color->SetBackgroundColour(*wxLIGHT_GREY);
502 _cb_VisibleRings = new wxCheckBox( panel_left, ID_CHECKBOX_VISIBLE_RINGS, wxT(marDict.GetString(215)));//"Visible rings"
503 _cb_VisibleRings->SetValue(true);
505 // _cb_VisibleRings->SetBackgroundColour(*wxLIGHT_GREY);
506 _cb_ShowSurface = new wxCheckBox( panel_left, ID_CHECKBOX_SHOW_SURFACE, wxT(marDict.GetString(220)));//"Show Surface"
507 _cb_ShowSurface->SetValue(true);
509 // _cb_ShowSurface->SetBackgroundColour(*wxLIGHT_GREY);
512 _bt_AddContour3D = new wxButton( panel_left, ID_BUTTON_CONTOUR, marDict.GetString(245) ,//"Add mark contour"
513 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
514 _bt_CleanContour3D = new wxButton( panel_left, ID_BUTTON_CLEAN, marDict.GetString(250) ,//"Erase mark contours"
515 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
517 _bt_CleanAllContours3D = new wxButton( panel_left, ID_BUTTON_CLEAN_ALL, marDict.GetString(253) ,//"Erase all mark contours"
518 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
521 _sl_Slice = new wxSlider( panel_left, ID_SLIDER_SLICE , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
522 _sl_Isovalue = new wxSlider( panel_left, ID_SLIDER_ISOVALUE , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
523 _sl_Opacity = new wxSlider( panel_left, ID_SLIDER_OPACITY , 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
525 // _sl_Slice->SetBackgroundColour(*wxLIGHT_GREY);
526 // _sl_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
527 // _sl_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
530 _sl_Slice->SetSize(800,16);
531 _sl_Isovalue->SetSize(300,16);
532 _sl_Opacity->SetSize(300,16);
535 _st_Slice = new wxStaticText(panel_left, -1, marDict.GetString( 90) ); //"Slice "
536 _st_Isovalue = new wxStaticText(panel_left, -1, marDict.GetString(240) ); //"Isovalue"
537 _st_Opacity = new wxStaticText(panel_left, -1, marDict.GetString(225) ); //"Opacity "
539 _txt_Position = new wxStaticText(panel_left, -1, " " ); //"Position "
542 // _st_Slice->SetBackgroundColour(*wxLIGHT_GREY);
543 // _st_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
544 // _st_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
547 _st_Label1 = new wxStaticText(this, -1, marDict.GetString(380) ); //"Total Axis Lenght"
548 _st_Value1 = new wxStaticText(this, -1, "0.00");
550 // _st_Label1->SetBackgroundColour(*wxLIGHT_GREY);
551 // _st_Value1->SetBackgroundColour(*wxLIGHT_GREY);
552 _st_Label2 = new wxStaticText(this, -1, marDict.GetString(390) );//"Area"
553 _st_Value2 = new wxStaticText(this, -1, "0.00");
555 // _st_Label2->SetBackgroundColour(*wxLIGHT_GREY);
556 // _st_Value2->SetBackgroundColour(*wxLIGHT_GREY);
557 _st_Label3 = new wxStaticText(this, -1, marDict.GetString(400) );//"Perimeter"
558 _st_Value3 = new wxStaticText(this, -1, "0.00");
560 // _st_Label3->SetBackgroundColour(*wxLIGHT_GREY);
561 // _st_Value3->SetBackgroundColour(*wxLIGHT_GREY);
562 _st_Label6 = new wxStaticText(this, -1, marDict.GetString(405) );//"Minimum Diameter"
563 _st_Value6 = new wxStaticText(this, -1, "0.00");
565 // _st_Label6->SetBackgroundColour(*wxLIGHT_GREY);
566 // _st_Value6->SetBackgroundColour(*wxLIGHT_GREY);
567 _st_Label7 = new wxStaticText(this, -1, marDict.GetString(410) );//"Maximum Diameter"
568 _st_Value7 = new wxStaticText(this, -1, "0.00");
570 // _st_Label7->SetBackgroundColour(*wxLIGHT_GREY);
571 // _st_Value7->SetBackgroundColour(*wxLIGHT_GREY);
572 _st_Label8 = new wxStaticText(this, -1, marDict.GetString(415) );//"Average Diameter"
573 _st_Value8 = new wxStaticText(this, -1, "0.00");
575 // _st_Label8->SetBackgroundColour(*wxLIGHT_GREY);
576 // _st_Value8->SetBackgroundColour(*wxLIGHT_GREY);
578 _st_LabelRef101 = new wxStaticText(this, -1, marDict.GetString(385) );//"Seg. Length"
579 _st_ValueRef101 = new wxStaticText(this, -1, "--");
581 // _st_LabelRef101->SetBackgroundColour(*wxLIGHT_GREY);
582 // _st_ValueRef101->SetBackgroundColour(*wxLIGHT_GREY);
583 _st_LabelRef102 = new wxStaticText(this, -1, marDict.GetString(395) );//"Ref. Area"
584 _st_ValueRef102 = new wxStaticText(this, -1, "--");
586 // _st_LabelRef102->SetBackgroundColour(*wxLIGHT_GREY);
587 // _st_ValueRef102->SetBackgroundColour(*wxLIGHT_GREY);
588 _st_LabelRef103 = new wxStaticText(this, -1, marDict.GetString(420) );//"Ref. Average Diam."
589 _st_ValueRef103 = new wxStaticText(this, -1, "--");
591 // _st_LabelRef103->SetBackgroundColour(*wxLIGHT_GREY);
592 // _st_ValueRef103->SetBackgroundColour(*wxLIGHT_GREY);
594 _pl_cntlHealthySick2 = new wxPanelControlsHealthySickSliceCT(panel_right_down,this);
597 // panel_left->SetBackgroundColour(*wxLIGHT_GREY);
598 // panel_right_up->SetBackgroundColour(*wxLIGHT_GREY);
599 // panel_right_down->SetBackgroundColour(*wxLIGHT_GREY);
600 // panel_splitter_right->SetBackgroundColour(*wxLIGHT_GREY);
601 // panel_splitter->SetBackgroundColour(*wxLIGHT_GREY);
605 //--------------------------------------------------------
607 void wxQuantificationWidgetCT::Do_layout()
612 wxBoxSizer *sizer_principal = new wxBoxSizer(wxVERTICAL);
613 wxBoxSizer *status = new wxBoxSizer(wxHORIZONTAL);
616 // wxFlexGridSizer *medium_right_up = new wxFlexGridSizer(1,0);
617 // wxFlexGridSizer *medium_right_down = new wxFlexGridSizer(1,0);
618 wxBoxSizer *medium_right_up = new wxBoxSizer(wxVERTICAL);
619 wxBoxSizer *medium_right_down = new wxBoxSizer(wxVERTICAL);
622 // wxFlexGridSizer *right_up_div = new wxFlexGridSizer(1,0);
625 wxBoxSizer *right_up_div = new wxBoxSizer(wxVERTICAL);
628 wxBoxSizer *medium_left = new wxBoxSizer(wxVERTICAL);
631 wxStaticBoxSizer *axe = new wxStaticBoxSizer(new wxStaticBox(this, -1, ""), wxVERTICAL);
634 // wxFlexGridSizer *axe1 = new wxFlexGridSizer(10,0);
635 wxBoxSizer *axe1 = new wxBoxSizer(wxHORIZONTAL);
637 wxBoxSizer *axe2 = new wxBoxSizer(wxHORIZONTAL);
638 wxFlexGridSizer *axe3 = new wxFlexGridSizer(10,0);
639 wxFlexGridSizer *axe4 = new wxFlexGridSizer(10,0);
640 wxBoxSizer *axe5 = new wxBoxSizer(wxHORIZONTAL);
641 wxFlexGridSizer *axe6 = new wxFlexGridSizer(10,0);
642 wxFlexGridSizer *axe7 = new wxFlexGridSizer(10,0);
643 wxFlexGridSizer *axe8 = new wxFlexGridSizer(10,0);
645 wxBoxSizer *status0 = new wxBoxSizer(wxVERTICAL);
646 wxBoxSizer *status1 = new wxBoxSizer(wxVERTICAL);
647 wxBoxSizer *status2 = new wxBoxSizer(wxVERTICAL);
648 wxBoxSizer *status3 = new wxBoxSizer(wxVERTICAL);
649 wxBoxSizer *status6 = new wxBoxSizer(wxVERTICAL);
650 wxBoxSizer *status7 = new wxBoxSizer(wxVERTICAL);
651 wxBoxSizer *status8 = new wxBoxSizer(wxVERTICAL);
652 wxBoxSizer *status9 = new wxBoxSizer(wxVERTICAL);
653 wxBoxSizer *statusRef1 = new wxBoxSizer(wxVERTICAL);
654 wxBoxSizer *statusRef2 = new wxBoxSizer(wxVERTICAL);
655 wxBoxSizer *statusRef3 = new wxBoxSizer(wxVERTICAL);
658 axe1->Add(_st_Slice , 10, wxALL|wxEXPAND, 0);
659 axe1->Add(_sl_Slice , 10, wxALL|wxEXPAND, 0);
660 axe1->Add(_txt_Position , 10, wxALL|wxEXPAND, 0);
662 axe2->Add(_cb_HealthySlice , 10, wxALL|wxEXPAND, 0);
663 axe2->Add(_cb_Perpendicular , 10, wxALL|wxEXPAND, 0);
664 axe2->Add(_cb_VisibleRings , 10, wxALL|wxEXPAND, 0);
665 axe2->Add(_cb_ShowSurface , 10, wxALL|wxEXPAND, 0);
667 axe3->Add(_st_Opacity , 1, wxALL|wxEXPAND, 0);
668 axe3->Add(_sl_Opacity , 10, wxALL|wxEXPAND, 0);
669 axe3->Add(_rb_GreyScale , 10, wxALL|wxEXPAND, 0);
670 axe3->Add(_rb_Color , 10, wxALL|wxEXPAND, 0);
672 axe4->Add(_st_Isovalue , 1, wxALL|wxEXPAND, 0);
673 axe4->Add(_sl_Isovalue , 1, wxALL|wxEXPAND, 0);
675 axe5->Add(_bt_AddContour3D , 1 );
676 axe5->Add(_bt_CleanContour3D , 1 );
677 axe5->Add(_bt_CleanAllContours3D , 1 );
681 status1->Add(_st_Label1, 1, wxALL|wxALIGN_CENTER, 5);
682 status1->Add(_st_Value1, 1, wxALL|wxALIGN_CENTER, 5);
683 status2->Add(_st_Label2, 1, wxALL|wxALIGN_CENTER, 5);
684 status2->Add(_st_Value2, 1, wxALL|wxALIGN_CENTER, 5);
685 status3->Add(_st_Label3, 1, wxALL|wxALIGN_CENTER, 5);
686 status3->Add(_st_Value3, 1, wxALL|wxALIGN_CENTER, 5);
688 status6->Add(_st_Label6, 1, wxALL|wxALIGN_CENTER, 5);
689 status6->Add(_st_Value6, 1, wxALL|wxALIGN_CENTER, 5);
690 status7->Add(_st_Label7, 1, wxALL|wxALIGN_CENTER, 5);
691 status7->Add(_st_Value7, 1, wxALL|wxALIGN_CENTER, 5);
692 status8->Add(_st_Label8, 1, wxALL|wxALIGN_CENTER, 5);
693 status8->Add(_st_Value8, 1, wxALL|wxALIGN_CENTER, 5);
696 statusRef1->Add(_st_LabelRef101, 1, wxALL|wxALIGN_CENTER, 5);
697 statusRef1->Add(_st_ValueRef101, 1, wxALL|wxALIGN_CENTER, 5);
698 statusRef2->Add(_st_LabelRef102, 1, wxALL|wxALIGN_CENTER, 5);
699 statusRef2->Add(_st_ValueRef102, 1, wxALL|wxALIGN_CENTER, 5);
700 statusRef3->Add(_st_LabelRef103, 1, wxALL|wxALIGN_CENTER, 5);
701 statusRef3->Add(_st_ValueRef103, 1, wxALL|wxALIGN_CENTER, 5);
705 status->Add(status1 , 1, wxALL|wxEXPAND, 0);
706 status->Add(statusRef1 , 1, wxALL|wxEXPAND, 0);
707 status->Add(status2 , 1, wxALL|wxEXPAND, 0);
708 status->Add(statusRef2 , 1, wxALL|wxEXPAND, 0);
709 status->Add(status3 , 1, wxALL|wxEXPAND, 0);
711 status->Add(status6 , 1, wxALL|wxEXPAND, 0);
712 status->Add(status7 , 1, wxALL|wxEXPAND, 0);
713 status->Add(status8 , 1, wxALL|wxEXPAND, 0);
714 status->Add(statusRef3 , 1, wxALL|wxEXPAND, 0);
717 axe->Add(axe1, 2, wxALL|wxEXPAND, 0);
718 axe->Add(axe2, 2, wxALL|wxEXPAND, 0); //wxALIGN_CENTER_HORIZONTAL
719 axe->Add(axe3, 2, wxALL|wxEXPAND, 0);
720 axe->Add(axe4, 2, wxALL|wxEXPAND, 0);
721 axe->Add(axe6, 2, wxALL|wxEXPAND, 0);
722 axe->Add(axe7, 2, wxALL|wxEXPAND, 0);
723 axe->Add(axe8, 2, wxALL|wxEXPAND, 0);
727 // right_up_div->Add(_2DWorld, 1, wxALL|wxEXPAND, 5);
728 right_up_div->Add(panel_rightm_up, 1, wxALL|wxEXPAND, 5);
729 medium_left->Add(_3DWorld , 1, wxEXPAND, 0);
730 medium_left->Add(axe , 0, wxALL|wxEXPAND, 0);
731 medium_right_up->Add( right_up_div , 1, wxALL|wxEXPAND, 5);
732 // medium_right_up->Add( , 2, wxALL|wxEXPAND, 5);
733 medium_right_down->Add(_pl_cntlHealthySick2 , 1, wxALL, 5);
734 medium_right_down->Add(_wxStenosisPanel , 1, wxALL, 5);
739 panel_left->SetAutoLayout(true);
740 panel_left->SetSizer(medium_left);
741 panel_left->Layout();
743 panel_right_up->SetAutoLayout(true);
744 panel_right_up->SetSizer(medium_right_up);
745 panel_right_up->Layout();
747 panel_right_down->SetAutoLayout(true);
748 panel_right_down->SetSizer(medium_right_down);
749 panel_right_down->Layout();
751 panel_splitter_right->SetMinimumPaneSize( 50 );
752 panel_splitter_right->SplitHorizontally( panel_right_up, panel_right_down, 400 );
756 panel_splitter->SetMinimumPaneSize( 50 );
757 panel_splitter->SplitVertically( panel_left, panel_splitter_right, 420 );
760 sizer_principal->Add(panel_splitter, 1, wxALL|wxEXPAND, 0);
761 sizer_principal->Add(status, 0, wxALL|wxEXPAND, 0);
763 this->SetAutoLayout(true);
764 this->SetSizer(sizer_principal);
773 //--------------------------------------------------------
774 void wxQuantificationWidgetCT::Set_Data( )
788 _actual_darea = 0.00;
789 _actual_dperi = 0.00;
794 _actual_partial = 0.00;
802 //--------------------------------------------------------
803 void wxQuantificationWidgetCT::Forget( )
808 // ----------------------------------------------------------------------------
809 void wxQuantificationWidgetCT::ShowMARACASData( marInterfaceCT* mar )
812 vtkImageData* imagedata;
819 _mar->prepareQuantification();
820 nos = _mar->getNumberOfSlices();
822 //MAZV se a�ade para manejo de contornos manuales
823 for (int i = 0; i < nos; i++)
825 _manContours.push_back(NULL);
829 actualQuant = (int) (nos-1)/2 ;
830 imagedata = _mar->getSliceImage(actualQuant);
832 _mar->setActualQuant( actualQuant ) ;
833 _mar->getMinMax(min, max);
836 _3DWorld->ShowMARACASDataAndAxeCT( mar );
837 _3DWorld->InitCameraReset( );
838 // _2DWorld->ConstructVTK( imagedata );
841 ConfigureVTK( new marImageData(imagedata) );
844 _sl_Isovalue->SetRange( (int)min, (int)max);
845 _sl_Isovalue->SetValue( (int)(max/4) );
846 _sl_Opacity->SetValue( 50 );
854 // this->GetSize(&wwT,&hhT);
855 // _wxStenosisPanel->GetSize(&ww1,&hh1);
856 // _pl_cntlHealthySick2->GetSize(&ww2,&hh2);
858 // ss=hhT-(hh1+hh2+85);
860 // panel_splitter_right->SetSashPosition(ss,true);
862 _splitPanelPrincipal -> SetSashPosition(600,true);
863 _splitpanel_left -> SetSashPosition(360,true);
864 _splitpanel_right -> SetSashPosition(200,true);
865 _splitpanel_right_down -> SetSashPosition(230,true);
867 //----------------------------------------------------------------------------
868 void wxQuantificationWidgetCT::Reset_sl_Slider()
870 int nos = _mar->getNumberOfSlices();
872 _sl_Slice->SetRange(0, nos-1);
873 _sl_Slice->SetValue( (nos-1)/2 );
876 //----------------------------------------------------------------------------
877 void wxQuantificationWidgetCT::SetSlider_Isovalue_Opacity(int isovalue,int opacity){
878 _sl_Isovalue->SetValue(isovalue);
879 _sl_Opacity->SetValue(opacity);
880 _3DWorld->SetSurfaceIsoValue( isovalue );
881 _3DWorld->SetSurfaceOpacity( opacity );
883 //----------------------------------------------------------------------------
884 void wxQuantificationWidgetCT::OnShowSurface_CB(wxCommandEvent& event)
886 _3DWorld->SetSurfaceVisibility( _cb_ShowSurface->GetValue() );
888 // ---------------------------------------------------------------------------
889 void wxQuantificationWidgetCT::ResetAxis(){
891 _mar->setActualQuant( _sl_Slice->GetValue() );
893 _3DWorld->Hide3DHealthySliceActor();
894 _mar->setHealthySlice( 0,-1,0 );
895 _mar->setActualQuant( _sl_Slice->GetValue() );
898 // ---------------------------------------------------------------------------
899 void wxQuantificationWidgetCT::RefreshAxis( ){
900 int actualQuant = _mar->getActualQuant();
901 vtkImageData* imagedata;
902 vtkProbeFilter* image3D;
903 vtkPolyData* vtkPolydata_2Dcontour;
906 // vtkPoints* vtkPoints_2DDiameterMin;
907 // vtkPoints* vtkPoints_2DDiameterMax;
909 int contours = _mar->getNumberOfContours(actualQuant);
911 image3D = _mar->get3DSlice ( actualQuant );
912 imagedata = _mar->getSliceImage ( actualQuant );
915 _contourViewer->DeleteContours();
916 _lineViewer->DeleteLines();
917 _pointViewer->DeletePoints();
922 _pointViewer->CreateNewPoint(64,64,0);
923 for (int i = 0; i < contours; i++)
926 vtkPolydata_2Dcontour = _mar->get2Dcontour( actualQuant, i );
928 // vtkPoints_2DDiameterMin = _mar->get2DDiameterMin ( actualQuant, 0 );
929 // vtkPoints_2DDiameterMax = _mar->get2DDiameterMax ( actualQuant, 0 );
931 if (_cb_VisibleRings->GetValue()==true){
932 // _2DWorld->SetContour( vtkPolydata_2Dcontour );
933 _contourViewer->CreateNewContour(vtkPolydata_2Dcontour, _mar->getContourType(actualQuant, i));
934 // _2DWorld->SetDiameterMin( vtkPoints_2DDiameterMin , true );
935 // _2DWorld->SetDiameterMax( vtkPoints_2DDiameterMax , true );
939 int puntos = _mar->getPointSize();
941 for (int j = 0; j < puntos; j++)
943 marPoint *p = _mar->getPoint(j);
944 _pointViewer->CreateNewPoint(p->getX(),p->getY(),p->getType());
948 _3DWorld->SetImage(image3D);
950 // _2DWorld->SetImage(imagedata);
952 RefreshView( new marImageData(imagedata) );
965 // ----------------------------------------------------------------------------
966 void wxQuantificationWidgetCT::MoveSlider(int actualQuant){
968 if (actualQuant!=_bak_ActualSlice2)
970 _bak_ActualSlice2=actualQuant;
971 if (_bak_ActualSlice!=-1){
972 SetManualContour_ReplaceContour();
973 SetManualContour_2DWorld(false);
975 _mar->setActualQuant( actualQuant );
980 p = _mar->GetExperiment()->getAxis()->getPoints( actualQuant );
982 _mar->getDynData()->GetMarImageData()->GetImageData()->GetSpacing(spc);
984 nX = _mar->getDynData()->GetMarImageData()->GetXOriginal( (int)(p[0]/spc[0]) );
985 nY = _mar->getDynData()->GetMarImageData()->GetYOriginal( (int)(p[1]/spc[1]) );
986 nZ = _mar->getDynData()->GetMarImageData()->GetZOriginal( (int)(p[2]/spc[2]) );
987 char resultText[50],temp[50];
988 strcpy(resultText," \n (");
990 // ltoa ((int)nX,temp,10);
991 sprintf(temp,"%d",(int)nX);
993 strcat(resultText,temp);
994 strcat(resultText,",");
996 // ltoa ((int)nY,temp,10);
997 sprintf(temp,"%d",(int)nY);
999 strcat(resultText,temp);
1000 strcat(resultText,",");
1002 // ltoa ((int)nZ,temp,10);
1003 sprintf(temp,"%d",(int)nZ);
1005 strcat(resultText,temp);
1006 strcat(resultText,")");
1007 _txt_Position->SetLabel( wxString(resultText, wxConvUTF8) );
1010 // ----------------------------------------------------------------------------
1011 void wxQuantificationWidgetCT::OnSliderSliceScroll(wxScrollEvent& event){
1012 MoveSlider( event.GetPosition() );
1015 // ----------------------------------------------------------------------------
1016 double wxQuantificationWidgetCT::GetStenosisDiameter(int sickSlice){
1017 double healthyAverageDiameter = _mar->getReferenceAverDiam() ;
1018 marContour *marcontourSick = _mar->getContour( sickSlice, sickSlice );
1019 return doubleStenosis( healthyAverageDiameter , marcontourSick->getMinimumDiameter() );
1021 // ----------------------------------------------------------------------------
1022 double wxQuantificationWidgetCT::GetStenosisArea( int sickSlice){
1023 double healthyArea = _mar->getReferenceArea();
1024 marContour *marcontourSick = _mar->getContour( sickSlice, sickSlice );
1025 return doubleStenosis( healthyArea , marcontourSick->getArea() );
1027 // ----------------------------------------------------------------------------
1034 // ----------------------------------------------------------------------------
1035 void wxQuantificationWidgetCT::showVariables()
1038 // marContour* marcontour;
1042 int healthySliceStart;
1043 int healthySliceEnd;
1045 actualQuant = _mar->getActualQuant( );
1046 // marcontour=_mar->getContour( actualQuant, actualQuant );
1050 tmpString.Printf( _T("%.2f mm") , 20)/*_mar->getTotalLength() )*/; _st_Value1->SetLabel(tmpString);
1053 tmpString.Printf( _T("%.2f mm^2") , 20)/*marcontour->getArea())*/; _st_Value2->SetLabel(tmpString);
1054 tmpString.Printf( _T("%.2f mm") , 20)/*marcontour->getPerimeter())*/; _st_Value3->SetLabel(tmpString);
1056 tmpString.Printf( _T("%.2f mm") , 20)/*marcontour->getMinimumDiameter())*/; _st_Value6->SetLabel(tmpString);
1057 tmpString.Printf( _T("%.2f mm") , 20)/*marcontour->getMaximumDiameter())*/; _st_Value7->SetLabel(tmpString);
1058 tmpString.Printf( _T("%.2f mm") , 20)/*marcontour->getAverageDiameter())*/; _st_Value8->SetLabel(tmpString);
1060 healthySlice = _mar->getHealthySlice( );
1061 healthySliceStart = _mar->getHealthySliceStart( );
1062 healthySliceEnd = _mar->getHealthySliceEnd( );
1063 if ( (healthySlice!=-1) ) {
1064 _st_Value100->SetLabel( strStenosis( GetStenosisArea(actualQuant) ) );
1065 _st_Value101->SetLabel( strStenosis( GetStenosisDiameter(actualQuant) ) );
1066 tmpString.Printf( _T("%.2f mm^2") , _mar->getReferenceArea() ); _st_ValueRef102->SetLabel(tmpString);
1067 tmpString.Printf( _T("%.2f mm") , _mar->getReferenceAverDiam() ); _st_ValueRef103->SetLabel(tmpString);
1070 _st_Value100->SetLabel(_T("--"));
1071 _st_Value101->SetLabel(_T("--"));
1072 _st_ValueRef101->SetLabel(_T("--"));
1073 _st_ValueRef102->SetLabel(_T("--"));
1074 _st_ValueRef103->SetLabel(_T("--"));
1077 int startSlice = _mar->getQuantStart();
1078 int finishSlice = _mar->getQuantFinish();
1079 if ((startSlice!=-1) && (finishSlice!=-1)){
1080 tmpString.Printf( _T("%.2f mm") , _mar->getSubAxisLength() ); _st_ValueRef101->SetLabel(tmpString);
1082 _st_ValueRef101->SetLabel(_T("--"));
1086 // ----------------------------------------------------------------------------
1087 double wxQuantificationWidgetCT::doubleStenosis(double healthy, double sick){
1092 result = ( (healthy-sick)/healthy) * 100 ;
1097 // ----------------------------------------------------------------------------
1098 wxString wxQuantificationWidgetCT::strStenosis(double stenosis){
1101 tmpString.Printf(_T("%d"),-1);
1103 tmpString.Printf(_T("%.2f"), stenosis );
1105 return tmpString + _T(" \%");
1107 // ----------------------------------------------------------------------------
1108 void wxQuantificationWidgetCT::OnSliderIsovalueScroll(wxScrollEvent& event)
1111 _3DWorld->SetSurfaceIsoValue( event.GetPosition() );
1113 // ----------------------------------------------------------------------------
1114 void wxQuantificationWidgetCT::OnSliderOpacityScroll(wxScrollEvent& event)
1116 _3DWorld->SetSurfaceOpacity( event.GetPosition() );
1118 //----------------------------------------------------------------------------
1119 void wxQuantificationWidgetCT::AddAxisActors(){
1121 marAxis *maraxis = _mar->getAxis( );
1122 if (maraxis!=NULL) _3DWorld->SetAxis( maraxis->Draw( ) );
1125 //----------------------------------------------------------------------------
1126 void wxQuantificationWidgetCT::Clean3D( bool eraseAxe )
1131 _quant_shown = false;
1133 _3DWorld->InitListContourActor( -1,_mar->getNumberOfSlices() );
1134 if (eraseAxe==true) { _3DWorld->RemoveAxis(); }
1141 void wxQuantificationWidgetCT::Reload_Axis(bool mask , bool step )
1147 void wxQuantificationWidgetCT::Show_Max_Min_Diameters()
1154 int wxQuantificationWidgetCT::Back( )
1164 void wxQuantificationWidgetCT::Set_plane_3D( double x, double y )
1173 void wxQuantificationWidgetCT::Point_Intensity(double x, double y)
1179 void wxQuantificationWidgetCT::CleanContour()
1185 //-----------------------------------------------------------------
1187 void wxQuantificationWidgetCT::Do_Quant()
1193 //-----------------------------------------------------------------
1194 void wxQuantificationWidgetCT::OnContour_BT(wxCommandEvent& event){
1195 int slice=_sl_Slice->GetValue();
1196 _3DWorld->Set3DContourActor( slice , _mar->get3Dcontour(slice, slice) , _cb_VisibleRings->GetValue() ,0 );
1198 //-----------------------------------------------------------------
1199 void wxQuantificationWidgetCT::OnClean_BT(wxCommandEvent& event){
1200 int slice=_sl_Slice->GetValue();
1201 _3DWorld->Erase3DContourActor( slice );
1204 //-----------------------------------------------------------------
1205 void wxQuantificationWidgetCT::OnCleanAll_BT(wxCommandEvent& event){
1206 marDictionary marDict;
1209 wxMessageDialog *wxdiag;
1210 strcpy( tmp , marDict.GetString(870) ); strcat(tmp,"\n"); strcat(tmp,marDict.GetString(875));
1211 wxdiag= new wxMessageDialog(this, wxString(tmp, wxConvUTF8), wxString(marDict.GetString(865), wxConvUTF8) , wxOK | wxCANCEL);//"This option erase all 3D contours.\n Do you want to continue?","Alert"
1212 if ( wxdiag->ShowModal() == wxID_OK ) {
1213 _3DWorld->InitListContourActor( 0, _mar->getNumberOfSlices() );
1222 //------------------------------------------------------------------------
1223 void wxQuantificationWidgetCT::DetectHealthySickSlice( bool minSurf , bool maxSurf ){
1225 //ESTE ES EL METODO QUE SE MODIFICA PARA CALCULAR LA ESTENOSIS
1233 double maxStenosis = -9999999;
1234 double maxArea = -9999999;
1236 int healthySlice = 0;
1237 int sizeHealthyRegion = GetSizeHealthyRegion();
1238 int analysisTypeStenosis= GetAnalysisTypeStenosis();
1245 GetSliceLimites(0,startslice,endslice);
1247 if (startslice>endslice){
1249 endslice=startslice;
1254 if (minSurf==false) { backSlice = _sl_Slice->GetValue(); }
1256 for (iSlice=startslice; iSlice<=endslice;iSlice++){
1259 // this is equal to the minimum surface/diameter
1260 if (analysisTypeStenosis==1 ){ stenosis = GetStenosisDiameter(iSlice); }
1261 if (analysisTypeStenosis==2 ){ stenosis = GetStenosisArea(iSlice); }
1265 areaB = _mar->getAverageArea(iSlice-sizeHealthyRegion,iSlice+sizeHealthyRegion);
1266 _3DWorld->InitListContourActor( 0, _mar->getNumberOfSlices() );
1270 if ((stenosis>maxStenosis) &&(minSurf==true)){
1271 maxStenosis=stenosis;
1274 if ((areaB>maxArea) && (maxSurf==true)){
1276 healthySlice=iSlice;
1278 MoveSlider( iSlice );
1279 _sl_Slice->SetValue( iSlice );
1285 MoveSlider( sickSlice );
1286 _sl_Slice->SetValue( sickSlice );
1290 MoveSlider( healthySlice );
1291 _sl_Slice->SetValue( healthySlice );
1299 //------------------------------------------------------------------------
1300 int wxQuantificationWidgetCT::GetHealthySlice(){
1301 return _mar->getHealthySlice( );
1303 //------------------------------------------------------------------------
1304 void wxQuantificationWidgetCT::SetHealthySlice(int healthySlice){
1305 if (healthySlice==-1) {
1306 healthySlice=_sl_Slice->GetValue();
1308 /*int sizeHealthyRegion = GetSizeHealthyRegion();
1309 int maxSlider = GetMaxActualSlice();
1310 int healthySliceStart = healthySlice - sizeHealthyRegion;
1311 int healthySliceEnd = healthySlice + sizeHealthyRegion;
1312 if (healthySliceStart < 0) { healthySliceStart = 0; }
1313 if (healthySliceEnd < 0) { healthySliceEnd = 0; }
1314 if (healthySliceStart > maxSlider) { healthySliceStart = maxSlider; }
1315 if (healthySliceEnd > maxSlider) { healthySliceEnd = maxSlider; }
1316 _mar->setHealthySlice( healthySliceStart, healthySlice , healthySliceEnd);
1318 _3DWorld->Set3DHealthySliceActor( );
1319 _3DWorld->Show3DHealthySliceActor();
1320 _cb_HealthySlice->SetValue(true);
1321 _3DWorld->InitListContourActor( 1, _mar->getNumberOfSlices() );
1323 for ( iHealthySlice=healthySliceStart ; iHealthySlice<=healthySliceEnd ; iHealthySlice++){
1324 _3DWorld->Set3DContourActor( iHealthySlice , _mar->get3Dcontour(iHealthySlice, iHealthySlice) , true ,1);
1333 //--------------------------------------------------------------------
1335 void wxQuantificationWidgetCT::OnHealthySlice_CB(wxCommandEvent& event)
1339 int healthySlice = _mar->getHealthySlice( );
1340 if (healthySlice!=-1) {
1341 if ( _cb_HealthySlice->GetValue() )
1342 _3DWorld->Show3DHealthySliceActor();
1344 _3DWorld->Hide3DHealthySliceActor();
1349 //--------------------------------------------------------------------
1350 void wxQuantificationWidgetCT::OnVisibleRing_CB(wxCommandEvent& event){
1351 if ( _cb_VisibleRings->GetValue() ){
1352 _3DWorld->Show3DContourActor();
1353 // _2DWorld->Show2DContourDiameters();
1356 _3DWorld->Hide3DContourActor();
1357 // _2DWorld->Hide2DContourDiameters();
1362 //--------------------------------------------------------------------
1363 void wxQuantificationWidgetCT::OnPerpendicular_CB(wxCommandEvent& event)
1365 if ( _cb_Perpendicular->GetValue() )
1366 _3DWorld->Show3DSliceActor();
1368 _3DWorld->Hide3DSliceActor();
1370 //--------------------------------------------------------------------
1372 void wxQuantificationWidgetCT::OnGreyScale_RB(wxCommandEvent& event){
1373 if ( _rb_GreyScale->GetValue() ){
1374 _3DWorld->SetBWLookUp();
1377 //--------------------------------------------------------------------
1378 void wxQuantificationWidgetCT::OnColor_RB(wxCommandEvent& event){
1379 if ( _rb_Color->GetValue() ){
1380 _3DWorld->SetColorLookUp();
1383 //--------------------------------------------------------------------
1384 void wxQuantificationWidgetCT::CallBackOnLeftDClick( wxMouseEvent& event ){
1386 double pp[3], cp[3];
1387 _3DWorld->GetLast3DClickPoint(pp,cp);
1389 int i,iback,maxPoints;
1391 double dist,distMin=-1;
1394 marAxis *maraxis = _mar->getAxis( );
1395 maxPoints = maraxis->getNumberOfSplinePoints();
1396 for ( i=0 ; i<maxPoints ; i++ ){
1397 c = maraxis->getSplinePoint(i);
1401 dist=sqrt( cc[0]*cc[0] + cc[1]*cc[1] + cc[2]*cc[2] );
1402 if ((distMin==-1) || (dist<distMin)) {
1407 _sl_Slice->SetValue(iback);
1412 //--------------------------------------------------------------------
1413 void wxQuantificationWidgetCT::CallBackOnMouseWheel( wxMouseEvent& event ){
1414 int slice=_sl_Slice->GetValue();
1415 if (event.GetWheelRotation()>0){ slice++; }
1416 if (event.GetWheelRotation()<0){ slice--; }
1417 if (slice < _sl_Slice->GetMin() ) { slice=_sl_Slice->GetMin(); }
1418 if (slice > _sl_Slice->GetMax() ) { slice=_sl_Slice->GetMax(); }
1419 _sl_Slice->SetValue(slice);
1422 //--------------------------------------------------------------------
1423 int wxQuantificationWidgetCT::GetActualSlice(){
1424 return _sl_Slice->GetValue();
1426 //--------------------------------------------------------------------
1427 void wxQuantificationWidgetCT::SetActualSlice(int slice){
1428 _sl_Slice->SetValue(slice);
1431 //--------------------------------------------------------------------
1432 int wxQuantificationWidgetCT::GetMaxActualSlice(){
1433 return _sl_Slice->GetMax();
1435 //--------------------------------------------------------------------
1436 int wxQuantificationWidgetCT::GetSizeHealthyRegion(){
1437 return _sizeHealthyRegion;
1439 //--------------------------------------------------------------------
1440 void wxQuantificationWidgetCT::SetSizeHealthyRegion(int size){
1441 _sizeHealthyRegion = size;
1443 //--------------------------------------------------------------------
1444 void wxQuantificationWidgetCT::GetHealthySliceRange(int &healthySliceStart,int &healthySliceEnd){
1445 healthySliceStart = _mar->getHealthySliceStart( );
1446 healthySliceEnd = _mar->getHealthySliceEnd( );
1449 //--------------------------------------------------------------------
1450 void wxQuantificationWidgetCT::Set3DRegionSliceActor( int type, int k1,int k2 ){
1451 _3DWorld->Set3DRegionSliceActor(type,k1,k2);
1453 //--------------------------------------------------------------------
1454 void wxQuantificationWidgetCT::Set3DStartRegionSliceActor( int type, int k){
1455 // _3DWorld->Set3DStartRegionSliceActor(type,k);
1457 //--------------------------------------------------------------------
1458 void wxQuantificationWidgetCT::Set3DEndRegionSliceActor( int type, int k){
1459 // _3DWorld->Set3DEndRegionSliceActor(type,k);
1461 //--------------------------------------------------------------------
1462 void wxQuantificationWidgetCT::Show3DRegionSliceActor( int type ){
1463 _3DWorld->Show3DRegionSliceActor(type);
1465 //--------------------------------------------------------------------
1466 void wxQuantificationWidgetCT::Show3DStartRegionSliceActor( int type ){
1467 _3DWorld->Show3DStartRegionSliceActor(type);
1469 //--------------------------------------------------------------------
1470 void wxQuantificationWidgetCT::Show3DEndRegionSliceActor( int type ){
1471 _3DWorld->Show3DEndRegionSliceActor(type);
1473 //--------------------------------------------------------------------
1474 void wxQuantificationWidgetCT::Hide3DRegionSliceActor( int type ){
1475 _3DWorld->Hide3DRegionSliceActor(type);
1477 //--------------------------------------------------------------------
1478 void wxQuantificationWidgetCT::Hide3DStartRegionSliceActor( int type ){
1479 _3DWorld->Hide3DStartRegionSliceActor(type);
1481 //--------------------------------------------------------------------
1482 void wxQuantificationWidgetCT::Hide3DEndRegionSliceActor( int type ){
1483 _3DWorld->Hide3DEndRegionSliceActor(type);
1485 //--------------------------------------------------------------------
1486 void wxQuantificationWidgetCT::GetSliceLimites(int type, int &sliceStart, int &sliceEnd){
1487 _3DWorld->GetSliceLimites(type,sliceStart,sliceEnd);
1489 //--------------------------------------------------------------------
1490 int wxQuantificationWidgetCT::GetAnalysisTypeStenosis(){
1491 return _3DWorld->GetAnalysisTypeStenosis();
1493 //--------------------------------------------------------------------
1494 void wxQuantificationWidgetCT::SetAnalysisTypeStenosis(int analysisTypeStenosis){
1495 _3DWorld->SetAnalysisTypeStenosis(analysisTypeStenosis);
1497 //--------------------------------------------------------------------
1498 void wxQuantificationWidgetCT::SetManualContour_2DWorld(bool ok){
1501 // _2DWorld->SetState(1);
1502 // _2DWorld->EraseManualContour();
1505 // _2DWorld->SetState(2);
1506 // _2DWorld->CreateNewManualContour();
1510 //--------------------------------------------------------------------
1511 //TODO: SIM - MODIFICAR PARA VARIOS CONTORNOS
1512 void wxQuantificationWidgetCT::SetManualContour_AddPoint_2DWorld(){
1513 _bak_ActualSlice = _sl_Slice->GetValue();
1514 // _2DWorld->Hide2DContourDiameters();
1516 _mar->EraseContour(_bak_ActualSlice);
1518 _3DWorld->Erase3DContourActor( _bak_ActualSlice );
1520 // _2DWorld->SetStateManualContour(0);
1522 //--------------------------------------------------------------------
1523 void wxQuantificationWidgetCT::SetManualContour_InsertPoint_2DWorld(){
1524 // _2DWorld->SetStateManualContour(2);
1526 //--------------------------------------------------------------------
1527 void wxQuantificationWidgetCT::SetManualContour_ErasePoint_2DWorld(){
1528 // _2DWorld->SetStateManualContour(3);
1530 //--------------------------------------------------------------------
1531 void wxQuantificationWidgetCT::SetManualContour_MovePoint_2DWorld(){
1532 // _2DWorld->SetStateManualContour(4);
1534 //--------------------------------------------------------------------
1535 void wxQuantificationWidgetCT::SetManualContour_ReplaceContour(){
1536 /* if (_bak_ActualSlice!=-1){
1537 int size = _2DWorld->GetNumberOfPointsSplineManualContour();
1538 double *vx = _2DWorld->GetVectorPointsXManualContour();
1539 double *vy = _2DWorld->GetVectorPointsYManualContour();
1541 _mar->replaceContour2D(_bak_ActualSlice,size,vx,vy);
1545 _bak_ActualSlice=-1;
1547 //TODO El remplazo de contornos debe cambiar
1549 //------------------------------------------------------------------------
1550 kVolume* wxQuantificationWidgetCT::GetVolumeAxisExtended(int wz1,int wz2)
1553 vtkImageData *imagedata;
1554 imagedata=_mar->getSliceImage(wz1);
1556 imagedata->GetDimensions (dims);
1560 kVolume *kvol =new kVolume( kVolume::USHORT, wx, wy, wz,1, 1, 1, malloc(sizeof(unsigned short)*wx*wy*wz ) );
1561 vtkImageData *vol = kvol->castVtk();
1565 for (i=wz1;i<=wz2;i++)
1568 imagedata=_mar->getSliceImage(i);
1571 void *p_imagedata = imagedata->GetScalarPointer(0,0,0);
1572 void *p_vol = vol->GetScalarPointer(0,0,i-wz1);
1573 memcpy( p_vol, p_imagedata , sizeof(unsigned short)*dims[0]*dims[1] );
1578 //-------------------------------------------------------------------
1579 wxWindow* wxQuantificationWidgetCT::CreateView2DPanel(wxWindow *parent)
1581 wxPanel *panel = new wxPanel(parent,-1);
1582 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
1584 _imageviewer2D_1 = new wxVtk2DBaseView(panel);
1585 wxVTKRenderWindowInteractor *iren = _imageviewer2D_1->GetWxVTKRenderWindowInteractor();
1586 sizer->Add(iren , 1, wxEXPAND, 0);
1589 panel->SetSizer(sizer);
1590 panel->SetAutoLayout(true);
1591 panel->SetSize(400,400);
1596 //------------------------------------------------------------------------
1597 void wxQuantificationWidgetCT::Refresh()
1599 _imageviewer2D_1->Refresh();
1602 //------------------------------------------------------------------------
1603 void wxQuantificationWidgetCT::RefreshView(marImageData *marimagedata)
1605 vtkImageData *imagedata= marimagedata->GetImageData(); // t=0
1606 _imageviewer2D_1->SetActualSlice(0);
1607 imagedata->UpdateInformation();
1608 imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
1609 imagedata->Update();
1612 _vtkbasedata_1->SetMarImageData(marimagedata);
1613 _imageviewer2D_1->ResetView();
1616 for (i = 0; i < _manContours.size(); i++)
1618 if (_manContours[i] !=NULL)
1620 _manContours[i]->clear();
1624 for (i = 0; i < _manContours.size(); i++)
1626 if (_manContours[i] !=NULL)
1628 _manContours[i]->refreshWall(_imageviewer2D_1);
1629 _manContours[i]->refreshLumen(_imageviewer2D_1);
1632 for (j = 0; j < _manContours[i]->getNumberOfCalcContours(); j++)
1634 _manContours[i]->refreshCalc(j,_imageviewer2D_1);
1637 for (j = 0; j < _manContours[i]->getNumberOfHypoContours(); j++)
1639 _manContours[i]->refreshHypo(j,_imageviewer2D_1);
1653 /* _mViewContourWall->ClearContour();
1654 _mViewContourLumen->ClearContour();
1656 delete _mViewContourWall;
1657 delete _manContourControlWall;
1658 delete _mContourModelWall;
1660 delete _mViewContourLumen;
1661 delete _manContourControlLumen;
1662 delete _mContourModelLumen;
1664 CreateManualContours();
1668 //------------------------------------------------------------------------
1669 void wxQuantificationWidgetCT::ConfigureVTK(marImageData *marimagedata)
1673 vtkImageData *imagedata=marimagedata->GetImageData(); // t=0
1674 imagedata->UpdateInformation();
1675 imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
1676 imagedata->Update();
1678 _vtkbasedata_1 = new vtkBaseData();
1679 _vtkbasedata_1->SetMarImageData(marimagedata);
1680 _imageviewer2D_1->SetVtkBaseData( _vtkbasedata_1 );
1681 _imageviewer2D_1->Configure();
1684 _contourViewer = new ContourView();
1685 _contourViewer->SetWxVtkBaseView(_imageviewer2D_1);
1686 _lineViewer = new LineView();
1687 _lineViewer->SetWxVtkBaseView(_imageviewer2D_1);
1688 _pointViewer = new PointView();
1689 _pointViewer->SetWxVtkBaseView(_imageviewer2D_1);
1690 CreateManualContours();
1694 //------------------------------------------------------------------------
1695 void wxQuantificationWidgetCT::OnContourWall()
1697 if (_manContours[_mar->getActualQuant()]->getWallController() == NULL)
1699 _manContours[_mar->getActualQuant()]->createWallContour(_imageviewer2D_1);
1700 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
1701 _manContours[_mar->getActualQuant()]->getWallController() );
1703 _manContours[_mar->getActualQuant()]->setWallActive();
1704 _manContours[_mar->getActualQuant()]->setWallVisibility(true);
1707 //------------------------------------------------------------------------
1708 void wxQuantificationWidgetCT::OnContourLumen()
1710 if (_manContours[_mar->getActualQuant()]->getLumenController() == NULL)
1712 _manContours[_mar->getActualQuant()]->createLumenContour(_imageviewer2D_1);
1713 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
1714 _manContours[_mar->getActualQuant()]->getLumenController() );
1716 _manContours[_mar->getActualQuant()]->setLumenActive();
1718 //------------------------------------------------------------------------
1719 void wxQuantificationWidgetCT::OnContourHypo()
1724 if (_manContours[_mar->getActualQuant()]->getNumberOfHypoContours() > 0)
1727 int answer = wxMessageBox(_T("Create new hypodense contour? (answer no, will modify existing ones)"),
1728 _T("Confirm"), wxYES_NO | wxCANCEL, this);
1730 if (answer == wxYES)
1732 addManualContours(HYPODENSE);
1733 int tam = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours() - 1;
1734 _manContours[_mar->getActualQuant()] -> setHypoContourActive(tam);
1737 else if (answer == wxNO)
1739 _manContours[_mar->getActualQuant()] ->setHypoActive();
1744 addManualContours(HYPODENSE);
1745 int tam = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours() - 1;
1746 _manContours[_mar->getActualQuant()] -> setHypoContourActive(tam);
1754 //------------------------------------------------------------------------
1755 void wxQuantificationWidgetCT::OnContourCalc()
1759 if (_manContours[_mar->getActualQuant()]->getNumberOfCalcContours() > 0)
1762 int answer = wxMessageBox(_T("Create new calcification contour? (answer no, will modify existing ones)"),
1763 _T("Confirm"), wxYES_NO | wxCANCEL, this);
1765 if (answer == wxYES)
1767 addManualContours(CALCIFICATION);
1768 int tam = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours() - 1;
1769 _manContours[_mar->getActualQuant()] -> setCalcContourActive(tam);
1772 else if (answer == wxNO)
1774 _manContours[_mar->getActualQuant()] ->setCalcActive();
1779 addManualContours(CALCIFICATION);
1780 int tam = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours() - 1;
1781 _manContours[_mar->getActualQuant()] -> setCalcContourActive(tam);
1788 //------------------------------------------------------------------------
1789 void wxQuantificationWidgetCT::OnReplaceContourWall()
1792 int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
1793 double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
1794 double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();
1797 _mar->cleanContours(WALL);
1798 _mar->replaceContour2D(size,vx,vy,WALL);
1799 _manContours[_mar->getActualQuant()]->clearWall();
1800 _manContours[_mar->getActualQuant()]->restartWallContour(_imageviewer2D_1);
1806 //------------------------------------------------------------------------
1807 void wxQuantificationWidgetCT::OnReplaceContourLumen()
1809 int size = _manContours[_mar->getActualQuant()]->getNumberOfLumenContourPoints();
1810 double *vx = _manContours[_mar->getActualQuant()]->getXVectorLumenPoints();
1811 double *vy = _manContours[_mar->getActualQuant()]->getYVectorLumenPoints();
1813 _mar->cleanContours(ELUMEN);
1814 _mar->replaceContour2D(size,vx,vy,ELUMEN);
1815 _manContours[_mar->getActualQuant()]->clearLumen();
1816 _manContours[_mar->getActualQuant()]->restartLumenContour(_imageviewer2D_1);
1820 //------------------------------------------------------------------------
1821 void wxQuantificationWidgetCT::OnReplaceContourCalc()
1823 int conts = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours();
1825 _mar->cleanContours(CALCIFICATION);
1826 for (int i = 0; i < conts; i++)
1828 int size = _manContours[_mar->getActualQuant()]->getNumberOfCalcContourPoints(i);
1829 double *vx = _manContours[_mar->getActualQuant()]->getXVectorCalcPoints(i);
1830 double *vy = _manContours[_mar->getActualQuant()]->getYVectorCalcPoints(i);
1831 _mar->replaceContour2D(size,vx,vy,CALCIFICATION);
1833 _manContours[_mar->getActualQuant()]->clearCalc();
1834 _manContours[_mar->getActualQuant()]->restartCalcContours();
1838 //------------------------------------------------------------------------
1839 void wxQuantificationWidgetCT::OnReplaceContourHypo()
1841 /* int conts = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours();
1843 _mar->cleanContours(HYPODENSE);
1844 for (int i = 0; i < conts; i++)
1846 int size = _manContours[_mar->getActualQuant()]->getNumberOfHypoContourPoints(i);
1847 double *vx = _manContours[_mar->getActualQuant()]->getXVectorHypoPoints(i);
1848 double *vy = _manContours[_mar->getActualQuant()]->getYVectorHypoPoints(i);
1851 _manContours[_mar->getActualQuant()]->clearHypo();
1852 _manContours[_mar->getActualQuant()]->restartHypoContours();
1857 //------------------------------------------------------------------------
1858 void wxQuantificationWidgetCT::performXOR()
1860 if (_manContours [_mar->getActualQuant()]->getWallController() != NULL)
1862 int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
1863 double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
1864 double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();
1866 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1867 std::vector<marIsocontour *> walls;
1871 double intersection = _mar->performUnion(WALL,walls);
1872 double xor_ = _mar->performXOR(WALL,walls);
1874 xor_ = xor_ / intersection;
1875 wxLogMessage(wxString("Indice XOR (pared): %f", wxConvUTF8), xor_*100);
1877 double and_ = _mar->performAND(WALL,walls);
1878 and_ = and_/ intersection;
1881 wxLogMessage(wxString("Indice AND (pared): %f", wxConvUTF8), and_*100);
1884 wxLogMessage(wxString("Indice Uni�n (pared): %f", wxConvUTF8), intersection);
1895 razon = xor_ / and_;
1898 wxLogMessage(wxString("Raz�n (pared): %f", wxConvUTF8), razon);
1902 wxLogMessage(wxString("SIN INFORMACION PARED", wxConvUTF8));
1907 if (_manContours [_mar->getActualQuant()]->getLumenController() != NULL)
1909 int size = _manContours[_mar->getActualQuant()]->getNumberOfLumenContourPoints();
1910 double* vx = _manContours[_mar->getActualQuant()]->getXVectorLumenPoints();
1911 double* vy = _manContours[_mar->getActualQuant()]->getYVectorLumenPoints();
1912 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1913 std::vector<marIsocontour *> lumen;
1917 double intersection = _mar->performUnion(ELUMEN,lumen);
1918 double xor_ = _mar->performXOR(ELUMEN,lumen);
1919 xor_ = xor_ / intersection;
1920 wxLogMessage(wxString("Indice OR (lumen): %f", wxConvUTF8), xor_*100);
1922 double and_ = _mar->performAND(ELUMEN,lumen);
1923 and_ = and_/ intersection;
1924 wxLogMessage(wxString("Indice AND (lumen): %f", wxConvUTF8), and_*100);
1927 wxLogMessage(wxString("Indice Uni�n (pared): %f", wxConvUTF8), intersection);
1937 razon = xor_ / and_;
1939 wxLogMessage(wxString("Raz�n (lumen): %f", wxConvUTF8), razon);
1943 wxLogMessage(wxString("SIN INFORMACION LUMEN", wxConvUTF8));
1950 int conts = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours();
1952 std::vector<marIsocontour *> calc;
1953 for (int i = 0; i < conts; i++)
1955 int size = _manContours[_mar->getActualQuant()]->getNumberOfCalcContourPoints(i);
1956 double* vx = _manContours[_mar->getActualQuant()]->getXVectorCalcPoints(i);
1957 double* vy = _manContours[_mar->getActualQuant()]->getYVectorCalcPoints(i);
1958 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1964 double intersection = _mar->performUnion(CALCIFICATION,calc);
1965 double xor_ = _mar->performXOR(CALCIFICATION,calc);
1966 xor_ = xor_ /intersection;
1968 wxLogMessage(wxString("Indice OR (calc): %f", wxConvUTF8), xor_*100);
1970 double and_ = _mar->performAND(CALCIFICATION,calc);
1971 and_ = and_ / intersection;
1972 wxLogMessage(wxString("Indice AND (calc): %f", wxConvUTF8), and_*100);
1975 wxLogMessage(wxString("Indice Uni�n (pared): %f", wxConvUTF8), intersection);
1985 razon = xor_ / and_;
1988 wxLogMessage(wxString("Raz�n (calc): %f", wxConvUTF8), razon);
1992 wxLogMessage(_T("INFORMACION NO DISPONIBLE PARA CALCIFICACION"));
1997 void wxQuantificationWidgetCT::performAND()
2000 int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
2001 double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
2002 double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();
2004 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
2005 std::vector<marIsocontour *> walls;
2014 void wxQuantificationWidgetCT::getIndex()
2018 //------------------------------------------------------------------------
2019 void wxQuantificationWidgetCT::OnSliderDiscontinuityScroll(int percentage)
2021 _mar->updateDiscontinuityThreshold(percentage);
2027 //------------------------------------------------------------------------
2028 void wxQuantificationWidgetCT::OnSliderLumenPercentageScroll(int percentage)
2030 _mar->updateLumenPercentage(percentage);
2031 _contourViewer->Refresh();
2035 //------------------------------------------------------------------------
2036 void wxQuantificationWidgetCT::OnCalibration()
2039 int actual = _mar->getActualQuant();
2040 _mar->ClearContoursPartial(actual - 1);
2041 _mar->setStartIndex(actual);
2042 _mar->setCalibration(true);
2044 wxLogMessage(_T("Contours calibrated"));
2045 _mar->markUpLumen(actual);
2049 //------------------------------------------------------------------------
2050 void wxQuantificationWidgetCT::OnFile()
2053 _mar->generateFile();
2056 //------------------------------------------------------------------------
2057 void wxQuantificationWidgetCT::OnShowAll(bool value)
2065 //------------------------------------------------------------------------
2066 void wxQuantificationWidgetCT::OnShowWall(bool value)
2069 _manContours[_mar->getActualQuant()]->setWallVisibility(value);
2070 _imageviewer2D_1->Refresh();
2071 _imageviewer2D_1->RefreshView();
2073 //------------------------------------------------------------------------
2074 void wxQuantificationWidgetCT::OnShowLumen(bool value)
2076 _manContours[_mar->getActualQuant()]->setLumenVisibility(value);
2077 _imageviewer2D_1->Refresh();
2078 _imageviewer2D_1->RefreshView();
2081 //------------------------------------------------------------------------
2082 void wxQuantificationWidgetCT::OnShowCalc(bool value)
2084 _manContours[_mar->getActualQuant()]->setCalcVisibility(value);
2085 _imageviewer2D_1->Refresh();
2086 _imageviewer2D_1->RefreshView();
2089 //------------------------------------------------------------------------
2090 void wxQuantificationWidgetCT::OnShowHypo(bool value)
2092 _manContours[_mar->getActualQuant()]->setHypoVisibility(value);
2093 _imageviewer2D_1->Refresh();
2094 _imageviewer2D_1->RefreshView();
2097 //------------------------------------------------------------------------
2098 void wxQuantificationWidgetCT::OnSliderCalcPercentageScroll(int percentage)
2100 int actual = _mar->getActualQuant();
2101 _mar->updateCalcPercentage(percentage);
2102 _contourViewer->Refresh();
2103 //_mar->markUpLumen(actual);
2109 //------------------------------------------------------------------------
2110 void wxQuantificationWidgetCT::CreateManualContours()
2114 for (int i = 0; i < _mar->getNumberOfSlices(); i++)
2116 if (_manContours[i] != NULL && _mar->getActualQuant() != i)
2118 _manContours[i]->setWallVisibility(false);
2119 _manContours[i]->setLumenVisibility(false);
2120 _manContours[i]->setCalcVisibility(false);
2121 _manContours[i]->setHypoVisibility(false);
2122 _manContours[i]->inactivate();
2126 _imageviewer2D_1->Refresh();
2129 //_imageviewer2D_1->RefreshView();
2131 if (_manContours[_mar->getActualQuant()] == NULL)
2133 _manContours[_mar->getActualQuant()] = new manualContourContainer();
2135 /* _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getWallController() );
2136 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getLumenController() );*/
2140 _manContours[_mar->getActualQuant()]->setWallVisibility(true);
2141 _manContours[_mar->getActualQuant()]->setLumenVisibility(true);
2142 _manContours[_mar->getActualQuant()]->setCalcVisibility(true);
2143 _manContours[_mar->getActualQuant()]->setHypoVisibility(true);
2144 _imageviewer2D_1->Refresh();
2145 _imageviewer2D_1->RefreshView();
2151 //------------------------------------------------------------------------
2152 void wxQuantificationWidgetCT::addManualContours(int type)
2156 if (type == CALCIFICATION)
2158 tam = _manContours[_mar->getActualQuant()]->addCalcificationContour(_imageviewer2D_1);
2159 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getCalcController(tam) );
2161 else if (type == HYPODENSE)
2163 tam = _manContours[_mar->getActualQuant()]->addHypodenseContour(_imageviewer2D_1);
2164 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getHypoController(tam) );
2169 // EOF - wxQuantificationWidgetCT.cxx