00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "wxQuantificationWidget.h"
00021 #include "../marDictionary.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 BEGIN_EVENT_TABLE( wxQuantificationWidget, wxPanel )
00034 EVT_BUTTON(ID_BUTTON_CONTOUR , wxQuantificationWidget::OnContour_BT )
00035 EVT_BUTTON(ID_BUTTON_CLEAN , wxQuantificationWidget::OnClean_BT )
00036 EVT_BUTTON(ID_BUTTON_CLEAN_ALL , wxQuantificationWidget::OnCleanAll_BT )
00037 EVT_BUTTON(ID_BUTTON_SAVE_CONTOURS3D, wxQuantificationWidget::OnSaveContours3D_BT )
00038
00039
00040
00041
00042
00043
00044
00045
00046 EVT_CHECKBOX(ID_CHECKBOX_HEALTHY, wxQuantificationWidget::OnHealthySlice_CB )
00047 EVT_CHECKBOX(ID_CHECKBOX_SHOW_SURFACE, wxQuantificationWidget::OnShowSurface_CB )
00048 EVT_CHECKBOX(ID_CHECKBOX_VISIBLE_RINGS, wxQuantificationWidget::OnVisibleRing_CB )
00049 EVT_CHECKBOX(ID_CHECKBOX_PERPENDICULAR, wxQuantificationWidget::OnPerpendicular_CB )
00050
00051 EVT_RADIOBUTTON(ID_RADIOBUTTON_GREYSCALE, wxQuantificationWidget::OnGreyScale_RB )
00052 EVT_RADIOBUTTON(ID_RADIOBUTTON_COLOR, wxQuantificationWidget::OnColor_RB )
00053
00054 EVT_COMMAND_SCROLL(ID_SLIDER_SLICE, wxQuantificationWidget::OnSliderSliceScroll )
00055
00056 EVT_COMMAND_SCROLL(ID_SLIDER_OPACITY, wxQuantificationWidget::OnSliderOpacityScroll )
00057 EVT_COMMAND_SCROLL_THUMBRELEASE(ID_SLIDER_ISOVALUE, wxQuantificationWidget::OnSliderIsovalueScroll )
00058 END_EVENT_TABLE( );
00059
00060
00061
00062
00063
00064 wxQuantificationWidget::wxQuantificationWidget(wxWindow* parent, wxWindowID id,
00065 const wxPoint& pos, const wxSize& size, long style,
00066 const wxString& name)
00067 : wxQuantificationWidget_base( parent, id, pos, size, style, name )
00068 {
00069 panel_splitter = new wxSplitterWindow( this , -1, wxDefaultPosition, wxSize(400,400 ), wxSP_3D | wxSP_LIVE_UPDATE | wxCLIP_CHILDREN );
00070
00071 panel_right = new wxPanel(panel_splitter , -1, wxDefaultPosition, wxSize(400,400));
00072
00073 panel_splitter_left = new wxSplitterWindow( panel_splitter , -1, wxDefaultPosition, wxSize(400,400 ), wxSP_3D | wxSP_LIVE_UPDATE | wxCLIP_CHILDREN );
00074 panel_left_up = new wxPanel(panel_splitter_left , -1, wxDefaultPosition, wxSize(200,200));
00075 panel_left_down = new wxPanel(panel_splitter_left , -1, wxDefaultPosition, wxSize(200,200));
00076
00077
00078 panel_splitter_right = new wxSplitterWindow( panel_right , -1, wxDefaultPosition, wxSize(400,400 ), wxSP_3D | wxSP_LIVE_UPDATE | wxCLIP_CHILDREN );
00079 panel_right_up = new wxPanel(panel_splitter_right , -1, wxDefaultPosition, wxSize(200,200));
00080 panel_right_down = new wxPanel(panel_splitter_right , -1, wxDefaultPosition, wxSize(200,200));
00081
00082
00083
00084
00085 _mar = NULL;
00086 SetSizeHealthyRegion( 5 );
00087
00088
00089
00090
00091 _3DWorld = new vtk3DQuantSurfaceWidget( panel_left_up, ID_QUANTIF3D );
00092 _3DWorld->SetInterfaceVtkPanelWidgets(this);
00093
00094 _2DWorld = new vtk2DQuantSliceWidget( panel_right_up, -1 );
00095 _2DWorld->SetSize(800,800);
00096 _2DWorld->SetInterfaceVtkPanelWidgets(this);
00097
00098
00099 this->Set_control();
00100 this->Do_layout();
00101 this->Set_Data();
00102 _bak_ActualSlice=-1;
00103
00104 Refresh();
00105
00106
00107
00108
00109 }
00110
00111
00112
00113
00114
00115 wxQuantificationWidget::~wxQuantificationWidget( )
00116 {
00117
00118 _3DWorld->Delete( );
00119
00120 }
00121
00122 wxPanel* wxQuantificationWidget::CreateStenosisPanel(){
00123 marDictionary marDict;
00124
00125 wxPanel* panel = new wxPanel(panel_right_down);
00126
00127 _st_Label100 = new wxStaticText(panel, -1, wxString(marDict.GetString(255), wxConvUTF8) );
00128 _st_Label101 = new wxStaticText(panel, -1, wxString(marDict.GetString(260), wxConvUTF8) );
00129
00130
00131
00132
00133
00134
00135
00136
00137 _st_Value100 = new wxStaticText(panel, -1, _T("-- ") );
00138 _st_Value101 = new wxStaticText(panel, -1, _T("-- ") );
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 wxFont font(14,wxDEFAULT ,wxNORMAL,wxBOLD);
00182
00183
00184 _st_Value100->SetFont(font);
00185 _st_Value101->SetFont(font);
00186
00187
00188
00189 wxGridSizer* gridSizer1 = new wxFlexGridSizer(1);
00190 gridSizer1->Add( new wxStaticText(panel, -1, _T(" ")) ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
00191 gridSizer1->Add(_st_Value100 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
00192 gridSizer1->Add(_st_Label100 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
00193 gridSizer1->Add( new wxStaticText(panel, -1, _T(" ")) ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
00194 gridSizer1->Add(_st_Value101 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
00195 gridSizer1->Add(_st_Label101 ,15, wxALL|wxEXPAND|wxALIGN_CENTRE_HORIZONTAL, 0);
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 wxGridSizer* gridSizer = new wxFlexGridSizer(4);
00231 gridSizer->Add( new wxStaticText(panel, -1, _T(" ")) ,15, wxALIGN_LEFT , 50);
00232 gridSizer->Add( new wxStaticText(panel, -1, _T(" ")) ,15, wxALIGN_LEFT , 50);
00233 gridSizer->Add( new wxStaticText(panel, -1, _T(" ")) ,15, wxALIGN_LEFT , 50);
00234 gridSizer->Add(gridSizer1 ,15, wxALIGN_LEFT , 50);
00235
00236 panel->SetAutoLayout(true);
00237 panel->SetSizer(gridSizer);
00238 panel->Layout();
00239
00240
00241
00242
00243 panel->SetSize(400,300);
00244 panel->SetSize( gridSizer->GetMinSize() );
00245
00246 return panel;
00247 }
00248
00249
00250
00251 void wxQuantificationWidget::Set_control(){
00252 marDictionary marDict;
00253
00254
00255
00256
00257
00258
00259
00260
00261 _wxStenosisPanel = CreateStenosisPanel();
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281 _cb_HealthySlice = new wxCheckBox( panel_left_down, ID_CHECKBOX_HEALTHY, wxString(marDict.GetString(205), wxConvUTF8));
00282 _cb_HealthySlice->SetValue(true);
00283
00284
00285 _cb_Perpendicular = new wxCheckBox( panel_left_down, ID_CHECKBOX_PERPENDICULAR, wxString(marDict.GetString(210), wxConvUTF8));
00286 _cb_Perpendicular->SetValue(true);
00287
00288
00289
00290 _rb_GreyScale = new wxRadioButton( panel_left_down, ID_RADIOBUTTON_GREYSCALE, wxString(marDict.GetString(230), wxConvUTF8), wxDefaultPosition,wxDefaultSize,wxRB_GROUP );
00291 _rb_GreyScale->SetValue(true);
00292
00293
00294
00295 _rb_Color = new wxRadioButton( panel_left_down, ID_RADIOBUTTON_COLOR, wxString(marDict.GetString(235), wxConvUTF8), wxDefaultPosition,wxDefaultSize );
00296 _rb_Color->SetValue(false);
00297
00298
00299
00300 _cb_VisibleRings = new wxCheckBox( panel_left_down, ID_CHECKBOX_VISIBLE_RINGS, wxString(marDict.GetString(215), wxConvUTF8));
00301 _cb_VisibleRings->SetValue(true);
00302
00303
00304 _cb_ShowSurface = new wxCheckBox( panel_left_down, ID_CHECKBOX_SHOW_SURFACE, wxString(marDict.GetString(220), wxConvUTF8));
00305 _cb_ShowSurface->SetValue(true);
00306
00307
00308
00309
00310 _bt_AddContour3D = new wxButton( panel_left_down, ID_BUTTON_CONTOUR, wxString(marDict.GetString(245), wxConvUTF8) ,
00311 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00312 _bt_CleanContour3D = new wxButton( panel_left_down, ID_BUTTON_CLEAN, wxString(marDict.GetString(250), wxConvUTF8) ,
00313 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00314
00315 _bt_CleanAllContours3D = new wxButton( panel_left_down, ID_BUTTON_CLEAN_ALL, wxString(marDict.GetString(253), wxConvUTF8) ,
00316 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00317
00318 _bt_SaveContours3D = new wxButton( panel_left_down, ID_BUTTON_SAVE_CONTOURS3D, wxString(marDict.GetString(248), wxConvUTF8) ,
00319 wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00320
00321
00322 _sl_Slice = new wxSlider( panel_left_down, ID_SLIDER_SLICE , 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00323 _sl_Isovalue = new wxSlider( panel_left_down, ID_SLIDER_ISOVALUE, 0, 0, 10000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00324 _sl_Opacity = new wxSlider( panel_left_down, ID_SLIDER_OPACITY , 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00325
00326
00327
00328
00329
00330
00331 _sl_Slice->SetSize(1800,16);
00332 _sl_Isovalue->SetSize(300,16);
00333 _sl_Opacity->SetSize(300,16);
00334
00335
00336 _st_Slice = new wxStaticText(panel_left_down, -1, wxString(marDict.GetString(90), wxConvUTF8) );
00337 _st_Isovalue = new wxStaticText(panel_left_down, -1, wxString(marDict.GetString(240), wxConvUTF8) );
00338 _st_Opacity = new wxStaticText(panel_left_down, -1, wxString(marDict.GetString(225), wxConvUTF8) );
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 _st_Label1 = new wxStaticText(this, -1, wxString(marDict.GetString(380), wxConvUTF8) );
00350 _st_Value1 = new wxStaticText(this, -1, _T("0.00"));
00351
00352
00353
00354
00355
00356 _st_Label2 = new wxStaticText(this, -1, wxString(marDict.GetString(390), wxConvUTF8) );
00357 _st_Value2 = new wxStaticText(this, -1, _T("0.00"));
00358
00359
00360
00361
00362 _st_Label3 = new wxStaticText(this, -1, wxString(marDict.GetString(400), wxConvUTF8) );
00363 _st_Value3 = new wxStaticText(this, -1, _T("0.00") );
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377 _st_Label6 = new wxStaticText(this, -1, wxString(marDict.GetString(405), wxConvUTF8) );
00378 _st_Value6 = new wxStaticText(this, -1, _T("0.00"));
00379
00380
00381
00382 _st_Label7 = new wxStaticText(this, -1, wxString(marDict.GetString(410), wxConvUTF8) );
00383 _st_Value7 = new wxStaticText(this, -1, _T("0.00"));
00384
00385
00386
00387 _st_Label8 = new wxStaticText(this, -1, wxString(marDict.GetString(415), wxConvUTF8) );
00388 _st_Value8 = new wxStaticText(this, -1, _T("0.00"));
00389
00390
00391
00392
00393
00394
00395
00396
00397 _st_LabelRef101 = new wxStaticText(this, -1, wxString(marDict.GetString(385), wxConvUTF8) );
00398 _st_ValueRef101 = new wxStaticText(this, -1, _T("--"));
00399
00400
00401
00402 _st_LabelRef102 = new wxStaticText(this, -1, wxString(marDict.GetString(395), wxConvUTF8) );
00403 _st_ValueRef102 = new wxStaticText(this, -1, _T("--"));
00404
00405
00406
00407 _st_LabelRef103 = new wxStaticText(this, -1, wxString(marDict.GetString(420), wxConvUTF8) );
00408 _st_ValueRef103 = new wxStaticText(this, -1, _T("--"));
00409
00410
00411
00412
00413 _pl_cntlHealthySick2 = new wxPanelControlsHealthySickSlice2(panel_right_down,this);
00414
00415
00416
00417
00418
00419
00420
00421
00422 }
00423
00424
00425
00426 void wxQuantificationWidget::Do_layout()
00427 {
00428
00429
00430
00431 wxBoxSizer *sizer_principal = new wxBoxSizer(wxVERTICAL);
00432 wxBoxSizer *status = new wxBoxSizer(wxHORIZONTAL);
00433
00434
00435
00436 wxBoxSizer *medium_right_up = new wxBoxSizer(wxVERTICAL);
00437
00438 wxFlexGridSizer *medium_right_down = new wxFlexGridSizer(1,0);
00439
00440
00441 wxBoxSizer *medium_left_up = new wxBoxSizer(wxVERTICAL);
00442 wxBoxSizer *medium_right = new wxBoxSizer(wxVERTICAL);
00443
00444
00445
00446
00447 wxFlexGridSizer *axe = new wxFlexGridSizer(1);
00448 axe->AddGrowableCol(0);
00449
00450 wxFlexGridSizer *axe1 = new wxFlexGridSizer(10,0);
00451 wxBoxSizer *axe2 = new wxBoxSizer(wxHORIZONTAL);
00452 wxFlexGridSizer *axe3 = new wxFlexGridSizer(10,0);
00453 wxFlexGridSizer *axe4 = new wxFlexGridSizer(10,0);
00454 wxBoxSizer *axe5 = new wxBoxSizer(wxHORIZONTAL);
00455 wxBoxSizer *axe6 = new wxBoxSizer(wxHORIZONTAL);
00456
00457 wxBoxSizer *status0 = new wxBoxSizer(wxVERTICAL);
00458 wxBoxSizer *status1 = new wxBoxSizer(wxVERTICAL);
00459 wxBoxSizer *status2 = new wxBoxSizer(wxVERTICAL);
00460 wxBoxSizer *status3 = new wxBoxSizer(wxVERTICAL);
00461
00462
00463 wxBoxSizer *status6 = new wxBoxSizer(wxVERTICAL);
00464 wxBoxSizer *status7 = new wxBoxSizer(wxVERTICAL);
00465 wxBoxSizer *status8 = new wxBoxSizer(wxVERTICAL);
00466 wxBoxSizer *status9 = new wxBoxSizer(wxVERTICAL);
00467 wxBoxSizer *statusRef1 = new wxBoxSizer(wxVERTICAL);
00468 wxBoxSizer *statusRef2 = new wxBoxSizer(wxVERTICAL);
00469 wxBoxSizer *statusRef3 = new wxBoxSizer(wxVERTICAL);
00470
00471
00472 axe1->Add(_st_Slice , 10, wxALL|wxEXPAND, 0);
00473 axe1->Add(_sl_Slice , 10, wxALL|wxGROW, 0);
00474 axe1->AddGrowableCol(1);
00475
00476 axe2->Add(_cb_HealthySlice , 10, wxALL|wxEXPAND, 0);
00477 axe2->Add(_cb_Perpendicular , 10, wxALL|wxEXPAND, 0);
00478 axe2->Add(_cb_VisibleRings , 10, wxALL|wxEXPAND, 0);
00479 axe2->Add(_cb_ShowSurface , 10, wxALL|wxEXPAND, 0);
00480
00481 axe3->Add(_st_Opacity , 1, wxALL|wxEXPAND, 0);
00482 axe3->Add(_sl_Opacity , 10, wxALL|wxGROW, 0);
00483 axe3->Add(_rb_GreyScale , 10, wxALL|wxEXPAND, 0);
00484 axe3->Add(_rb_Color , 10, wxALL|wxEXPAND, 0);
00485 axe3->AddGrowableCol(1);
00486
00487 axe4->Add(_st_Isovalue , 1, wxALL|wxEXPAND, 0);
00488 axe4->Add(_sl_Isovalue , 1, wxALL|wxGROW, 0);
00489 axe4->AddGrowableCol(1);
00490
00491 axe5->Add(_bt_AddContour3D , 1 );
00492 axe5->Add(_bt_CleanContour3D , 1 );
00493 axe6->Add(_bt_CleanAllContours3D , 1 );
00494 axe6->Add(_bt_SaveContours3D , 1 );
00495
00496
00497
00498
00499 status1->Add(_st_Label1, 1, wxALL|wxALIGN_CENTER, 5);
00500 status1->Add(_st_Value1, 1, wxALL|wxALIGN_CENTER, 5);
00501 status2->Add(_st_Label2, 1, wxALL|wxALIGN_CENTER, 5);
00502 status2->Add(_st_Value2, 1, wxALL|wxALIGN_CENTER, 5);
00503 status3->Add(_st_Label3, 1, wxALL|wxALIGN_CENTER, 5);
00504 status3->Add(_st_Value3, 1, wxALL|wxALIGN_CENTER, 5);
00505
00506
00507
00508
00509 status6->Add(_st_Label6, 1, wxALL|wxALIGN_CENTER, 5);
00510 status6->Add(_st_Value6, 1, wxALL|wxALIGN_CENTER, 5);
00511 status7->Add(_st_Label7, 1, wxALL|wxALIGN_CENTER, 5);
00512 status7->Add(_st_Value7, 1, wxALL|wxALIGN_CENTER, 5);
00513 status8->Add(_st_Label8, 1, wxALL|wxALIGN_CENTER, 5);
00514 status8->Add(_st_Value8, 1, wxALL|wxALIGN_CENTER, 5);
00515
00516
00517
00518 statusRef1->Add(_st_LabelRef101, 1, wxALL|wxALIGN_CENTER, 5);
00519 statusRef1->Add(_st_ValueRef101, 1, wxALL|wxALIGN_CENTER, 5);
00520 statusRef2->Add(_st_LabelRef102, 1, wxALL|wxALIGN_CENTER, 5);
00521 statusRef2->Add(_st_ValueRef102, 1, wxALL|wxALIGN_CENTER, 5);
00522 statusRef3->Add(_st_LabelRef103, 1, wxALL|wxALIGN_CENTER, 5);
00523 statusRef3->Add(_st_ValueRef103, 1, wxALL|wxALIGN_CENTER, 5);
00524
00525
00526
00527 status->Add(status1 , 1, wxALL|wxEXPAND, 0);
00528 status->Add(statusRef1 , 1, wxALL|wxEXPAND, 0);
00529 status->Add(status2 , 1, wxALL|wxEXPAND, 0);
00530 status->Add(statusRef2 , 1, wxALL|wxEXPAND, 0);
00531 status->Add(status3 , 1, wxALL|wxEXPAND, 0);
00532
00533
00534 status->Add(status6 , 1, wxALL|wxEXPAND, 0);
00535 status->Add(status7 , 1, wxALL|wxEXPAND, 0);
00536 status->Add(status8 , 1, wxALL|wxEXPAND, 0);
00537 status->Add(statusRef3 , 1, wxALL|wxEXPAND, 0);
00538
00539
00540 axe->Add(axe1, 2, wxALL|wxEXPAND, 0);
00541 axe->Add(axe2, 2, wxALL|wxEXPAND, 0);
00542 axe->Add(axe3, 2, wxALL|wxEXPAND, 0);
00543 axe->Add(axe4, 2, wxALL|wxEXPAND, 0);
00544
00545
00546
00547 axe->Add(axe5);
00548 axe->Add(axe6);
00549
00550 panel_left_down->SetAutoLayout(true);
00551 panel_left_down->SetSizer(axe);
00552 panel_left_down->Layout();
00553
00554
00555
00556
00557 medium_right_up->Add(_2DWorld , 1, wxALL|wxEXPAND, 5);
00558
00559 medium_right_down->Add(_wxStenosisPanel , 1, wxALL, 5);
00560 medium_right_down->Add(_pl_cntlHealthySick2 , 1, wxALL, 5);
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570 medium_left_up->Add(_3DWorld , 1, wxEXPAND, 0);
00571 panel_left_up->SetAutoLayout(true);
00572 panel_left_up->SetSizer(medium_left_up);
00573 panel_left_up->Layout();
00574
00575
00576 panel_splitter_left->SplitHorizontally( panel_left_up , panel_left_down );
00577 panel_splitter_left->SetMinimumPaneSize( 50 );
00578
00579
00580
00581 panel_right_up->SetAutoLayout(true);
00582 panel_right_up->SetSizer(medium_right_up);
00583 panel_right_up->Layout();
00584
00585 panel_right_down->SetAutoLayout(true);
00586 panel_right_down->SetSizer(medium_right_down);
00587 panel_right_down->Layout();
00588
00589
00590 int ww,hh;
00591 wxWindow *pp=this;
00592 while (pp->GetParent()!=NULL) pp=pp->GetParent();
00593 pp->GetSize(&ww,&hh);
00594
00595 panel_splitter_right->SplitHorizontally( panel_right_up, panel_right_down, (int)(hh*0.4) );
00596 panel_splitter_right->SetMinimumPaneSize( 50 );
00597
00598
00599
00600
00601 medium_right->Add(panel_splitter_right,1 ,wxALL|wxEXPAND,0 );
00602 panel_right->SetAutoLayout(true);
00603 panel_right->SetSizer(medium_right);
00604 panel_right->Layout();
00605
00606
00607
00608 panel_splitter->SplitVertically( panel_splitter_left , panel_right, (int)(ww*0.6) );
00609 panel_splitter->SetMinimumPaneSize( 50 );
00610
00611
00612
00613
00614 sizer_principal->Add( panel_splitter , 1 , wxALL|wxEXPAND );
00615 sizer_principal->Add( status , 0 , wxALL|wxEXPAND );
00616
00617 this->SetSizer(sizer_principal);
00618
00619
00620
00621
00622
00623 }
00624
00625
00626 void wxQuantificationWidget::Set_Data( )
00627 {
00628 _axis_index = -1;
00629 _given_points = 0;
00630 _nClicks = 0;
00631 _quantifing = 0;
00632
00633
00634
00635
00636 _shown = 0;
00637 _quant_shown = 0;
00638
00639 _actual_area = 0.00;
00640 _actual_peri = 0.00;
00641 _actual_darea = 0.00;
00642 _actual_dperi = 0.00;
00643 _actual_dmax = 0.00;
00644 _actual_dmin = 0.00;
00645 _actual_davg = 0.00;
00646 _actual_sten = 0.00;
00647 _actual_partial = 0.00;
00648
00649
00650
00651
00652 }
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666 void wxQuantificationWidget::Forget( )
00667 {
00668 _shown = false;
00669 }
00670
00671
00672 void wxQuantificationWidget::ShowMARACASData( marInterface* mar )
00673 {
00674 double min, max;
00675 vtkImageData* imagedata;
00676 int nos;
00677 int actualQuant=-1;
00678
00679 wxBusyCursor wait;
00680 _mar = mar;
00681 _mar->_experiment->prepareQuantification( );
00682 nos = _mar->_experiment->getNumberOfSlices( );
00683 actualQuant = (int) (nos-1)/2 ;
00684 imagedata = _mar->_experiment->getSliceImage( actualQuant );
00685 _mar->_experiment->getAxis()->setActualQuant( actualQuant ) ;
00686 _mar->_experiment->getDynData( )->getVolume( )->getMinMax( min, max );
00687
00688 _3DWorld->ShowMARACASDataAndAxe( mar );
00689 _3DWorld->InitCameraReset( );
00690 _2DWorld->ConstructVTK( imagedata );
00691
00692
00693 _sl_Isovalue->SetRange( (int)min, (int)max);
00694 _sl_Isovalue->SetValue( (int)(max/4) );
00695 _sl_Opacity->SetValue( 50 );
00696 Reset_sl_Slider();
00697
00698 _pl_cntlHealthySick2->GetPnlSearStenosis()->GetPanelAutomatic()->SetRange(0,nos-1);
00699
00700 int ww1,hh1;
00701 int ww2,hh2;
00702 int wwT,hhT;
00703 int ss;
00704 this->GetSize(&wwT,&hhT);
00705 _wxStenosisPanel->GetSize(&ww1,&hh1);
00706 _pl_cntlHealthySick2->GetSize(&ww2,&hh2);
00707
00708 ss=hhT-(hh1+hh2+85);
00709 panel_splitter_right->SetSashPosition(ss,true);
00710
00711 }
00712
00713 void wxQuantificationWidget::Reset_sl_Slider()
00714 {
00715 int nos = _mar->_experiment->getNumberOfSlices( );
00716 _sl_Slice->SetRange(0, nos-1);
00717 _sl_Slice->SetValue( (nos-1)/2 );
00718
00719 }
00720
00721 void wxQuantificationWidget::SetSlider_Isovalue_Opacity(int isovalue,int opacity){
00722 _sl_Isovalue->SetValue(isovalue);
00723 _sl_Opacity->SetValue(opacity);
00724 _3DWorld->SetSurfaceIsoValue( isovalue );
00725 _3DWorld->SetSurfaceOpacity( opacity );
00726 }
00727
00728 void wxQuantificationWidget::OnShowSurface_CB(wxCommandEvent& event)
00729 {
00730 _3DWorld->SetSurfaceVisibility( _cb_ShowSurface->GetValue() );
00731 }
00732
00733 void wxQuantificationWidget::ResetAxis(){
00734 Reset_sl_Slider();
00735 _mar->_experiment->getAxis()->setActualQuant( _sl_Slice->GetValue() );
00736
00737 _3DWorld->Hide3DHealthySliceActor();
00738 _mar->_experiment->getAxis( )->setHealthySlice( 0,-1,0 );
00739 }
00740
00741 void wxQuantificationWidget::RefreshAxis( ){
00742 int acuatQuant = _mar->_experiment->getAxis()->getActualQuant();
00743 vtkImageData* imagedata;
00744 vtkProbeFilter* image3D;
00745 vtkPolyData* vtkPolydata_2Dcontour;
00746 vtkPoints* vtkPoints_2DDiameterMin;
00747 vtkPoints* vtkPoints_2DDiameterMax;
00748
00749 image3D = _mar->_experiment->get3DSlice ( acuatQuant );
00750 imagedata = _mar->_experiment->getSliceImage ( acuatQuant );
00751 vtkPolydata_2Dcontour = _mar->_experiment->get2Dcontour ( acuatQuant );
00752 vtkPoints_2DDiameterMin = _mar->_experiment->get2DDiameterMin ( acuatQuant );
00753 vtkPoints_2DDiameterMax = _mar->_experiment->get2DDiameterMax ( acuatQuant );
00754
00755 _3DWorld->SetImage(image3D);
00756 _3DWorld->Render( );
00757 _2DWorld->SetImage(imagedata);
00758
00759 if (_cb_VisibleRings->GetValue()==true){
00760 _2DWorld->SetContour( vtkPolydata_2Dcontour );
00761 _2DWorld->SetDiameterMin( vtkPoints_2DDiameterMin , true );
00762 _2DWorld->SetDiameterMax( vtkPoints_2DDiameterMax , true );
00763 }
00764 showVariables( );
00765
00766
00767
00768
00769
00770
00771
00772 }
00773
00774 void wxQuantificationWidget::MoveSlider(int actualQuant){
00775
00776 if (_bak_ActualSlice!=-1){
00777 SetManualContour_ReplaceContour();
00778 SetManualContour_2DWorld(false);
00779 }
00780
00781 _mar->_experiment->getAxis()->setActualQuant( actualQuant );
00782 RefreshAxis();
00783 }
00784
00785 void wxQuantificationWidget::OnSliderSliceScroll(wxScrollEvent& event){
00786 MoveSlider( event.GetPosition() );
00787 }
00788
00789 double wxQuantificationWidget::GetStenosisDiameter(int sickSlice){
00790 double healthyAverageDiameter = _mar->_experiment->getReferenceAverDiam() ;
00791 marContour *marcontourSick = _mar->_experiment->getContour( sickSlice );
00792 return doubleStenosis( healthyAverageDiameter , marcontourSick->getMinimumDiameter() );
00793 }
00794
00795 double wxQuantificationWidget::GetStenosisArea( int sickSlice){
00796 double healthyArea = _mar->_experiment->getReferenceArea();
00797 marContour *marcontourSick = _mar->_experiment->getContour( sickSlice );
00798 return doubleStenosis( healthyArea , marcontourSick->getArea() );
00799 }
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825 void wxQuantificationWidget::showVariables()
00826 {
00827 marContour* marcontour;
00828 int actualQuant;
00829 int healthySlice;
00830 int healthySliceStart;
00831 int healthySliceEnd;
00832
00833
00834
00835
00836
00837 actualQuant = _mar->_experiment->getAxis()->getActualQuant( );
00838 marcontour=_mar->_experiment->getContour( actualQuant );
00839
00840 wxString tmpString;
00841
00842
00843 tmpString.Printf( _T("%.2f mm") , _mar->_experiment->getTotalLength() ); _st_Value1->SetLabel(tmpString);
00844
00845
00846 tmpString.Printf( _T("%.2f mm^2") , marcontour->getArea()); _st_Value2->SetLabel(tmpString);
00847 tmpString.Printf( _T("%.2f mm") , marcontour->getPerimeter()); _st_Value3->SetLabel(tmpString);
00848
00849
00850 tmpString.Printf( _T("%.2f mm") , marcontour->getMinimumDiameter()); _st_Value6->SetLabel(tmpString);
00851 tmpString.Printf( _T("%.2f mm") , marcontour->getMaximumDiameter()); _st_Value7->SetLabel(tmpString);
00852 tmpString.Printf( _T("%.2f mm") , marcontour->getAverageDiameter()); _st_Value8->SetLabel(tmpString);
00853
00854 healthySlice = _mar->_experiment->getAxis( )->getHealthySlice( );
00855 healthySliceStart = _mar->_experiment->getAxis( )->getHealthySliceStart( );
00856 healthySliceEnd = _mar->_experiment->getAxis( )->getHealthySliceEnd( );
00857 if ( (healthySlice!=-1) ) {
00858 _st_Value100->SetLabel( strStenosis( GetStenosisArea(actualQuant) ) );
00859 _st_Value101->SetLabel( strStenosis( GetStenosisDiameter(actualQuant) ) );
00860 tmpString.Printf( _T("%.2f mm^2") , _mar->_experiment->getReferenceArea() ); _st_ValueRef102->SetLabel(tmpString);
00861 tmpString.Printf( _T("%.2f mm") , _mar->_experiment->getReferenceAverDiam() ); _st_ValueRef103->SetLabel(tmpString);
00862 } else {
00863 _st_Value100->SetLabel(_T("--"));
00864 _st_Value101->SetLabel(_T("--"));
00865 _st_ValueRef101->SetLabel(_T("--"));
00866 _st_ValueRef102->SetLabel(_T("--"));
00867 _st_ValueRef103->SetLabel(_T("--"));
00868 }
00869
00870 int startSlice = _mar->_experiment->getAxis()->getStartQuant();
00871 int finishSlice = _mar->_experiment->getAxis()->getFinishQuant();
00872 if ((startSlice!=-1) && (finishSlice!=-1)){
00873 tmpString.Printf( _T("%.2f mm") , _mar->_experiment->getSubAxisLength() ); _st_ValueRef101->SetLabel(tmpString);
00874 } else {
00875 _st_ValueRef101->SetLabel(_T("--"));
00876 }
00877
00878 panel_splitter->SetSashPosition(panel_splitter->GetSashPosition() );
00879
00880 }
00881
00882 double wxQuantificationWidget::doubleStenosis(double healthy, double sick){
00883 double result;
00884 if (healthy==0) {
00885 result=-1;
00886 } else {
00887
00888
00889 result = ( (healthy-sick)/healthy) * 100 ;
00890 }
00891
00892 return result;
00893 }
00894
00895 wxString wxQuantificationWidget::strStenosis(double stenosis){
00896
00897 wxString tmpString;
00898 if (stenosis==-1) {
00899 tmpString.Printf(_T("%d"),-1);
00900 } else {
00901 tmpString.Printf(_T("%.2f"), stenosis );
00902 }
00903 return tmpString + _T(" \%");
00904 }
00905
00906 void wxQuantificationWidget::OnSliderIsovalueScroll(wxScrollEvent& event)
00907 {
00908 wxBusyCursor wait;
00909 _3DWorld->SetSurfaceIsoValue( event.GetPosition() );
00910 }
00911
00912 void wxQuantificationWidget::OnSliderOpacityScroll(wxScrollEvent& event)
00913 {
00914 _3DWorld->SetSurfaceOpacity( event.GetPosition() );
00915 }
00916
00917 void wxQuantificationWidget::AddAxisActors(){
00918
00919 marAxis *maraxis = _mar->_experiment->getAxis( );
00920 if (maraxis!=NULL) _3DWorld->SetAxis( maraxis->Draw( ) );
00921
00922
00923 }
00924
00925 void wxQuantificationWidget::Clean3D( bool eraseAxe )
00926 {
00927 _first_quant = -1;
00928 _last_quant = -1;
00929
00930
00931
00932 _quant_shown = false;
00933
00934 _3DWorld->InitListContourActor( -1,_mar->_experiment->getNumberOfSlices() );
00935 if (eraseAxe==true) { _3DWorld->RemoveAxis(); }
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976 }
00977
00978 void wxQuantificationWidget::Reload_Axis(bool mask , bool step )
00979 {
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097 }
01098
01099
01100 void wxQuantificationWidget::Show_Max_Min_Diameters()
01101 {
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156 }
01157
01158
01159
01160 int wxQuantificationWidget::Back( )
01161 {
01162 int ret;
01163
01164 ret = _shown;
01165 _shown = 0;
01166 return ret;
01167 }
01168
01169
01170 void wxQuantificationWidget::Set_plane_3D( double x, double y )
01171 {
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205 }
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222 void wxQuantificationWidget::Point_Intensity(double x, double y)
01223 {
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235 }
01236
01237
01238 void wxQuantificationWidget::CleanContour()
01239 {
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289 }
01290
01291
01292
01293
01294 void wxQuantificationWidget::Do_Quant()
01295 {
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499 }
01500
01501
01502
01503 void wxQuantificationWidget::OnContour_BT(wxCommandEvent& event){
01504 int slice=_sl_Slice->GetValue();
01505 _3DWorld->Set3DContourActor( slice , _mar->_experiment->get3Dcontour(slice) , _cb_VisibleRings->GetValue() ,0 );
01506 }
01507
01508 void wxQuantificationWidget::OnClean_BT(wxCommandEvent& event){
01509 int slice=_sl_Slice->GetValue();
01510 _3DWorld->Erase3DContourActor( slice );
01511 }
01512
01513
01514 void wxQuantificationWidget::OnCleanAll_BT(wxCommandEvent& event){
01515 marDictionary marDict;
01516 char tmp[256];
01517
01518 wxMessageDialog *wxdiag;
01519 strcpy( tmp , marDict.GetString(870) ); strcat(tmp,"\n"); strcat(tmp,marDict.GetString(875));
01520 wxdiag= new wxMessageDialog(this, wxString(tmp ,wxConvUTF8), wxString(marDict.GetString(865), wxConvUTF8) , wxOK | wxCANCEL);
01521 if ( wxdiag->ShowModal() == wxID_OK ) {
01522 _3DWorld->InitListContourActor( 0, _mar->_experiment->getNumberOfSlices() );
01523 }
01524 wxdiag->Destroy();
01525 }
01526
01527
01528 void wxQuantificationWidget::OnSaveContours3D_BT(wxCommandEvent& event)
01529 {
01530
01531 wxFileDialog dialog(this, _T("Choose a file"), _T(""), _T(""), _T("*.maracas_contour3D"), wxSAVE );
01532 if (dialog.ShowModal() == wxID_OK)
01533 {
01534 std::string pathfilename( (const char *)(dialog.GetPath().mb_str()) );
01535
01536
01537
01538
01539 FILE *ff;
01540 ff=fopen(pathfilename.c_str(), "w+");
01541 _mar->_experiment->getAxis()->SaveExisting3DContours(ff);
01542 fclose(ff);
01543 }
01544
01545 }
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610 void wxQuantificationWidget::DetectHealthySickSlice( bool minSurf , bool maxSurf ){
01611 wxBusyCursor wait;
01612 double stenosis;
01613 double areaB;
01614 int iSlice;
01615 int startslice;
01616 int endslice;
01617 double maxStenosis = -9999999;
01618 double maxArea = -9999999;
01619 int sickSlice = 0;
01620 int healthySlice = 0;
01621 int sizeHealthyRegion = GetSizeHealthyRegion();
01622 int analysisTypeStenosis= GetAnalysisTypeStenosis();
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635 GetSliceLimites(0,startslice,endslice);
01636
01637 if (startslice>endslice){
01638 int temp=endslice;
01639 endslice=startslice;
01640 startslice=temp;
01641 }
01642
01643 int backSlice;
01644 if (minSurf==false) { backSlice = _sl_Slice->GetValue(); }
01645
01646 for (iSlice=startslice; iSlice<=endslice;iSlice++){
01647
01648 if (minSurf==true){
01649
01650 if (analysisTypeStenosis==1 ){ stenosis = GetStenosisDiameter(iSlice); }
01651 if (analysisTypeStenosis==2 ){ stenosis = GetStenosisArea(iSlice); }
01652 }
01653
01654 if (maxSurf==true){
01655 areaB = _mar->_experiment->getAverageArea(iSlice-sizeHealthyRegion,iSlice+sizeHealthyRegion);
01656 }
01657
01658 if ((stenosis>maxStenosis) &&(minSurf==true)){
01659 maxStenosis=stenosis;
01660 sickSlice=iSlice;
01661 }
01662 if ((areaB>maxArea) && (maxSurf==true)){
01663 maxArea=areaB;
01664 healthySlice=iSlice;
01665 }
01666 MoveSlider( iSlice );
01667 _sl_Slice->SetValue( iSlice );
01668 }
01669
01670
01671
01672
01673
01674
01675
01676 if (minSurf==true){
01677 MoveSlider( sickSlice );
01678 _sl_Slice->SetValue( sickSlice );
01679 }
01680
01681 if (maxSurf==true){
01682 MoveSlider( healthySlice );
01683 _sl_Slice->SetValue( healthySlice );
01684 }
01685
01686 }
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726
01727 int wxQuantificationWidget::GetHealthySlice(){
01728 return _mar->_experiment->getAxis()->getHealthySlice( );
01729 }
01730
01731 void wxQuantificationWidget::SetHealthySlice(int healthySlice){
01732 if (healthySlice==-1) {
01733 healthySlice=_sl_Slice->GetValue();
01734 }
01735 int sizeHealthyRegion = GetSizeHealthyRegion();
01736 int maxSlider = GetMaxActualSlice();
01737 int healthySliceStart = healthySlice - sizeHealthyRegion;
01738 int healthySliceEnd = healthySlice + sizeHealthyRegion;
01739 if (healthySliceStart < 0) { healthySliceStart = 0; }
01740 if (healthySliceEnd < 0) { healthySliceEnd = 0; }
01741 if (healthySliceStart > maxSlider) { healthySliceStart = maxSlider; }
01742 if (healthySliceEnd > maxSlider) { healthySliceEnd = maxSlider; }
01743 _mar->_experiment->getAxis()->setHealthySlice( healthySliceStart, healthySlice , healthySliceEnd);
01744
01745 _3DWorld->Set3DHealthySliceActor( );
01746 _3DWorld->Show3DHealthySliceActor();
01747 _cb_HealthySlice->SetValue(true);
01748 _3DWorld->InitListContourActor( 1, _mar->_experiment->getNumberOfSlices() );
01749 int iHealthySlice;
01750 for ( iHealthySlice=healthySliceStart ; iHealthySlice<=healthySliceEnd ; iHealthySlice++){
01751 _3DWorld->Set3DContourActor( iHealthySlice , _mar->_experiment->get3Dcontour(iHealthySlice) , true ,1);
01752 }
01753 showVariables();
01754 }
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820
01821
01822
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948 void wxQuantificationWidget::OnHealthySlice_CB(wxCommandEvent& event)
01949 {
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964 int healthySlice = _mar->_experiment->getAxis( )->getHealthySlice( );
01965 if (healthySlice!=-1) {
01966 if ( _cb_HealthySlice->GetValue() )
01967 _3DWorld->Show3DHealthySliceActor();
01968 else
01969 _3DWorld->Hide3DHealthySliceActor();
01970 }
01971 }
01972
01973
01974
01975 void wxQuantificationWidget::OnVisibleRing_CB(wxCommandEvent& event){
01976 if ( _cb_VisibleRings->GetValue() ){
01977 _3DWorld->Show3DContourActor();
01978 _2DWorld->Show2DContourDiameters();
01979 RefreshAxis();
01980 } else {
01981 _3DWorld->Hide3DContourActor();
01982 _2DWorld->Hide2DContourDiameters();
01983 }
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998 }
01999
02000 void wxQuantificationWidget::OnPerpendicular_CB(wxCommandEvent& event)
02001 {
02002 if ( _cb_Perpendicular->GetValue() )
02003 _3DWorld->Show3DSliceActor();
02004 else
02005 _3DWorld->Hide3DSliceActor();
02006 }
02007
02008
02009 void wxQuantificationWidget::OnGreyScale_RB(wxCommandEvent& event){
02010 if ( _rb_GreyScale->GetValue() ){
02011 _3DWorld->SetBWLookUp();
02012 }
02013 }
02014
02015 void wxQuantificationWidget::OnColor_RB(wxCommandEvent& event){
02016 if ( _rb_Color->GetValue() ){
02017 _3DWorld->SetColorLookUp();
02018 }
02019 }
02020
02021 void wxQuantificationWidget::CallBackOnLeftDClick( wxMouseEvent& event ){
02022
02023 double pp[3], cp[3];
02024 _3DWorld->GetLast3DClickPoint(pp,cp);
02025
02026 int i,iback,maxPoints;
02027 double *c, cc[3];
02028 double dist,distMin=-1;
02029 iback=-1;
02030
02031 marAxis *maraxis = _mar->_experiment->getAxis( );
02032 maxPoints = maraxis->getNumberOfSplinePoints();
02033 for ( i=0 ; i<maxPoints ; i++ ){
02034 c = maraxis->getSplinePoint(i);
02035 cc[0]=c[0]-pp[0];
02036 cc[1]=c[1]-pp[1];
02037 cc[2]=c[2]-pp[2];
02038 dist=sqrt( cc[0]*cc[0] + cc[1]*cc[1] + cc[2]*cc[2] );
02039 if ((distMin==-1) || (dist<distMin)) {
02040 iback=i;
02041 distMin=dist;
02042 }
02043 }
02044 _sl_Slice->SetValue(iback);
02045 MoveSlider(iback);
02046
02047 }
02048
02049
02050 void wxQuantificationWidget::CallBackOnMouseWheel( wxMouseEvent& event ){
02051 int slice=_sl_Slice->GetValue();
02052 if (event.GetWheelRotation()>0){ slice++; }
02053 if (event.GetWheelRotation()<0){ slice--; }
02054 if (slice < _sl_Slice->GetMin() ) { slice=_sl_Slice->GetMin(); }
02055 if (slice > _sl_Slice->GetMax() ) { slice=_sl_Slice->GetMax(); }
02056 _sl_Slice->SetValue(slice);
02057 MoveSlider(slice);
02058 }
02059
02060 int wxQuantificationWidget::GetActualSlice(){
02061 return _sl_Slice->GetValue();
02062 }
02063
02064 int wxQuantificationWidget::GetMaxActualSlice(){
02065 return _sl_Slice->GetMax();
02066 }
02067
02068 int wxQuantificationWidget::GetSizeHealthyRegion(){
02069 return _sizeHealthyRegion;
02070 }
02071
02072 void wxQuantificationWidget::SetSizeHealthyRegion(int size){
02073 _sizeHealthyRegion = size;
02074 }
02075
02076 void wxQuantificationWidget::GetHealthySliceRange(int &healthySliceStart,int &healthySliceEnd){
02077 healthySliceStart = _mar->_experiment->getAxis()->getHealthySliceStart( );
02078 healthySliceEnd = _mar->_experiment->getAxis()->getHealthySliceEnd( );
02079 }
02080
02081 void wxQuantificationWidget::Set3DRegionSliceActor( int type, int k1,int k2 ){
02082 _3DWorld->Set3DRegionSliceActor(type,k1,k2);
02083 }
02084
02085 void wxQuantificationWidget::Set3DStartRegionSliceActor( int type, int k){
02086 _3DWorld->Set3DStartRegionSliceActor(type,k);
02087 }
02088
02089 void wxQuantificationWidget::Set3DEndRegionSliceActor( int type, int k){
02090 _3DWorld->Set3DEndRegionSliceActor(type,k);
02091 }
02092
02093 void wxQuantificationWidget::Show3DRegionSliceActor( int type ){
02094 _3DWorld->Show3DRegionSliceActor(type);
02095 }
02096
02097 void wxQuantificationWidget::Show3DStartRegionSliceActor( int type ){
02098 _3DWorld->Show3DStartRegionSliceActor(type);
02099 }
02100
02101 void wxQuantificationWidget::Show3DEndRegionSliceActor( int type ){
02102 _3DWorld->Show3DEndRegionSliceActor(type);
02103 }
02104
02105 void wxQuantificationWidget::Hide3DRegionSliceActor( int type ){
02106 _3DWorld->Hide3DRegionSliceActor(type);
02107 }
02108
02109 void wxQuantificationWidget::Hide3DStartRegionSliceActor( int type ){
02110 _3DWorld->Hide3DStartRegionSliceActor(type);
02111 }
02112
02113 void wxQuantificationWidget::Hide3DEndRegionSliceActor( int type ){
02114 _3DWorld->Hide3DEndRegionSliceActor(type);
02115 }
02116
02117 void wxQuantificationWidget::GetSliceLimites(int type, int &sliceStart, int &sliceEnd){
02118 _3DWorld->GetSliceLimites(type,sliceStart,sliceEnd);
02119 }
02120
02121 int wxQuantificationWidget::GetAnalysisTypeStenosis(){
02122 return _3DWorld->GetAnalysisTypeStenosis();
02123 }
02124
02125 void wxQuantificationWidget::SetAnalysisTypeStenosis(int analysisTypeStenosis){
02126 _3DWorld->SetAnalysisTypeStenosis(analysisTypeStenosis);
02127 }
02128
02129 void wxQuantificationWidget::SetManualContour_2DWorld(bool ok){
02130
02131 if (ok==false){
02132 _2DWorld->SetState(1);
02133 _2DWorld->EraseManualContour();
02134 }
02135 if (ok==true){
02136 _2DWorld->SetState(2);
02137 _2DWorld->CreateNewManualContour();
02138 _2DWorld->Render();
02139
02140 }
02141
02142 }
02143
02144 void wxQuantificationWidget::SetManualContour_AddPoint_2DWorld(){
02145 _bak_ActualSlice = _sl_Slice->GetValue();
02146 _2DWorld->Hide2DContourDiameters();
02147 _mar->_experiment->getAxis()->EraseContour(_bak_ActualSlice);
02148 _3DWorld->Erase3DContourActor( _bak_ActualSlice );
02149
02150 _2DWorld->SetStateManualContour(0);
02151 }
02152
02153 void wxQuantificationWidget::SetManualContour_InsertPoint_2DWorld(){
02154 _2DWorld->SetStateManualContour(2);
02155 }
02156
02157 void wxQuantificationWidget::SetManualContour_ErasePoint_2DWorld(){
02158 _2DWorld->SetStateManualContour(3);
02159 }
02160
02161 void wxQuantificationWidget::SetManualContour_MovePoint_2DWorld(){
02162 _2DWorld->SetStateManualContour(4);
02163 }
02164
02165 void wxQuantificationWidget::SetManualContour_ReplaceContour(){
02166 if (_bak_ActualSlice!=-1){
02167 int size = _2DWorld->GetNumberOfPointsSplineManualContour();
02168 double *vx = _2DWorld->GetVectorPointsXManualContour();
02169 double *vy = _2DWorld->GetVectorPointsYManualContour();
02170 _mar->_experiment->getAxis()->replaceContour2D(_bak_ActualSlice,size,vx,vy);
02171 free(vx);
02172 free(vy);
02173 RefreshAxis();
02174 _bak_ActualSlice=-1;
02175 }
02176 }
02177
02178 kVolume* wxQuantificationWidget::GetVolumeAxisExtended(int wz1,int wz2)
02179 {
02180
02181 vtkImageData *imagedata;
02182 imagedata=_mar->_experiment->getSliceImage(wz1);
02183 int dims[3];
02184 imagedata->GetDimensions (dims);
02185 int wx=dims[0];
02186 int wy=dims[1];
02187 int wz = wz2-wz1+1;
02188 kVolume *kvol =new kVolume( kVolume::USHORT, wx, wy, wz,1, 1, 1, malloc(sizeof(unsigned short)*wx*wy*wz ) );
02189 vtkImageData *vol = kvol->castVtk();
02190
02191
02192 int i;
02193 for (i=wz1;i<=wz2;i++)
02194 {
02195
02196 imagedata=_mar->_experiment->getSliceImage(i);
02197
02198
02199 void *p_imagedata = imagedata->GetScalarPointer(0,0,0);
02200 void *p_vol = vol->GetScalarPointer(0,0,i-wz1);
02201 memcpy( p_vol, p_imagedata , sizeof(unsigned short)*dims[0]*dims[1] );
02202 }
02203 return kvol;
02204 }
02205
02206
02207
02208 void wxQuantificationWidget::OnContourWall()
02209 {
02210 }
02211
02212
02213 void wxQuantificationWidget::OnContourLumen()
02214 {
02215 }
02216
02217
02218 void wxQuantificationWidget::OnContourHypo()
02219 {
02220 }
02221
02222
02223 void wxQuantificationWidget::OnContourCalc()
02224 {
02225 }
02226
02227
02228 void wxQuantificationWidget::OnReplaceContourWall()
02229 {
02230 }
02231
02232 void wxQuantificationWidget::OnReplaceContourLumen()
02233 {
02234 }
02235
02236 void wxQuantificationWidget::OnReplaceContourHypo()
02237 {
02238 }
02239
02240
02241 void wxQuantificationWidget::OnReplaceContourCalc()
02242 {
02243 }
02244
02245
02246
02247 void wxQuantificationWidget::OnSliderDiscontinuityScroll(int percentage)
02248 {
02249 }
02250
02251
02252 void wxQuantificationWidget::OnSliderLumenPercentageScroll(int percentage)
02253 {
02254 }
02255
02256
02257 void wxQuantificationWidget::OnSliderCalcPercentageScroll(int percentage)
02258 {
02259 }
02260
02261
02262 void wxQuantificationWidget::OnCalibration()
02263 {
02264 }
02265
02266 void wxQuantificationWidget::OnFile()
02267 {
02268 }
02269
02270
02271 void wxQuantificationWidget::OnShowAll(bool value)
02272 {
02273 }
02274
02275
02276 void wxQuantificationWidget::OnShowWall(bool value)
02277 {
02278 }
02279
02280 void wxQuantificationWidget::OnShowLumen(bool value)
02281 {
02282 }
02283
02284
02285 void wxQuantificationWidget::OnShowCalc(bool value)
02286 {
02287 }
02288
02289
02290 void wxQuantificationWidget::OnShowHypo(bool value)
02291 {
02292 }
02293
02294
02295
02296
02297
02298