3 /*=========================================================================
6 Module: $RCSfile: wxQuantificationWidgetCT.cxx,v $
8 Date: $Date: 2009/05/14 13:54:57 $
9 Version: $Revision: 1.1 $
11 Copyright: (c) 2002, 2003
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.
18 =========================================================================*/
20 #include "wxQuantificationWidgetCT.h"
21 #include "../marDictionary.h"
22 #include "vtkPolyDataWriter.h"
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 )
40 EVT_RADIOBUTTON(ID_RADIOBUTTON_GREYSCALE, wxQuantificationWidgetCT::OnGreyScale_RB )
41 EVT_RADIOBUTTON(ID_RADIOBUTTON_COLOR, wxQuantificationWidgetCT::OnColor_RB )
43 EVT_COMMAND_SCROLL(ID_SLIDER_SLICE, wxQuantificationWidgetCT::OnSliderSliceScroll )
45 EVT_COMMAND_SCROLL(ID_SLIDER_OPACITY, wxQuantificationWidgetCT::OnSliderOpacityScroll )
46 EVT_COMMAND_SCROLL_THUMBRELEASE(ID_SLIDER_ISOVALUE, wxQuantificationWidgetCT::OnSliderIsovalueScroll )
50 //--------------------------------------------------------------------------------
52 //--------------------------------------------------------------------------------
53 wxQuantificationWidgetCT::wxQuantificationWidgetCT(wxWindow* parent, wxWindowID id,
54 const wxPoint& pos, const wxSize& size, long style,
56 : wxQuantificationWidget_base( parent, id, pos, size, style, name )
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);
68 SetSizeHealthyRegion( 5 );
71 // this->SetBackgroundColour(*wxLIGHT_GREY);
73 _3DWorld = new vtk3DQuantSurfaceWidget( panel_left, ID_QUANTIF3D );
76 //EED OJO Este NULL es solo para que compile
77 _3DWorld->SetInterfaceVtkPanelWidgets(NULL);
79 // _2DWorld = new vtk2DQuantSliceWidget( panel_right_up, -1 );
80 // _2DWorld->SetSize(200,200);
82 //EED OJO Este NULL es solo para que compile
83 // _2DWorld->SetInterfaceVtkPanelWidgets(NULL);
95 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
96 sizer->Add( CreatePanelPrincipal(this), 1, wxALL|wxEXPAND, 0 );
97 sizer->Add( CreatePanelStatus(this) , 0, wxALL|wxEXPAND, 0 );
107 //--------------------------------------------------------------------------------
109 // ----------------------------------------------------------------------------
110 wxQuantificationWidgetCT::~wxQuantificationWidgetCT( ){
112 delete _contourViewer;
117 for (int i = 0; i < _manContours.size(); i++)
119 delete _manContours[i];
120 _manContours[i] = NULL;
122 delete _imageviewer2D_1;
124 // ----------------------------------------------------------------------------
125 wxWindow* wxQuantificationWidgetCT::CreatePanelPrincipal(wxWindow *parent)
127 wxPanel *panel = new wxPanel(parent,-1);
128 _splitPanelPrincipal = new wxSplitterWindow(panel, -1);
129 _splitPanelPrincipal->SetMinimumPaneSize(50);
131 wxWindow *principal_Left = CreatePanel_Left(_splitPanelPrincipal) ;
132 wxWindow *principal_Right = CreatePanel_Right(_splitPanelPrincipal);
134 _splitPanelPrincipal->SplitVertically(principal_Left , principal_Right,600 );
137 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
138 sizer->Add( _splitPanelPrincipal, 1,wxGROW,0 );
139 panel->SetSizer(sizer);
144 // ----------------------------------------------------------------------------
145 wxWindow* wxQuantificationWidgetCT::CreatePanel_Left(wxWindow *parent)
147 wxPanel *panel = new wxPanel(parent,-1);
148 _splitpanel_left = new wxSplitterWindow(panel, -1);
149 _splitpanel_left->SetMinimumPaneSize(50);
151 _3DWorld = new vtk3DQuantSurfaceWidget( _splitpanel_left, ID_QUANTIF3D );
152 _3DWorld->SetInterfaceVtkPanelWidgets(NULL);
153 wxWindow *controlPanel3D = CreateControlPanel3D(_splitpanel_left);
155 _splitpanel_left->SplitHorizontally(_3DWorld , controlPanel3D,0 );
158 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
159 sizer->Add( _splitpanel_left, 1,wxGROW,0 );
160 panel->SetSizer(sizer);
166 // ----------------------------------------------------------------------------
167 wxWindow* wxQuantificationWidgetCT::CreateControlPanel3D(wxWindow *parent)
169 wxPanel *panel = new wxPanel(parent,-1);
170 marDictionary marDict;
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);
177 _rb_GreyScale = new wxRadioButton( panel, ID_RADIOBUTTON_GREYSCALE, wxString(marDict.GetString(230), wxConvUTF8), wxDefaultPosition,wxDefaultSize,wxRB_GROUP ); //"greyscale "
178 _rb_GreyScale->SetValue(true);
180 _rb_Color = new wxRadioButton( panel, ID_RADIOBUTTON_COLOR, wxString(marDict.GetString(235), wxConvUTF8), wxDefaultPosition,wxDefaultSize );//"color "
181 _rb_Color->SetValue(false);
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);
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);
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);
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 );
204 _sl_Slice->SetSize(800,16);
205 _sl_Isovalue->SetSize(300,16);
206 _sl_Opacity->SetSize(300,16);
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 "
213 _txt_Position = new wxStaticText(panel, -1, _T(" ") ); //"Position "
218 wxFlexGridSizer *axe = new wxFlexGridSizer(1);
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);
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);
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);
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);
244 axe4->Add(_st_Isovalue , 1, wxALL|wxEXPAND, 0);
245 axe4->Add(_sl_Isovalue , 1, wxALL|wxGROW, 0);
246 axe4->AddGrowableCol(1);
248 axe5->Add(_bt_AddContour3D , 1 );
249 axe5->Add(_bt_CleanContour3D , 1 );
250 axe5->Add(_bt_CleanAllContours3D , 1 );
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);
262 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
263 sizer->Add( axe, 1,wxALL|wxGROW,5 );
264 panel->SetSizer(sizer);
270 // ----------------------------------------------------------------------------
271 wxWindow* wxQuantificationWidgetCT::CreatePanel_Right(wxWindow *parent)
273 wxPanel *panel = new wxPanel(parent,-1);
274 _splitpanel_right = new wxSplitterWindow(panel, -1);
275 _splitpanel_right->SetMinimumPaneSize(50);
277 wxWindow *window2D = CreateView2DPanel(_splitpanel_right);
278 wxWindow *windowRightDown = CreatePanel_Right_Down(_splitpanel_right);
280 _splitpanel_right->SplitHorizontally(window2D , windowRightDown,0 );
283 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
284 sizer->Add( _splitpanel_right, 1,wxGROW,0 );
285 panel->SetSizer(sizer);
291 // ----------------------------------------------------------------------------
292 wxWindow* wxQuantificationWidgetCT::CreatePanel_Right_Down(wxWindow *parent)
294 wxPanel *panel = new wxPanel(parent,-1);
295 _splitpanel_right_down = new wxSplitterWindow(panel, -1);
296 _splitpanel_right_down->SetMinimumPaneSize(10);
298 _pl_cntlHealthySick2 = new wxPanelControlsHealthySickSliceCT(_splitpanel_right_down,this);
299 _wxStenosisPanel = CreateStenosisPanel(_splitpanel_right_down);
301 _splitpanel_right_down->SplitHorizontally(_pl_cntlHealthySick2,_wxStenosisPanel ,300 );
304 wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
305 sizer->Add( _splitpanel_right_down, 1,wxGROW,0 );
306 panel->SetSizer(sizer);
312 // ----------------------------------------------------------------------------
313 wxWindow* wxQuantificationWidgetCT::CreatePanelStatus(wxWindow *parent)
315 wxPanel *panel = new wxPanel(parent,-1);
319 marDictionary marDict;
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"));
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("--"));
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);
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);
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);
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);
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);
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);
393 wxBoxSizer * sizer = new wxBoxSizer(wxHORIZONTAL);
394 sizer->Add( status, 1,wxALL|wxEXPAND,0 );
395 panel->SetSizer(sizer);
399 // ----------------------------------------------------------------------------
400 wxWindow* wxQuantificationWidgetCT::CreateStenosisPanel(wxWindow *parent){
401 marDictionary marDict;
403 wxPanel* panel = new wxPanel(parent);
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, " ");
412 // _st_LabelBlanc->SetBackgroundColour(*wxLIGHT_GREY);
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);
422 wxFont font(14,wxDEFAULT ,wxNORMAL,wxBOLD);
423 _st_Value100->SetFont(font);
424 _st_Value101->SetFont(font);
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);
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);
442 panel->SetAutoLayout(true);
443 panel->SetSizer(gridSizer);
446 // panel->SetBackgroundColour(*wxLIGHT_GREY);
447 panel->SetSize(400,300);
448 panel->SetSize( gridSizer->GetMinSize() );
453 //--------------------------------------------------------
455 void wxQuantificationWidgetCT::Set_control(){
456 marDictionary marDict;
458 _wxStenosisPanel = CreateStenosisPanel();
460 _cb_HealthySlice = new wxCheckBox( panel_left, ID_CHECKBOX_HEALTHY, wxT( marDict.GetString(205) )); // "Healthy slice"
461 _cb_HealthySlice->SetValue(true);
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);
467 // _cb_Perpendicular->SetBackgroundColour(*wxLIGHT_GREY);
469 _rb_GreyScale = new wxRadioButton( panel_left, ID_RADIOBUTTON_GREYSCALE, wxT(marDict.GetString(230)), wxDefaultPosition,wxDefaultSize,wxRB_GROUP ); //"greyscale "
470 _rb_GreyScale->SetValue(true);
472 // _rb_GreyScale->SetBackgroundColour(*wxLIGHT_GREY);
474 _rb_Color = new wxRadioButton( panel_left, ID_RADIOBUTTON_COLOR, wxT(marDict.GetString(235)), wxDefaultPosition,wxDefaultSize );//"color "
475 _rb_Color->SetValue(false);
477 // _rb_Color->SetBackgroundColour(*wxLIGHT_GREY);
479 _cb_VisibleRings = new wxCheckBox( panel_left, ID_CHECKBOX_VISIBLE_RINGS, wxT(marDict.GetString(215)));//"Visible rings"
480 _cb_VisibleRings->SetValue(true);
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);
486 // _cb_ShowSurface->SetBackgroundColour(*wxLIGHT_GREY);
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);
494 _bt_CleanAllContours3D = new wxButton( panel_left, ID_BUTTON_CLEAN_ALL, marDict.GetString(253) ,//"Erase all mark contours"
495 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
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 );
502 // _sl_Slice->SetBackgroundColour(*wxLIGHT_GREY);
503 // _sl_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
504 // _sl_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
507 _sl_Slice->SetSize(800,16);
508 _sl_Isovalue->SetSize(300,16);
509 _sl_Opacity->SetSize(300,16);
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 "
516 _txt_Position = new wxStaticText(panel_left, -1, " " ); //"Position "
519 // _st_Slice->SetBackgroundColour(*wxLIGHT_GREY);
520 // _st_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
521 // _st_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
524 _st_Label1 = new wxStaticText(this, -1, marDict.GetString(380) ); //"Total Axis Lenght"
525 _st_Value1 = new wxStaticText(this, -1, "0.00");
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");
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");
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");
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");
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");
552 // _st_Label8->SetBackgroundColour(*wxLIGHT_GREY);
553 // _st_Value8->SetBackgroundColour(*wxLIGHT_GREY);
555 _st_LabelRef101 = new wxStaticText(this, -1, marDict.GetString(385) );//"Seg. Length"
556 _st_ValueRef101 = new wxStaticText(this, -1, "--");
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, "--");
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, "--");
568 // _st_LabelRef103->SetBackgroundColour(*wxLIGHT_GREY);
569 // _st_ValueRef103->SetBackgroundColour(*wxLIGHT_GREY);
571 _pl_cntlHealthySick2 = new wxPanelControlsHealthySickSliceCT(panel_right_down,this);
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);
582 //--------------------------------------------------------
584 void wxQuantificationWidgetCT::Do_layout()
589 wxBoxSizer *sizer_principal = new wxBoxSizer(wxVERTICAL);
590 wxBoxSizer *status = new wxBoxSizer(wxHORIZONTAL);
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);
599 // wxFlexGridSizer *right_up_div = new wxFlexGridSizer(1,0);
602 wxBoxSizer *right_up_div = new wxBoxSizer(wxVERTICAL);
605 wxBoxSizer *medium_left = new wxBoxSizer(wxVERTICAL);
608 wxStaticBoxSizer *axe = new wxStaticBoxSizer(new wxStaticBox(this, -1, ""), wxVERTICAL);
611 // wxFlexGridSizer *axe1 = new wxFlexGridSizer(10,0);
612 wxBoxSizer *axe1 = new wxBoxSizer(wxHORIZONTAL);
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);
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);
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);
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);
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);
649 axe4->Add(_st_Isovalue , 1, wxALL|wxEXPAND, 0);
650 axe4->Add(_sl_Isovalue , 1, wxALL|wxEXPAND, 0);
652 axe5->Add(_bt_AddContour3D , 1 );
653 axe5->Add(_bt_CleanContour3D , 1 );
654 axe5->Add(_bt_CleanAllContours3D , 1 );
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);
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);
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);
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);
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);
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);
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);
716 panel_left->SetAutoLayout(true);
717 panel_left->SetSizer(medium_left);
718 panel_left->Layout();
720 panel_right_up->SetAutoLayout(true);
721 panel_right_up->SetSizer(medium_right_up);
722 panel_right_up->Layout();
724 panel_right_down->SetAutoLayout(true);
725 panel_right_down->SetSizer(medium_right_down);
726 panel_right_down->Layout();
728 panel_splitter_right->SetMinimumPaneSize( 50 );
729 panel_splitter_right->SplitHorizontally( panel_right_up, panel_right_down, 400 );
733 panel_splitter->SetMinimumPaneSize( 50 );
734 panel_splitter->SplitVertically( panel_left, panel_splitter_right, 420 );
737 sizer_principal->Add(panel_splitter, 1, wxALL|wxEXPAND, 0);
738 sizer_principal->Add(status, 0, wxALL|wxEXPAND, 0);
740 this->SetAutoLayout(true);
741 this->SetSizer(sizer_principal);
750 //--------------------------------------------------------
751 void wxQuantificationWidgetCT::Set_Data( )
765 _actual_darea = 0.00;
766 _actual_dperi = 0.00;
771 _actual_partial = 0.00;
779 //--------------------------------------------------------
780 void wxQuantificationWidgetCT::Forget( )
785 // ----------------------------------------------------------------------------
786 void wxQuantificationWidgetCT::ShowMARACASData( marInterfaceCT* mar )
789 vtkImageData* imagedata;
796 _mar->prepareQuantification();
797 nos = _mar->getNumberOfSlices();
799 //MAZV se añade para manejo de contornos manuales
800 for (int i = 0; i < nos; i++)
802 _manContours.push_back(NULL);
806 actualQuant = (int) (nos-1)/2 ;
807 imagedata = _mar->getSliceImage(actualQuant);
809 _mar->setActualQuant( actualQuant ) ;
810 _mar->getMinMax(min, max);
813 _3DWorld->ShowMARACASDataAndAxeCT( mar );
814 _3DWorld->InitCameraReset( );
815 // _2DWorld->ConstructVTK( imagedata );
818 ConfigureVTK( new marImageData(imagedata) );
821 _sl_Isovalue->SetRange( (int)min, (int)max);
822 _sl_Isovalue->SetValue( (int)(max/4) );
823 _sl_Opacity->SetValue( 50 );
831 // this->GetSize(&wwT,&hhT);
832 // _wxStenosisPanel->GetSize(&ww1,&hh1);
833 // _pl_cntlHealthySick2->GetSize(&ww2,&hh2);
835 // ss=hhT-(hh1+hh2+85);
837 // panel_splitter_right->SetSashPosition(ss,true);
839 _splitPanelPrincipal -> SetSashPosition(600,true);
840 _splitpanel_left -> SetSashPosition(360,true);
841 _splitpanel_right -> SetSashPosition(200,true);
842 _splitpanel_right_down -> SetSashPosition(230,true);
844 //----------------------------------------------------------------------------
845 void wxQuantificationWidgetCT::Reset_sl_Slider()
847 int nos = _mar->getNumberOfSlices();
849 _sl_Slice->SetRange(0, nos-1);
850 _sl_Slice->SetValue( (nos-1)/2 );
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 );
860 //----------------------------------------------------------------------------
861 void wxQuantificationWidgetCT::OnShowSurface_CB(wxCommandEvent& event)
863 _3DWorld->SetSurfaceVisibility( _cb_ShowSurface->GetValue() );
865 // ---------------------------------------------------------------------------
866 void wxQuantificationWidgetCT::ResetAxis(){
868 _mar->setActualQuant( _sl_Slice->GetValue() );
870 _3DWorld->Hide3DHealthySliceActor();
871 _mar->setHealthySlice( 0,-1,0 );
872 _mar->setActualQuant( _sl_Slice->GetValue() );
875 // ---------------------------------------------------------------------------
876 void wxQuantificationWidgetCT::RefreshAxis( ){
877 int actualQuant = _mar->getActualQuant();
878 vtkImageData* imagedata;
879 vtkProbeFilter* image3D;
880 vtkPolyData* vtkPolydata_2Dcontour;
883 // vtkPoints* vtkPoints_2DDiameterMin;
884 // vtkPoints* vtkPoints_2DDiameterMax;
886 int contours = _mar->getNumberOfContours(actualQuant);
888 image3D = _mar->get3DSlice ( actualQuant );
889 imagedata = _mar->getSliceImage ( actualQuant );
892 _contourViewer->DeleteContours();
893 _lineViewer->DeleteLines();
894 _pointViewer->DeletePoints();
899 _pointViewer->CreateNewPoint(64,64,0);
900 for (int i = 0; i < contours; i++)
903 vtkPolydata_2Dcontour = _mar->get2Dcontour( actualQuant, i );
905 // vtkPoints_2DDiameterMin = _mar->get2DDiameterMin ( actualQuant, 0 );
906 // vtkPoints_2DDiameterMax = _mar->get2DDiameterMax ( actualQuant, 0 );
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 );
916 int puntos = _mar->getPointSize();
918 for (int j = 0; j < puntos; j++)
920 marPoint *p = _mar->getPoint(j);
921 _pointViewer->CreateNewPoint(p->getX(),p->getY(),p->getType());
925 _3DWorld->SetImage(image3D);
927 // _2DWorld->SetImage(imagedata);
929 RefreshView( new marImageData(imagedata) );
942 // ----------------------------------------------------------------------------
943 void wxQuantificationWidgetCT::MoveSlider(int actualQuant){
945 if (actualQuant!=_bak_ActualSlice2)
947 _bak_ActualSlice2=actualQuant;
948 if (_bak_ActualSlice!=-1){
949 SetManualContour_ReplaceContour();
950 SetManualContour_2DWorld(false);
952 _mar->setActualQuant( actualQuant );
957 p = _mar->GetExperiment()->getAxis()->getPoints( actualQuant );
959 _mar->getDynData()->GetMarImageData()->GetImageData()->GetSpacing(spc);
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 (");
967 // ltoa ((int)nX,temp,10);
968 sprintf(temp,"%d",(int)nX);
970 strcat(resultText,temp);
971 strcat(resultText,",");
973 // ltoa ((int)nY,temp,10);
974 sprintf(temp,"%d",(int)nY);
976 strcat(resultText,temp);
977 strcat(resultText,",");
979 // ltoa ((int)nZ,temp,10);
980 sprintf(temp,"%d",(int)nZ);
982 strcat(resultText,temp);
983 strcat(resultText,")");
984 _txt_Position->SetLabel( wxString(resultText, wxConvUTF8) );
987 // ----------------------------------------------------------------------------
988 void wxQuantificationWidgetCT::OnSliderSliceScroll(wxScrollEvent& event){
989 MoveSlider( event.GetPosition() );
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() );
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() );
1004 // ----------------------------------------------------------------------------
1011 // ----------------------------------------------------------------------------
1012 void wxQuantificationWidgetCT::showVariables()
1015 // marContour* marcontour;
1019 int healthySliceStart;
1020 int healthySliceEnd;
1022 actualQuant = _mar->getActualQuant( );
1023 // marcontour=_mar->getContour( actualQuant, actualQuant );
1027 tmpString.Printf( _T("%.2f mm") , 20)/*_mar->getTotalLength() )*/; _st_Value1->SetLabel(tmpString);
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);
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);
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);
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("--"));
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);
1059 _st_ValueRef101->SetLabel(_T("--"));
1063 // ----------------------------------------------------------------------------
1064 double wxQuantificationWidgetCT::doubleStenosis(double healthy, double sick){
1069 result = ( (healthy-sick)/healthy) * 100 ;
1074 // ----------------------------------------------------------------------------
1075 wxString wxQuantificationWidgetCT::strStenosis(double stenosis){
1078 tmpString.Printf(_T("%d"),-1);
1080 tmpString.Printf(_T("%.2f"), stenosis );
1082 return tmpString + _T(" \%");
1084 // ----------------------------------------------------------------------------
1085 void wxQuantificationWidgetCT::OnSliderIsovalueScroll(wxScrollEvent& event)
1088 _3DWorld->SetSurfaceIsoValue( event.GetPosition() );
1090 // ----------------------------------------------------------------------------
1091 void wxQuantificationWidgetCT::OnSliderOpacityScroll(wxScrollEvent& event)
1093 _3DWorld->SetSurfaceOpacity( event.GetPosition() );
1095 //----------------------------------------------------------------------------
1096 void wxQuantificationWidgetCT::AddAxisActors(){
1098 marAxis *maraxis = _mar->getAxis( );
1099 if (maraxis!=NULL) _3DWorld->SetAxis( maraxis->Draw( ) );
1102 //----------------------------------------------------------------------------
1103 void wxQuantificationWidgetCT::Clean3D( bool eraseAxe )
1108 _quant_shown = false;
1110 _3DWorld->InitListContourActor( -1,_mar->getNumberOfSlices() );
1111 if (eraseAxe==true) { _3DWorld->RemoveAxis(); }
1118 void wxQuantificationWidgetCT::Reload_Axis(bool mask , bool step )
1124 void wxQuantificationWidgetCT::Show_Max_Min_Diameters()
1131 int wxQuantificationWidgetCT::Back( )
1141 void wxQuantificationWidgetCT::Set_plane_3D( double x, double y )
1150 void wxQuantificationWidgetCT::Point_Intensity(double x, double y)
1156 void wxQuantificationWidgetCT::CleanContour()
1162 //-----------------------------------------------------------------
1164 void wxQuantificationWidgetCT::Do_Quant()
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 );
1175 //-----------------------------------------------------------------
1176 void wxQuantificationWidgetCT::OnClean_BT(wxCommandEvent& event){
1177 int slice=_sl_Slice->GetValue();
1178 _3DWorld->Erase3DContourActor( slice );
1181 //-----------------------------------------------------------------
1182 void wxQuantificationWidgetCT::OnCleanAll_BT(wxCommandEvent& event){
1183 marDictionary marDict;
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() );
1199 //------------------------------------------------------------------------
1200 void wxQuantificationWidgetCT::DetectHealthySickSlice( bool minSurf , bool maxSurf ){
1202 //ESTE ES EL METODO QUE SE MODIFICA PARA CALCULAR LA ESTENOSIS
1210 double maxStenosis = -9999999;
1211 double maxArea = -9999999;
1213 int healthySlice = 0;
1214 int sizeHealthyRegion = GetSizeHealthyRegion();
1215 int analysisTypeStenosis= GetAnalysisTypeStenosis();
1222 GetSliceLimites(0,startslice,endslice);
1224 if (startslice>endslice){
1226 endslice=startslice;
1231 if (minSurf==false) { backSlice = _sl_Slice->GetValue(); }
1233 for (iSlice=startslice; iSlice<=endslice;iSlice++){
1236 // this is equal to the minimum surface/diameter
1237 if (analysisTypeStenosis==1 ){ stenosis = GetStenosisDiameter(iSlice); }
1238 if (analysisTypeStenosis==2 ){ stenosis = GetStenosisArea(iSlice); }
1242 areaB = _mar->getAverageArea(iSlice-sizeHealthyRegion,iSlice+sizeHealthyRegion);
1243 _3DWorld->InitListContourActor( 0, _mar->getNumberOfSlices() );
1247 if ((stenosis>maxStenosis) &&(minSurf==true)){
1248 maxStenosis=stenosis;
1251 if ((areaB>maxArea) && (maxSurf==true)){
1253 healthySlice=iSlice;
1255 MoveSlider( iSlice );
1256 _sl_Slice->SetValue( iSlice );
1262 MoveSlider( sickSlice );
1263 _sl_Slice->SetValue( sickSlice );
1267 MoveSlider( healthySlice );
1268 _sl_Slice->SetValue( healthySlice );
1276 //------------------------------------------------------------------------
1277 int wxQuantificationWidgetCT::GetHealthySlice(){
1278 return _mar->getHealthySlice( );
1280 //------------------------------------------------------------------------
1281 void wxQuantificationWidgetCT::SetHealthySlice(int healthySlice){
1282 if (healthySlice==-1) {
1283 healthySlice=_sl_Slice->GetValue();
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);
1295 _3DWorld->Set3DHealthySliceActor( );
1296 _3DWorld->Show3DHealthySliceActor();
1297 _cb_HealthySlice->SetValue(true);
1298 _3DWorld->InitListContourActor( 1, _mar->getNumberOfSlices() );
1300 for ( iHealthySlice=healthySliceStart ; iHealthySlice<=healthySliceEnd ; iHealthySlice++){
1301 _3DWorld->Set3DContourActor( iHealthySlice , _mar->get3Dcontour(iHealthySlice, iHealthySlice) , true ,1);
1310 //--------------------------------------------------------------------
1312 void wxQuantificationWidgetCT::OnHealthySlice_CB(wxCommandEvent& event)
1316 int healthySlice = _mar->getHealthySlice( );
1317 if (healthySlice!=-1) {
1318 if ( _cb_HealthySlice->GetValue() )
1319 _3DWorld->Show3DHealthySliceActor();
1321 _3DWorld->Hide3DHealthySliceActor();
1326 //--------------------------------------------------------------------
1327 void wxQuantificationWidgetCT::OnVisibleRing_CB(wxCommandEvent& event){
1328 if ( _cb_VisibleRings->GetValue() ){
1329 _3DWorld->Show3DContourActor();
1330 // _2DWorld->Show2DContourDiameters();
1333 _3DWorld->Hide3DContourActor();
1334 // _2DWorld->Hide2DContourDiameters();
1339 //--------------------------------------------------------------------
1340 void wxQuantificationWidgetCT::OnPerpendicular_CB(wxCommandEvent& event)
1342 if ( _cb_Perpendicular->GetValue() )
1343 _3DWorld->Show3DSliceActor();
1345 _3DWorld->Hide3DSliceActor();
1347 //--------------------------------------------------------------------
1349 void wxQuantificationWidgetCT::OnGreyScale_RB(wxCommandEvent& event){
1350 if ( _rb_GreyScale->GetValue() ){
1351 _3DWorld->SetBWLookUp();
1354 //--------------------------------------------------------------------
1355 void wxQuantificationWidgetCT::OnColor_RB(wxCommandEvent& event){
1356 if ( _rb_Color->GetValue() ){
1357 _3DWorld->SetColorLookUp();
1360 //--------------------------------------------------------------------
1361 void wxQuantificationWidgetCT::CallBackOnLeftDClick( wxMouseEvent& event ){
1363 double pp[3], cp[3];
1364 _3DWorld->GetLast3DClickPoint(pp,cp);
1366 int i,iback,maxPoints;
1368 double dist,distMin=-1;
1371 marAxis *maraxis = _mar->getAxis( );
1372 maxPoints = maraxis->getNumberOfSplinePoints();
1373 for ( i=0 ; i<maxPoints ; i++ ){
1374 c = maraxis->getSplinePoint(i);
1378 dist=sqrt( cc[0]*cc[0] + cc[1]*cc[1] + cc[2]*cc[2] );
1379 if ((distMin==-1) || (dist<distMin)) {
1384 _sl_Slice->SetValue(iback);
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);
1399 //--------------------------------------------------------------------
1400 int wxQuantificationWidgetCT::GetActualSlice(){
1401 return _sl_Slice->GetValue();
1403 //--------------------------------------------------------------------
1404 void wxQuantificationWidgetCT::SetActualSlice(int slice){
1405 _sl_Slice->SetValue(slice);
1408 //--------------------------------------------------------------------
1409 int wxQuantificationWidgetCT::GetMaxActualSlice(){
1410 return _sl_Slice->GetMax();
1412 //--------------------------------------------------------------------
1413 int wxQuantificationWidgetCT::GetSizeHealthyRegion(){
1414 return _sizeHealthyRegion;
1416 //--------------------------------------------------------------------
1417 void wxQuantificationWidgetCT::SetSizeHealthyRegion(int size){
1418 _sizeHealthyRegion = size;
1420 //--------------------------------------------------------------------
1421 void wxQuantificationWidgetCT::GetHealthySliceRange(int &healthySliceStart,int &healthySliceEnd){
1422 healthySliceStart = _mar->getHealthySliceStart( );
1423 healthySliceEnd = _mar->getHealthySliceEnd( );
1426 //--------------------------------------------------------------------
1427 void wxQuantificationWidgetCT::Set3DRegionSliceActor( int type, int k1,int k2 ){
1428 _3DWorld->Set3DRegionSliceActor(type,k1,k2);
1430 //--------------------------------------------------------------------
1431 void wxQuantificationWidgetCT::Set3DStartRegionSliceActor( int type, int k){
1432 // _3DWorld->Set3DStartRegionSliceActor(type,k);
1434 //--------------------------------------------------------------------
1435 void wxQuantificationWidgetCT::Set3DEndRegionSliceActor( int type, int k){
1436 // _3DWorld->Set3DEndRegionSliceActor(type,k);
1438 //--------------------------------------------------------------------
1439 void wxQuantificationWidgetCT::Show3DRegionSliceActor( int type ){
1440 _3DWorld->Show3DRegionSliceActor(type);
1442 //--------------------------------------------------------------------
1443 void wxQuantificationWidgetCT::Show3DStartRegionSliceActor( int type ){
1444 _3DWorld->Show3DStartRegionSliceActor(type);
1446 //--------------------------------------------------------------------
1447 void wxQuantificationWidgetCT::Show3DEndRegionSliceActor( int type ){
1448 _3DWorld->Show3DEndRegionSliceActor(type);
1450 //--------------------------------------------------------------------
1451 void wxQuantificationWidgetCT::Hide3DRegionSliceActor( int type ){
1452 _3DWorld->Hide3DRegionSliceActor(type);
1454 //--------------------------------------------------------------------
1455 void wxQuantificationWidgetCT::Hide3DStartRegionSliceActor( int type ){
1456 _3DWorld->Hide3DStartRegionSliceActor(type);
1458 //--------------------------------------------------------------------
1459 void wxQuantificationWidgetCT::Hide3DEndRegionSliceActor( int type ){
1460 _3DWorld->Hide3DEndRegionSliceActor(type);
1462 //--------------------------------------------------------------------
1463 void wxQuantificationWidgetCT::GetSliceLimites(int type, int &sliceStart, int &sliceEnd){
1464 _3DWorld->GetSliceLimites(type,sliceStart,sliceEnd);
1466 //--------------------------------------------------------------------
1467 int wxQuantificationWidgetCT::GetAnalysisTypeStenosis(){
1468 return _3DWorld->GetAnalysisTypeStenosis();
1470 //--------------------------------------------------------------------
1471 void wxQuantificationWidgetCT::SetAnalysisTypeStenosis(int analysisTypeStenosis){
1472 _3DWorld->SetAnalysisTypeStenosis(analysisTypeStenosis);
1474 //--------------------------------------------------------------------
1475 void wxQuantificationWidgetCT::SetManualContour_2DWorld(bool ok){
1478 // _2DWorld->SetState(1);
1479 // _2DWorld->EraseManualContour();
1482 // _2DWorld->SetState(2);
1483 // _2DWorld->CreateNewManualContour();
1487 //--------------------------------------------------------------------
1488 //TODO: SIM - MODIFICAR PARA VARIOS CONTORNOS
1489 void wxQuantificationWidgetCT::SetManualContour_AddPoint_2DWorld(){
1490 _bak_ActualSlice = _sl_Slice->GetValue();
1491 // _2DWorld->Hide2DContourDiameters();
1493 _mar->EraseContour(_bak_ActualSlice);
1495 _3DWorld->Erase3DContourActor( _bak_ActualSlice );
1497 // _2DWorld->SetStateManualContour(0);
1499 //--------------------------------------------------------------------
1500 void wxQuantificationWidgetCT::SetManualContour_InsertPoint_2DWorld(){
1501 // _2DWorld->SetStateManualContour(2);
1503 //--------------------------------------------------------------------
1504 void wxQuantificationWidgetCT::SetManualContour_ErasePoint_2DWorld(){
1505 // _2DWorld->SetStateManualContour(3);
1507 //--------------------------------------------------------------------
1508 void wxQuantificationWidgetCT::SetManualContour_MovePoint_2DWorld(){
1509 // _2DWorld->SetStateManualContour(4);
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();
1518 _mar->replaceContour2D(_bak_ActualSlice,size,vx,vy);
1522 _bak_ActualSlice=-1;
1524 //TODO El remplazo de contornos debe cambiar
1526 //------------------------------------------------------------------------
1527 kVolume* wxQuantificationWidgetCT::GetVolumeAxisExtended(int wz1,int wz2)
1530 vtkImageData *imagedata;
1531 imagedata=_mar->getSliceImage(wz1);
1533 imagedata->GetDimensions (dims);
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();
1542 for (i=wz1;i<=wz2;i++)
1545 imagedata=_mar->getSliceImage(i);
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] );
1555 //-------------------------------------------------------------------
1556 wxWindow* wxQuantificationWidgetCT::CreateView2DPanel(wxWindow *parent)
1558 wxPanel *panel = new wxPanel(parent,-1);
1559 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
1561 _imageviewer2D_1 = new wxVtk2DBaseView(panel);
1562 wxVTKRenderWindowInteractor *iren = _imageviewer2D_1->GetWxVTKRenderWindowInteractor();
1563 sizer->Add(iren , 1, wxEXPAND, 0);
1566 panel->SetSizer(sizer);
1567 panel->SetAutoLayout(true);
1568 panel->SetSize(400,400);
1573 //------------------------------------------------------------------------
1574 void wxQuantificationWidgetCT::Refresh()
1576 _imageviewer2D_1->Refresh();
1579 //------------------------------------------------------------------------
1580 void wxQuantificationWidgetCT::RefreshView(marImageData *marimagedata)
1582 vtkImageData *imagedata= marimagedata->GetImageData(); // t=0
1583 _imageviewer2D_1->SetActualSlice(0);
1584 imagedata->UpdateInformation();
1585 imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
1586 imagedata->Update();
1589 _vtkbasedata_1->SetMarImageData(marimagedata);
1590 _imageviewer2D_1->ResetView();
1593 for (i = 0; i < _manContours.size(); i++)
1595 if (_manContours[i] !=NULL)
1597 _manContours[i]->clear();
1601 for (i = 0; i < _manContours.size(); i++)
1603 if (_manContours[i] !=NULL)
1605 _manContours[i]->refreshWall(_imageviewer2D_1);
1606 _manContours[i]->refreshLumen(_imageviewer2D_1);
1609 for (j = 0; j < _manContours[i]->getNumberOfCalcContours(); j++)
1611 _manContours[i]->refreshCalc(j,_imageviewer2D_1);
1614 for (j = 0; j < _manContours[i]->getNumberOfHypoContours(); j++)
1616 _manContours[i]->refreshHypo(j,_imageviewer2D_1);
1630 /* _mViewContourWall->ClearContour();
1631 _mViewContourLumen->ClearContour();
1633 delete _mViewContourWall;
1634 delete _manContourControlWall;
1635 delete _mContourModelWall;
1637 delete _mViewContourLumen;
1638 delete _manContourControlLumen;
1639 delete _mContourModelLumen;
1641 CreateManualContours();
1645 //------------------------------------------------------------------------
1646 void wxQuantificationWidgetCT::ConfigureVTK(marImageData *marimagedata)
1650 vtkImageData *imagedata=marimagedata->GetImageData(); // t=0
1651 imagedata->UpdateInformation();
1652 imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
1653 imagedata->Update();
1655 _vtkbasedata_1 = new vtkBaseData();
1656 _vtkbasedata_1->SetMarImageData(marimagedata);
1657 _imageviewer2D_1->SetVtkBaseData( _vtkbasedata_1 );
1658 _imageviewer2D_1->Configure();
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();
1671 //------------------------------------------------------------------------
1672 void wxQuantificationWidgetCT::OnContourWall()
1674 if (_manContours[_mar->getActualQuant()]->getWallController() == NULL)
1676 _manContours[_mar->getActualQuant()]->createWallContour(_imageviewer2D_1);
1677 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
1678 _manContours[_mar->getActualQuant()]->getWallController() );
1680 _manContours[_mar->getActualQuant()]->setWallActive();
1681 _manContours[_mar->getActualQuant()]->setWallVisibility(true);
1684 //------------------------------------------------------------------------
1685 void wxQuantificationWidgetCT::OnContourLumen()
1687 if (_manContours[_mar->getActualQuant()]->getLumenController() == NULL)
1689 _manContours[_mar->getActualQuant()]->createLumenContour(_imageviewer2D_1);
1690 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
1691 _manContours[_mar->getActualQuant()]->getLumenController() );
1693 _manContours[_mar->getActualQuant()]->setLumenActive();
1695 //------------------------------------------------------------------------
1696 void wxQuantificationWidgetCT::OnContourHypo()
1701 if (_manContours[_mar->getActualQuant()]->getNumberOfHypoContours() > 0)
1704 int answer = wxMessageBox(_T("Create new hypodense contour? (answer no, will modify existing ones)"),
1705 _T("Confirm"), wxYES_NO | wxCANCEL, this);
1707 if (answer == wxYES)
1709 addManualContours(HYPODENSE);
1710 int tam = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours() - 1;
1711 _manContours[_mar->getActualQuant()] -> setHypoContourActive(tam);
1714 else if (answer == wxNO)
1716 _manContours[_mar->getActualQuant()] ->setHypoActive();
1721 addManualContours(HYPODENSE);
1722 int tam = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours() - 1;
1723 _manContours[_mar->getActualQuant()] -> setHypoContourActive(tam);
1731 //------------------------------------------------------------------------
1732 void wxQuantificationWidgetCT::OnContourCalc()
1736 if (_manContours[_mar->getActualQuant()]->getNumberOfCalcContours() > 0)
1739 int answer = wxMessageBox(_T("Create new calcification contour? (answer no, will modify existing ones)"),
1740 _T("Confirm"), wxYES_NO | wxCANCEL, this);
1742 if (answer == wxYES)
1744 addManualContours(CALCIFICATION);
1745 int tam = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours() - 1;
1746 _manContours[_mar->getActualQuant()] -> setCalcContourActive(tam);
1749 else if (answer == wxNO)
1751 _manContours[_mar->getActualQuant()] ->setCalcActive();
1756 addManualContours(CALCIFICATION);
1757 int tam = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours() - 1;
1758 _manContours[_mar->getActualQuant()] -> setCalcContourActive(tam);
1765 //------------------------------------------------------------------------
1766 void wxQuantificationWidgetCT::OnReplaceContourWall()
1769 int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
1770 double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
1771 double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();
1774 _mar->cleanContours(WALL);
1775 _mar->replaceContour2D(size,vx,vy,WALL);
1776 _manContours[_mar->getActualQuant()]->clearWall();
1777 _manContours[_mar->getActualQuant()]->restartWallContour(_imageviewer2D_1);
1783 //------------------------------------------------------------------------
1784 void wxQuantificationWidgetCT::OnReplaceContourLumen()
1786 int size = _manContours[_mar->getActualQuant()]->getNumberOfLumenContourPoints();
1787 double *vx = _manContours[_mar->getActualQuant()]->getXVectorLumenPoints();
1788 double *vy = _manContours[_mar->getActualQuant()]->getYVectorLumenPoints();
1790 _mar->cleanContours(ELUMEN);
1791 _mar->replaceContour2D(size,vx,vy,ELUMEN);
1792 _manContours[_mar->getActualQuant()]->clearLumen();
1793 _manContours[_mar->getActualQuant()]->restartLumenContour(_imageviewer2D_1);
1797 //------------------------------------------------------------------------
1798 void wxQuantificationWidgetCT::OnReplaceContourCalc()
1800 int conts = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours();
1802 _mar->cleanContours(CALCIFICATION);
1803 for (int i = 0; i < conts; i++)
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);
1810 _manContours[_mar->getActualQuant()]->clearCalc();
1811 _manContours[_mar->getActualQuant()]->restartCalcContours();
1815 //------------------------------------------------------------------------
1816 void wxQuantificationWidgetCT::OnReplaceContourHypo()
1818 /* int conts = _manContours[_mar->getActualQuant()]->getNumberOfHypoContours();
1820 _mar->cleanContours(HYPODENSE);
1821 for (int i = 0; i < conts; i++)
1823 int size = _manContours[_mar->getActualQuant()]->getNumberOfHypoContourPoints(i);
1824 double *vx = _manContours[_mar->getActualQuant()]->getXVectorHypoPoints(i);
1825 double *vy = _manContours[_mar->getActualQuant()]->getYVectorHypoPoints(i);
1828 _manContours[_mar->getActualQuant()]->clearHypo();
1829 _manContours[_mar->getActualQuant()]->restartHypoContours();
1834 //------------------------------------------------------------------------
1835 void wxQuantificationWidgetCT::performXOR()
1837 if (_manContours [_mar->getActualQuant()]->getWallController() != NULL)
1839 int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
1840 double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
1841 double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();
1843 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1844 std::vector<marIsocontour *> walls;
1848 double intersection = _mar->performUnion(WALL,walls);
1849 double xor_ = _mar->performXOR(WALL,walls);
1851 xor_ = xor_ / intersection;
1852 wxLogMessage(wxString("Indice XOR (pared): %f", wxConvUTF8), xor_*100);
1854 double and_ = _mar->performAND(WALL,walls);
1855 and_ = and_/ intersection;
1858 wxLogMessage(wxString("Indice AND (pared): %f", wxConvUTF8), and_*100);
1861 wxLogMessage(wxString("Indice Unión (pared): %f", wxConvUTF8), intersection);
1872 razon = xor_ / and_;
1875 wxLogMessage(wxString("Razón (pared): %f", wxConvUTF8), razon);
1879 wxLogMessage(wxString("SIN INFORMACION PARED", wxConvUTF8));
1884 if (_manContours [_mar->getActualQuant()]->getLumenController() != NULL)
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;
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);
1899 double and_ = _mar->performAND(ELUMEN,lumen);
1900 and_ = and_/ intersection;
1901 wxLogMessage(wxString("Indice AND (lumen): %f", wxConvUTF8), and_*100);
1904 wxLogMessage(wxString("Indice Unión (pared): %f", wxConvUTF8), intersection);
1914 razon = xor_ / and_;
1916 wxLogMessage(wxString("Razón (lumen): %f", wxConvUTF8), razon);
1920 wxLogMessage(wxString("SIN INFORMACION LUMEN", wxConvUTF8));
1927 int conts = _manContours[_mar->getActualQuant()]->getNumberOfCalcContours();
1929 std::vector<marIsocontour *> calc;
1930 for (int i = 0; i < conts; i++)
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);
1941 double intersection = _mar->performUnion(CALCIFICATION,calc);
1942 double xor_ = _mar->performXOR(CALCIFICATION,calc);
1943 xor_ = xor_ /intersection;
1945 wxLogMessage(wxString("Indice OR (calc): %f", wxConvUTF8), xor_*100);
1947 double and_ = _mar->performAND(CALCIFICATION,calc);
1948 and_ = and_ / intersection;
1949 wxLogMessage(wxString("Indice AND (calc): %f", wxConvUTF8), and_*100);
1952 wxLogMessage(wxString("Indice Unión (pared): %f", wxConvUTF8), intersection);
1962 razon = xor_ / and_;
1965 wxLogMessage(wxString("Razón (calc): %f", wxConvUTF8), razon);
1969 wxLogMessage(_T("INFORMACION NO DISPONIBLE PARA CALCIFICACION"));
1974 void wxQuantificationWidgetCT::performAND()
1977 int size = _manContours[_mar->getActualQuant()]->getNumberOfWallContourPoints();
1978 double *vx = _manContours[_mar->getActualQuant()]->getXVectorWallPoints();
1979 double *vy = _manContours[_mar->getActualQuant()]->getYVectorWallPoints();
1981 marIsocontour* m = _mar->loadMarIsocontour(size,vx,vy);
1982 std::vector<marIsocontour *> walls;
1991 void wxQuantificationWidgetCT::getIndex()
1995 //------------------------------------------------------------------------
1996 void wxQuantificationWidgetCT::OnSliderDiscontinuityScroll(int percentage)
1998 _mar->updateDiscontinuityThreshold(percentage);
2004 //------------------------------------------------------------------------
2005 void wxQuantificationWidgetCT::OnSliderLumenPercentageScroll(int percentage)
2007 _mar->updateLumenPercentage(percentage);
2008 _contourViewer->Refresh();
2012 //------------------------------------------------------------------------
2013 void wxQuantificationWidgetCT::OnCalibration()
2016 int actual = _mar->getActualQuant();
2017 _mar->ClearContoursPartial(actual - 1);
2018 _mar->setStartIndex(actual);
2019 _mar->setCalibration(true);
2021 wxLogMessage(_T("Contours calibrated"));
2022 _mar->markUpLumen(actual);
2026 //------------------------------------------------------------------------
2027 void wxQuantificationWidgetCT::OnFile()
2030 _mar->generateFile();
2033 //------------------------------------------------------------------------
2034 void wxQuantificationWidgetCT::OnShowAll(bool value)
2042 //------------------------------------------------------------------------
2043 void wxQuantificationWidgetCT::OnShowWall(bool value)
2046 _manContours[_mar->getActualQuant()]->setWallVisibility(value);
2047 _imageviewer2D_1->Refresh();
2048 _imageviewer2D_1->RefreshView();
2050 //------------------------------------------------------------------------
2051 void wxQuantificationWidgetCT::OnShowLumen(bool value)
2053 _manContours[_mar->getActualQuant()]->setLumenVisibility(value);
2054 _imageviewer2D_1->Refresh();
2055 _imageviewer2D_1->RefreshView();
2058 //------------------------------------------------------------------------
2059 void wxQuantificationWidgetCT::OnShowCalc(bool value)
2061 _manContours[_mar->getActualQuant()]->setCalcVisibility(value);
2062 _imageviewer2D_1->Refresh();
2063 _imageviewer2D_1->RefreshView();
2066 //------------------------------------------------------------------------
2067 void wxQuantificationWidgetCT::OnShowHypo(bool value)
2069 _manContours[_mar->getActualQuant()]->setHypoVisibility(value);
2070 _imageviewer2D_1->Refresh();
2071 _imageviewer2D_1->RefreshView();
2074 //------------------------------------------------------------------------
2075 void wxQuantificationWidgetCT::OnSliderCalcPercentageScroll(int percentage)
2077 int actual = _mar->getActualQuant();
2078 _mar->updateCalcPercentage(percentage);
2079 _contourViewer->Refresh();
2080 //_mar->markUpLumen(actual);
2086 //------------------------------------------------------------------------
2087 void wxQuantificationWidgetCT::CreateManualContours()
2091 for (int i = 0; i < _mar->getNumberOfSlices(); i++)
2093 if (_manContours[i] != NULL && _mar->getActualQuant() != i)
2095 _manContours[i]->setWallVisibility(false);
2096 _manContours[i]->setLumenVisibility(false);
2097 _manContours[i]->setCalcVisibility(false);
2098 _manContours[i]->setHypoVisibility(false);
2099 _manContours[i]->inactivate();
2103 _imageviewer2D_1->Refresh();
2106 //_imageviewer2D_1->RefreshView();
2108 if (_manContours[_mar->getActualQuant()] == NULL)
2110 _manContours[_mar->getActualQuant()] = new manualContourContainer();
2112 /* _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getWallController() );
2113 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getLumenController() );*/
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();
2128 //------------------------------------------------------------------------
2129 void wxQuantificationWidgetCT::addManualContours(int type)
2133 if (type == CALCIFICATION)
2135 tam = _manContours[_mar->getActualQuant()]->addCalcificationContour(_imageviewer2D_1);
2136 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getCalcController(tam) );
2138 else if (type == HYPODENSE)
2140 tam = _manContours[_mar->getActualQuant()]->addHypodenseContour(_imageviewer2D_1);
2141 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContours[_mar->getActualQuant()]->getHypoController(tam) );
2146 // EOF - wxQuantificationWidgetCT.cxx