wxQuantificationWidget.cxx

Go to the documentation of this file.
00001 
00002 
00003 /*=========================================================================
00004 
00005  Program:   wxMaracas
00006  Module:    $RCSfile: wxQuantificationWidget.cxx,v $
00007  Language:  C++
00008  Date:      $Date: 2009/05/14 13:54:57 $
00009  Version:   $Revision: 1.1 $
00010  
00011   Copyright: (c) 2002, 2003
00012   License:
00013   
00014    This software is distributed WITHOUT ANY WARRANTY; without even
00015    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00016    PURPOSE.  See the above copyright notice for more information.
00017    
00018 =========================================================================*/
00019 
00020 #include "wxQuantificationWidget.h"
00021 #include "../marDictionary.h"
00022 //#include "../wxMaracasMPR.h"
00023 
00024 
00025 //#include <matrix.h>
00026 //#include <wx/notebook.h>
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 //      EVT_BUTTON(ID_BUTTON_HEALTHY,   wxQuantificationWidget::OnHealthySlice_BT                                       )
00040 
00041         // PS ->     EVT_BUTTON(ID_BUTTON_CALCULATED, wxQuantificationWidget::OnCalculated_BT           )
00042         // PS ->     EVT_BUTTON(ID_BUTTON_PAUSE,      wxQuantificationWidget::OnPause_BT                        )
00043         // PS ->     EVT_BUTTON(ID_BUTTON_DELETE,     wxQuantificationWidget::OnDelete_BT                       )
00044         // PS ->     EVT_BUTTON(ID_BUTTON_POINT,      wxQuantificationWidget::OnSetPoint_BT                     )
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 // Constructor
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 //      panel_left                       = new wxPanel(panel_splitter                   , -1, wxDefaultPosition, wxSize(400,400));
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         // maracas
00085         _mar = NULL;
00086         SetSizeHealthyRegion( 5 );
00087 
00088 //EEDxx 2.6
00089 //      this->SetBackgroundColour(*wxLIGHT_GREY);
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 //EED Borrame
00107 //startTimeRI = clock();
00108 
00109 }
00110 
00111 
00112 //--------------------------------------------------------------------------------
00113 // Destructor
00114 // ----------------------------------------------------------------------------
00115 wxQuantificationWidget::~wxQuantificationWidget( )
00116 {
00117 //EEDx15
00118         _3DWorld->Delete( );
00119 //      delete _2DWorld;
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) ); // "Stenosis (area)"
00128         _st_Label101 = new wxStaticText(panel, -1, wxString(marDict.GetString(260), wxConvUTF8) ); // "Stenosis (diameter)"
00129 //      _st_Label102 = new wxStaticText(panel, -1, "                          < Area (mm^2) > Stenosis :  ",wxPoint(0,0),wxDefaultSize,wxALIGN_RIGHT );
00130 //      _st_Label103 = new wxStaticText(panel, -1, "                       < Perimeter (mm) > Stenosis :  ",wxPoint(0,0),wxDefaultSize,wxALIGN_RIGHT );
00131 //      _st_Label104 = new wxStaticText(panel, -1, "        < Diameter (mm) from Area > Stenosis :  ",wxPoint(0,0),wxDefaultSize,wxALIGN_RIGHT );
00132 //      _st_Label105 = new wxStaticText(panel, -1, "  < Diameter (mm) from Perimeter > Stenosis :  ",wxPoint(0,0),wxDefaultSize,wxALIGN_RIGHT );
00133 //      _st_Label106 = new wxStaticText(panel, -1, "          < Minimum Diameter (mm) > Stenosis :  ",wxPoint(0,0),wxDefaultSize,wxALIGN_RIGHT );
00134 //      _st_Label107 = new wxStaticText(panel, -1, "          < Maximum Diameter (mm) > Stenosis :  ",wxPoint(0,0),wxDefaultSize,wxALIGN_RIGHT );
00135 //      _st_Label108 = new wxStaticText(panel, -1, "          < Avarege Diameter (mm) > Stenosis :  ",wxPoint(0,0),wxDefaultSize,wxALIGN_RIGHT );
00136 
00137         _st_Value100 = new wxStaticText(panel, -1, _T("--                ") );
00138         _st_Value101 = new wxStaticText(panel, -1, _T("--                ") );
00139 //      _st_Value102 = new wxStaticText(panel, -1, "--");
00140 //      _st_Value103 = new wxStaticText(panel, -1, "--");
00141 //      _st_Value104 = new wxStaticText(panel, -1, "--");
00142 //      _st_Value105 = new wxStaticText(panel, -1, "--");
00143 //      _st_Value106 = new wxStaticText(panel, -1, "--");
00144 //      _st_Value107 = new wxStaticText(panel, -1, "--");
00145 //      _st_Value108 = new wxStaticText(panel, -1, "--");
00146 
00147 //EEDxx 2.6
00148 //      wxStaticText *_st_LabelBlanc = new wxStaticText(panel, -1, "                 ");
00149 //      _st_LabelBlanc->SetBackgroundColour(*wxLIGHT_GREY);
00150 
00151 //EEDxx 2.6
00152 //      panel->SetBackgroundColour(wxColour(100,0,100));
00153 //      _st_Label100->SetBackgroundColour(*wxLIGHT_GREY);
00154 //      _st_Label101->SetBackgroundColour(*wxLIGHT_GREY);
00155 
00156 
00157 
00158 
00159 //      _st_Label102->SetBackgroundColour(*wxLIGHT_GREY);
00160 //      _st_Label103->SetBackgroundColour(*wxLIGHT_GREY);
00161 //      _st_Label104->SetBackgroundColour(*wxLIGHT_GREY);
00162 //      _st_Label105->SetBackgroundColour(*wxLIGHT_GREY);
00163 //      _st_Label106->SetBackgroundColour(*wxLIGHT_GREY);
00164 //      _st_Label107->SetBackgroundColour(*wxLIGHT_GREY);
00165 //      _st_Label108->SetBackgroundColour(*wxLIGHT_GREY);
00166 
00167 
00168 //EEDxx 2.6
00169 //      _st_Value100->SetBackgroundColour(*wxLIGHT_GREY);
00170 //      _st_Value101->SetBackgroundColour(*wxLIGHT_GREY);
00171 
00172 
00173 //      _st_Value102->SetBackgroundColour(*wxLIGHT_GREY);
00174 //      _st_Value103->SetBackgroundColour(*wxLIGHT_GREY);
00175 //      _st_Value104->SetBackgroundColour(*wxLIGHT_GREY);
00176 //      _st_Value105->SetBackgroundColour(*wxLIGHT_GREY);
00177 //      _st_Value106->SetBackgroundColour(*wxLIGHT_GREY);
00178 //      _st_Value107->SetBackgroundColour(*wxLIGHT_GREY);
00179 //      _st_Value108->SetBackgroundColour(*wxLIGHT_GREY);
00180 
00181         wxFont font(14,wxDEFAULT ,wxNORMAL,wxBOLD);
00182 //      _st_Label100->SetFont(font);
00183 //      _st_Label101->SetFont(font);
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 //      gridSizer->Add(_st_LabelBlanc);
00200 //      gridSizer->Add(_st_LabelBlanc);
00201 //      gridSizer->Add(_st_LabelBlanc);
00202 //      gridSizer->Add(_st_LabelBlanc);
00203 //      gridSizer->Add(_st_Label102);
00204 //      gridSizer->Add(_st_Value102);
00205 //      gridSizer->Add(_st_LabelBlanc);
00206 //      gridSizer->Add(_st_LabelBlanc);
00207 //      gridSizer->Add(_st_Label103);
00208 //      gridSizer->Add(_st_Value103);
00209 //      gridSizer->Add(_st_LabelBlanc);
00210 //      gridSizer->Add(_st_LabelBlanc);
00211 //      gridSizer->Add(_st_Label104);
00212 //      gridSizer->Add(_st_Value104);
00213 //      gridSizer->Add(_st_LabelBlanc);
00214 //      gridSizer->Add(_st_LabelBlanc);
00215 //      gridSizer->Add(_st_Label105);
00216 //      gridSizer->Add(_st_Value105);
00217 //      gridSizer->Add(_st_LabelBlanc);
00218 //      gridSizer->Add(_st_LabelBlanc);
00219 //      gridSizer->Add(_st_Label106);
00220 //      gridSizer->Add(_st_Value106);
00221 //      gridSizer->Add(_st_LabelBlanc);
00222 //      gridSizer->Add(_st_LabelBlanc);
00223 //      gridSizer->Add(_st_Label107);
00224 //      gridSizer->Add(_st_Value107);
00225 //      gridSizer->Add(_st_LabelBlanc);
00226 //      gridSizer->Add(_st_LabelBlanc);
00227 //      gridSizer->Add(_st_Label108);
00228 //      gridSizer->Add(_st_Value108);
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 //EEDxx 2.6
00241 //      panel->SetBackgroundColour(*wxLIGHT_GREY);
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         // wxChart
00255 
00256         // EED 
00257         //_Chart = new wxChart( this, ID_QUANTIF3D );
00258         //_Chart->SetMaxWidthHeight(500,300);
00259         //_Chart->SetBackgroundColour(*wxWHITE);
00260 
00261          _wxStenosisPanel = CreateStenosisPanel();
00262 
00263         //wxButton
00264         // PS ->   _bt_Point = new wxButton( this, ID_BUTTON_POINT, "Point...",
00265         // PS ->                             wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00266 //      _bt_Healthy = new wxButton( panel_left, ID_BUTTON_HEALTHY, "Healthy Slice",
00267 //              wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00268 
00269 
00270 
00271         // PS ->   _bt_ContourCalculated = new wxButton( this, ID_BUTTON_CALCULATED, "Contour calculated",
00272         // PS ->                                         wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
00273         // PS ->   _bt_Pause = new wxButton( this, ID_BUTTON_PAUSE, "Pause",
00274         // PS ->                             wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00275         // PS ->   _bt_Delete = new wxButton( this, ID_BUTTON_DELETE, "Delete Quantification",
00276         // PS ->                              wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00277 
00278 
00279         
00280 
00281         _cb_HealthySlice        = new wxCheckBox( panel_left_down, ID_CHECKBOX_HEALTHY, wxString(marDict.GetString(205), wxConvUTF8)); // "Healthy slice"
00282         _cb_HealthySlice->SetValue(true);
00283 //EEDxx 2.6
00284 //      _cb_HealthySlice->SetBackgroundColour(*wxLIGHT_GREY);
00285         _cb_Perpendicular       = new wxCheckBox( panel_left_down, ID_CHECKBOX_PERPENDICULAR, wxString(marDict.GetString(210), wxConvUTF8)); //"Perpendicular section"
00286         _cb_Perpendicular->SetValue(true);
00287 //EEDxx 2.6
00288 //      _cb_Perpendicular->SetBackgroundColour(*wxLIGHT_GREY);
00289 
00290         _rb_GreyScale           = new wxRadioButton( panel_left_down, ID_RADIOBUTTON_GREYSCALE, wxString(marDict.GetString(230), wxConvUTF8), wxDefaultPosition,wxDefaultSize,wxRB_GROUP  ); //"greyscale    "
00291         _rb_GreyScale->SetValue(true);
00292 //EEDxx 2.6
00293 //      _rb_GreyScale->SetBackgroundColour(*wxLIGHT_GREY);
00294 
00295         _rb_Color                       = new wxRadioButton( panel_left_down, ID_RADIOBUTTON_COLOR, wxString(marDict.GetString(235), wxConvUTF8), wxDefaultPosition,wxDefaultSize );//"color    "
00296         _rb_Color->SetValue(false);
00297 //EEDxx 2.6
00298 //      _rb_Color->SetBackgroundColour(*wxLIGHT_GREY);
00299 
00300         _cb_VisibleRings        = new wxCheckBox( panel_left_down, ID_CHECKBOX_VISIBLE_RINGS, wxString(marDict.GetString(215), wxConvUTF8));//"Visible rings"
00301         _cb_VisibleRings->SetValue(true);
00302 //EEDxx 2.6
00303 //      _cb_VisibleRings->SetBackgroundColour(*wxLIGHT_GREY);
00304         _cb_ShowSurface         = new wxCheckBox( panel_left_down, ID_CHECKBOX_SHOW_SURFACE, wxString(marDict.GetString(220), wxConvUTF8));//"Show Surface"
00305         _cb_ShowSurface->SetValue(true);
00306 //EEDxx 2.6
00307 //      _cb_ShowSurface->SetBackgroundColour(*wxLIGHT_GREY);
00308 
00309         
00310         _bt_AddContour3D                = new wxButton( panel_left_down, ID_BUTTON_CONTOUR, wxString(marDict.GetString(245), wxConvUTF8) ,//"Add mark contour"
00311                                        wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00312         _bt_CleanContour3D              = new wxButton( panel_left_down, ID_BUTTON_CLEAN, wxString(marDict.GetString(250), wxConvUTF8) ,//"Erase mark contours"
00313                                      wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00314 
00315         _bt_CleanAllContours3D  = new wxButton( panel_left_down, ID_BUTTON_CLEAN_ALL, wxString(marDict.GetString(253), wxConvUTF8) ,//"Erase all mark contours"
00316                                      wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00317 
00318         _bt_SaveContours3D      = new wxButton( panel_left_down, ID_BUTTON_SAVE_CONTOURS3D, wxString(marDict.GetString(248), wxConvUTF8) ,//"Save contours 3D"
00319                                      wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
00320 
00321         //wxSlider
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 //EEDxx 2.6
00326 //      _sl_Slice->SetBackgroundColour(*wxLIGHT_GREY);
00327 //      _sl_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
00328 //      _sl_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
00329 
00330         // size
00331         _sl_Slice->SetSize(1800,16);
00332         _sl_Isovalue->SetSize(300,16);
00333         _sl_Opacity->SetSize(300,16);
00334         
00335         // Text
00336         _st_Slice        = new wxStaticText(panel_left_down, -1, wxString(marDict.GetString(90), wxConvUTF8) ); //"Slice "
00337         _st_Isovalue = new wxStaticText(panel_left_down, -1, wxString(marDict.GetString(240), wxConvUTF8) ); //"Isovalue"
00338         _st_Opacity  = new wxStaticText(panel_left_down, -1, wxString(marDict.GetString(225), wxConvUTF8) ); //"Opacity "
00339 //EEDxx 2.6
00340 //      _st_Slice->SetBackgroundColour(*wxLIGHT_GREY);
00341 //      _st_Isovalue->SetBackgroundColour(*wxLIGHT_GREY);
00342 //      _st_Opacity->SetBackgroundColour(*wxLIGHT_GREY);
00343         
00344         
00345 //      _st_Label0 = new wxStaticText(this, -1, "Partial Axis Lenght");
00346 //      _st_Value0 = new wxStaticText(this, -1, "0.00");
00347 //      _st_Label0->SetBackgroundColour(*wxLIGHT_GREY);
00348 //      _st_Value0->SetBackgroundColour(*wxLIGHT_GREY);
00349         _st_Label1 = new wxStaticText(this, -1, wxString(marDict.GetString(380), wxConvUTF8) ); //"Total Axis Lenght"
00350         _st_Value1 = new wxStaticText(this, -1, _T("0.00"));
00351 
00352 //EEDxx 2.6
00353 //      _st_Label1->SetBackgroundColour(*wxLIGHT_GREY);
00354 //      _st_Value1->SetBackgroundColour(*wxLIGHT_GREY);
00355 
00356         _st_Label2 = new wxStaticText(this, -1, wxString(marDict.GetString(390), wxConvUTF8) );//"Area"
00357         _st_Value2 = new wxStaticText(this, -1, _T("0.00"));
00358 //EEDxx 2.6
00359 //      _st_Label2->SetBackgroundColour(*wxLIGHT_GREY);
00360 //      _st_Value2->SetBackgroundColour(*wxLIGHT_GREY);
00361 
00362         _st_Label3 = new wxStaticText(this, -1, wxString(marDict.GetString(400), wxConvUTF8) );//"Perimeter"
00363         _st_Value3 = new wxStaticText(this, -1, _T("0.00") );
00364 //EEDxx 2.6
00365 //      _st_Label3->SetBackgroundColour(*wxLIGHT_GREY);
00366 //      _st_Value3->SetBackgroundColour(*wxLIGHT_GREY);
00367 
00368 
00369 //      _st_Label4 = new wxStaticText(this, -1, "Diameter from area");
00370 //      _st_Value4 = new wxStaticText(this, -1, "0.00");
00371 //      _st_Label4->SetBackgroundColour(*wxLIGHT_GREY);
00372 //      _st_Value4->SetBackgroundColour(*wxLIGHT_GREY);
00373 //      _st_Label5 = new wxStaticText(this, -1, "Diameter from perimeter");
00374 //      _st_Value5 = new wxStaticText(this, -1, "0.00");
00375 //      _st_Label5->SetBackgroundColour(*wxLIGHT_GREY);
00376 //      _st_Value5->SetBackgroundColour(*wxLIGHT_GREY);
00377         _st_Label6 = new wxStaticText(this, -1, wxString(marDict.GetString(405), wxConvUTF8) );//"Minimum Diameter"
00378         _st_Value6 = new wxStaticText(this, -1, _T("0.00"));
00379 //EEDxx 2.6
00380 //      _st_Label6->SetBackgroundColour(*wxLIGHT_GREY);
00381 //      _st_Value6->SetBackgroundColour(*wxLIGHT_GREY);
00382         _st_Label7 = new wxStaticText(this, -1, wxString(marDict.GetString(410), wxConvUTF8) );//"Maximum Diameter"
00383         _st_Value7 = new wxStaticText(this, -1, _T("0.00"));
00384 //EEDxx 2.6
00385 //      _st_Label7->SetBackgroundColour(*wxLIGHT_GREY);
00386 //      _st_Value7->SetBackgroundColour(*wxLIGHT_GREY);
00387         _st_Label8 = new wxStaticText(this, -1, wxString(marDict.GetString(415), wxConvUTF8) );//"Average Diameter"
00388         _st_Value8 = new wxStaticText(this, -1, _T("0.00"));
00389 //EEDxx 2.6
00390 //      _st_Label8->SetBackgroundColour(*wxLIGHT_GREY);
00391 //      _st_Value8->SetBackgroundColour(*wxLIGHT_GREY);
00392         // EED -> _st_Label9 = new wxStaticText(this, -1, "Stenosis");
00393         // EED -> _st_Value9 = new wxStaticText(this, -1, "0.00");
00394         // EED -> _st_Label9->SetBackgroundColour(*wxLIGHT_GREY);
00395         // EED -> _st_Value9->SetBackgroundColour(*wxLIGHT_GREY);
00396 
00397         _st_LabelRef101 = new wxStaticText(this, -1, wxString(marDict.GetString(385), wxConvUTF8) );//"Seg. Length"
00398         _st_ValueRef101 = new wxStaticText(this, -1, _T("--"));
00399 //EEDxx 2.6
00400 //      _st_LabelRef101->SetBackgroundColour(*wxLIGHT_GREY);
00401 //      _st_ValueRef101->SetBackgroundColour(*wxLIGHT_GREY);
00402         _st_LabelRef102 = new wxStaticText(this, -1, wxString(marDict.GetString(395), wxConvUTF8) );//"Ref. Area"
00403         _st_ValueRef102 = new wxStaticText(this, -1, _T("--"));
00404 //EEDxx 2.6
00405 //      _st_LabelRef102->SetBackgroundColour(*wxLIGHT_GREY);
00406 //      _st_ValueRef102->SetBackgroundColour(*wxLIGHT_GREY);
00407         _st_LabelRef103 = new wxStaticText(this, -1, wxString(marDict.GetString(420), wxConvUTF8) );//"Ref. Average Diam."
00408         _st_ValueRef103 = new wxStaticText(this, -1, _T("--"));
00409 //EEDxx 2.6
00410 //      _st_LabelRef103->SetBackgroundColour(*wxLIGHT_GREY);
00411 //      _st_ValueRef103->SetBackgroundColour(*wxLIGHT_GREY);
00412 
00413         _pl_cntlHealthySick2 = new wxPanelControlsHealthySickSlice2(panel_right_down,this);
00414 
00415 //EEDxx 2.6
00416 //   panel_left->SetBackgroundColour(*wxLIGHT_GREY);
00417 //      panel_right_up->SetBackgroundColour(*wxLIGHT_GREY);
00418 //      panel_right_down->SetBackgroundColour(*wxLIGHT_GREY);
00419 //      panel_splitter_right->SetBackgroundColour(*wxLIGHT_GREY);
00420 //      panel_splitter->SetBackgroundColour(*wxLIGHT_GREY);
00421  
00422 }
00423 
00424 //--------------------------------------------------------
00425 
00426 void wxQuantificationWidget::Do_layout()
00427 {
00428         
00429         //Do the layout:
00430         
00431         wxBoxSizer                      *sizer_principal        = new wxBoxSizer(wxVERTICAL);
00432         wxBoxSizer                      *status                         = new wxBoxSizer(wxHORIZONTAL);
00433 
00434 //EEDxx 2.6     
00435 //      wxFlexGridSizer         *medium_right_up        = new wxFlexGridSizer(1,0);
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 //      wxFlexGridSizer         *autoQuantif            = new wxFlexGridSizer(1,0);
00444 
00445 
00446 //      wxStaticBoxSizer        *axe                            = new wxStaticBoxSizer(new wxStaticBox(panel_left_down, -1, _T("")), wxVERTICAL);
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 //      wxBoxSizer                      *status4                        = new wxBoxSizer(wxVERTICAL);
00462 //      wxBoxSizer                      *status5                        = new wxBoxSizer(wxVERTICAL);
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 //      status0->Add(_st_Label0, 1, wxALL|wxALIGN_CENTER, 5);
00498 //      status0->Add(_st_Value0, 1, wxALL|wxALIGN_CENTER, 5);
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 //      status4->Add(_st_Label4, 1, wxALL|wxALIGN_CENTER, 5);
00506 //      status4->Add(_st_Value4, 1, wxALL|wxALIGN_CENTER, 5);
00507 //      status5->Add(_st_Label5, 1, wxALL|wxALIGN_CENTER, 5);
00508 //      status5->Add(_st_Value5, 1, wxALL|wxALIGN_CENTER, 5);
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         // EED -> status9->Add(_st_Label9, 1, wxALL|wxALIGN_CENTER, 5);
00516         // EED -> status9->Add(_st_Value9, 1, wxALL|wxALIGN_CENTER, 5);
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 //      status->Add(status0             , 1, wxALL|wxEXPAND, 0);
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 //      status->Add(status4             , 1, wxALL|wxEXPAND, 0);
00533 //      status->Add(status5             , 1, wxALL|wxEXPAND, 0);
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         // EED -> status->Add(status9, 1, wxALL|wxEXPAND, 0);
00539         
00540         axe->Add(axe1, 2, wxALL|wxEXPAND, 0);
00541         axe->Add(axe2, 2, wxALL|wxEXPAND, 0);   //wxALIGN_CENTER_HORIZONTAL
00542         axe->Add(axe3, 2, wxALL|wxEXPAND, 0);
00543         axe->Add(axe4, 2, wxALL|wxEXPAND, 0);
00544 
00545 //      axe->Add(axe5, 2, wxALL|wxEXPAND, 0);
00546 //      axe->Add(axe6, 2, wxALL|wxEXPAND, 0);
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 //EEDxx 2.6 GROW
00556 //      medium_right_up->Add(_2DWorld                           , 1, wxALL|wxGROW, 5);
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         //medium_right->Add(_Chart                      , 1, wxALL|wxEXPAND     , 0);
00564         
00565 //      panel_left->SetAutoLayout(true);
00566 //      panel_left->SetSizer(medium_left);
00567 //      panel_left->Layout();
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 //EEDxx 2.6 GROW
00600 //      medium_right->Add(panel_splitter_right,1 ,wxGROW,0      );
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 //      panel_right->FitInside();
00606 
00607 
00608     panel_splitter->SplitVertically( panel_splitter_left , panel_right, (int)(ww*0.6) );
00609     panel_splitter->SetMinimumPaneSize( 50 );
00610 
00611 //EEDxx 2.6 GROW
00612 //      sizer_principal->Add( panel_splitter    , 1     , wxGROW                );
00613 //      sizer_principal->Add( status                    , 0     , wxGROW                );
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 //EEDxx2.4
00620 //      FitInside();
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 //EED   _real_first_point_quant = -1;
00634 //EED   _real_last_point_quant  = -1;
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         //_actual_total   = _mar->_experiment->GetAxisLength();
00650         //_st_Value1->SetLabel(_actual_total);
00651         //return( maracas_data::experiment->get_work_axis( )->get_total_length( ) );
00652 }
00653 
00654 
00655 /*EED
00656 //--------------------------------------------------------
00657 void wxQuantificationWidget::Positionate( )
00658 {
00659         _given_points = 0;
00660         _shown = true;
00661         _first_quant = 1;
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         // GUI
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 //      _pl_cntlHealthySick->Reset_sl_Slider(nos);
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 // PS ->        marContour * tutu=_mar->_experiment->getAxis()->getContour( event.GetPosition() );
00767 //      cnt = _mar->_experiment->generateContour(event.GetPosition(), -1, -1, NULL);
00768 // PS ->        tutu=_mar->_experiment->getAxis()->getContour( event.GetPosition() );
00769 //      _2DWorld->SetContour( cnt );
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 /* EED Borrame 
00804 // ----------------------------------------------------------------------------
00805 double wxQuantificationWidget::GetStenosisTEST1(marContour *marcontourH, marContour *marcontour){
00806         double healthy= marcontourH->getMinimumDiameter() * marcontourH->getMaximumDiameter();
00807         double sick= marcontour->getMinimumDiameter() * marcontour->getMaximumDiameter();
00808         return doubleStenosis( healthy , sick );
00809 }
00810 // ----------------------------------------------------------------------------
00811 double wxQuantificationWidget::GetStenosisTEST2(marContour *marcontourH, marContour *marcontour){
00812         double steA = GetStenosisArea(marcontourH,marcontour);
00813         double steB = GetStenosisDiameter(marcontourH,marcontour);
00814         return sqrt(steA + steB);
00815 }
00816 // ----------------------------------------------------------------------------
00817 double wxQuantificationWidget::GetStenosisTEST3(marContour *marcontourH, marContour *marcontour){
00818         return doubleStenosis( marcontourH->getAverageDiameter() , marcontour->getAverageDiameter() );
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 //                      healthySlice = _sl_Slice->GetValue();
00834 //                      _mar->_experiment->getAxis( )->setHealthySlice( healthySlice );
00835 //                      _3DWorld->Set3DHealthySliceActor( );
00836 //                      _3DWorld->Show3DHealthySliceActor( );   
00837         actualQuant = _mar->_experiment->getAxis()->getActualQuant( );
00838         marcontour=_mar->_experiment->getContour( actualQuant );
00839 
00840         wxString tmpString;
00841 //      tmpString.Printf( "%.2f mm" , marcontour->getPartialAxisLenght());              
00842 //      _st_Value0->SetLabel(tmpString);
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 //      tmpString.Printf( _T("%.2f mm")   , marcontour->getDiameterFromArea());                  _st_Value4->SetLabel(tmpString);
00849 //      tmpString.Printf( _T("%.2f mm")   , marcontour->getDiameterFromPerimeter());     _st_Value5->SetLabel(tmpString);
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 //EED borrame
00888 //              result = (fabs(healthy-sick)/healthy) * 100 ;   
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         // Axes ...
00919         marAxis *maraxis = _mar->_experiment->getAxis( );
00920         if (maraxis!=NULL) _3DWorld->SetAxis( maraxis->Draw( ) );
00921         // Other Actors..
00922         // ..
00923 }
00924 //----------------------------------------------------------------------------
00925 void wxQuantificationWidget::Clean3D( bool eraseAxe )
00926 {
00927         _first_quant = -1;
00928         _last_quant = -1;
00929 //EED   _real_first_point_quant = -1;
00930 //EED   _real_last_point_quant = -1;
00931         //this->controls(1);
00932         _quant_shown = false;
00933         
00934         _3DWorld->InitListContourActor( -1,_mar->_experiment->getNumberOfSlices() );
00935         if (eraseAxe==true) { _3DWorld->RemoveAxis(); }
00936 
00937 /* EED borrame
00938         _3DWorld->Hide3DSliceActor( );
00939         _3DWorld->Hide3DContourActor( );
00940         _3DWorld->Hide3DHealthySliceActor();
00941 */
00942 
00943         /*
00944         if (_pRenderer3D != 0) _pRenderer3D->RemoveActor(hs_actor);
00945         if (_hs_actor != 0)   hs_actor->delete();
00946         if (_hs_mapper != 0)  hs_mapper->delete();
00947         if (_hs_grid != 0)   hs_grid->delete();
00948         if (_hs_points != 0)   hs_points->delete();
00949         if (_hs_poly_line != 0)   hs_poly_line->delete();
00950         */
00951         
00952 /* EED
00953         int i = 1;
00954         int max = _rings_index->GetCount();
00955         while  (i <= max) {
00956         
00957         if (_pRenderer3D != 0)
00958     _pRenderer3D->RemoveActor(_cont3DActor(hs_actor[i]));
00959         if (_cont3DActor[i] != 0)
00960     _cont3DActor[i]->Delete();
00961         if (_cont3DMapper[i] != 0)
00962     _cont3DMapper[i]->Delete();
00963         if (_cont3DGrid[i] != 0)
00964     _cont3DGrid[i]->Delete();
00965         if (_cont3DPolyLine[i] != 0)
00966     _cont3DPolyLine[i]->Delete();
00967         if (_cont3DPoints[i] != 0)
00968     _cont3DPoints[i]->Delete();
00969                 
00970                 i++;
00971         }
00972         //_rings_index = _list;
00973 */
00974         
00975 
00976 }
00977 
00978 void wxQuantificationWidget::Reload_Axis(bool mask , bool step )
00979 {
00980 /*  if ( step  ) {
00981 this->redoAxisSpline();
00982 if ( pRenderer3D != 0 ) {
00983 _pRenderer3D->RemoveActor(GetSphereActorName(sphere_quant1));
00984 _pRenderer3D->RemoveActor(GetSphereActorName(sphere_quant2));
00985 }
00986 this->DeleteSphere(sphere_quant1);
00987 this->DeleteSphere(sphere_quant2);
00988 _given_points = 0;
00989 }
00990 else if ( mask  ) {
00991 this->recalculeAxisSignal()
00992 }
00993 
00994   if ( ( mask || step ) && _shown ) {
00995   tk_messageBox -icon info -message "$string_table::str_quant_will_be_erased" -type ok
00996   catch { renderer_$widgets(work3D) RemoveActor hs_actor_$widgets(work3D) }
00997   catch { hs_actor_$widgets(work3D) Delete }
00998   catch { hs_mapper_$widgets(work3D) Delete }
00999   catch { hs_grid_$widgets(work3D) Delete }
01000   catch { hs_points_$widgets(work3D) Delete }
01001   catch { hs_poly_line_$widgets(work3D) Delete }
01002   foreach i $rings_index {
01003   catch { renderer_$widgets(work3D) RemoveActor cont3DActor_{$widgets(work3D)}_{$i} }
01004   catch { cont3DActor_{$widgets(work3D)}_{$i}    Delete }
01005   catch { cont3DMapper_{$widgets(work3D)}_{$i}   Delete }
01006   catch { cont3DGrid_{$widgets(work3D)}_{$i}     Delete }
01007   catch { cont3DPolyLine_{$widgets(work3D)}_{$i} Delete }
01008   catch { cont3DPoints_{$widgets(work3D)}_{$i}   Delete }
01009   
01010    }
01011    rings_index = list;
01012    _area = 0.00;
01013    _peri = 0.00;
01014    _darea = 0.00;
01015    _dperi = 0.00;
01016    _dmax = 0.00;
01017    _dmin = 0.00;
01018    _davg = 0.00;
01019    _sten = 0.00;
01020    _quant_shown = false;
01021    this->clean_graph();  // old BLT
01022    
01023         _first_quant = 1;
01024         _range(getIntensityRange());
01025         _resample(getVTKSource());
01026         _bounds(resample(GetBounds());
01027         
01028          // Axis
01029          set points [ getAxis_dll ]
01030          set nP [ expr [ llength $points ] / 3 ]
01031          $widgets(sclSlice) configure \
01032          -from 0 \
01033          -to   [ expr [ getNumberOfAxisPoints_dll ] - 1 ] \
01034          -resolution 1
01035          
01036           // Poly-line actor construction...
01037           catch { renderer_$widgets(work3D) RemoveActor axisActor_$widgets(work3D) }
01038           catch { axisActor_$widgets(work3D)    Delete }
01039           catch { axisMapper_$widgets(work3D)   Delete }
01040           catch { axisGrid_$widgets(work3D)     Delete }
01041           catch { axisPolyLine_$widgets(work3D) Delete }
01042           catch { axisPoints_$widgets(work3D)   Delete }
01043           
01044            axisPoints = vtkPoints::New();
01045            axisPolyLine = vtkPolyLine::New();
01046            axisPolyLine->GetPointIds()->SetNumberOfIds( nP);
01047            vox_size = getActualVoxelSize();
01048            
01049                 for { set i 0 } { $i < $nP } { incr i } {
01050                 
01051                  [ axisPolyLine_$widgets(work3D) GetPointIds ] SetId $i $i
01052                  set p [ \
01053                  PointCoord \
01054                  [ lindex $points [ expr $i * 3 + 0 ] ] \
01055                  [ lindex $points [ expr $i * 3 + 1 ] ] \
01056                  [ lindex $points [ expr $i * 3 + 2 ] ] \
01057                  [ lindex $bounds 0 ] \
01058                  [ lindex $bounds 2 ] \
01059                  [ lindex $bounds 4 ] \
01060                  $vox_size $vox_size $vox_size \
01061                  ]
01062                  axisPoints->InsertNextPoint( lindex $p 0 ] [ lindex $p 1 ] [ lindex $p 2 ]
01063                  
01064                   }
01065                   
01066                    axisGrid = vtkUnstructuredGrid::New();
01067                    axisGrid->Allocate( 1, 1);
01068                    axisGrid->InsertNextCell(  [ axisPolyLine->GetCellType(),  ] \
01069                    [ axisPolyLine_$widgets(work3D) GetPointIds ]
01070                    axisGrid->SetPoints(axisPoints);
01071                    
01072                         axisMapper = vtkDataSetMapper::New();
01073                         axisMapper->SetInput(axisGrid);
01074                         axisMapper->ImmediateModeRenderingOn();
01075                         
01076                          axisActor = vtkActor::New();
01077                          axisActor->SetMapper(axisMapper);
01078                          axisActor->GetProperty()->BackfaceCullingOn();
01079                          axisActor->GetProperty()->SetDiffuseColor(1, 0, 0);
01080                          
01081                           _pRenderer3D->AddActor(axisActor);
01082                           
01083                            _pRenderWindow3D->Render();
01084                            _pRenderWindow2D->Render();
01085                            
01086                                 _pRenderer3D->AddActor(outlineActor));
01087                                 
01088                                  this->controls(0);
01089                                  
01090                                   }
01091                                   if ( _given_points == 1 )
01092                                   this->controls(1);
01093                                   
01094                                    if ( _quant_shown )
01095                                    this->update_blt_all_meassures();
01096 */
01097 }
01098 
01099 
01100 void wxQuantificationWidget::Show_Max_Min_Diameters()
01101 {
01102         
01103 /*
01104 slice = widgets(sclSlice);
01105 wxList *lmax = this->getMaximumLine();
01106 wxList *lmin = this->getMinimumLine();
01107 
01108  if ( _pRenderer2D != 0 )
01109         {
01110         _pRenderer2D->RemoveActor(dMin_actor);
01111         _pRenderer2D->RemoveActor(dMax_actor);
01112         }
01113         if ( dMax_actor != 0 )  dMax_actor->Delete();
01114     if ( dMax_mapper != 0 )  dMax_mapper->Delete();
01115     if ( dMax_line != 0 )  dMax_line->Delete();
01116     if ( dMin_actor != 0 )  dMin_actor->Delete();
01117     if ( dMin_mappe != 0 )  dMin_mappe->Delete();
01118     if ( dMax_actor != 0 )  dMax_actor->Delete();
01119     if ( dMin_line != 0 )  dMin_line->Delete();
01120         
01121          
01122           dMax_line = vtkLineSource::New();
01123           dMax_line->SetPoint1( lmax->Getfirst() , lmax->item(1), 0.0 );
01124           dMax_line->SetPoint2( lmax->Item(2), lmax->Item(3), 0.0 );
01125           
01126            dMax_mapper =  vtkPolyDataMapper::New();
01127            dMax_mapper->SetInput(dMax_line->GetOutput());
01128            dMax_mapper->ImmediateModeRenderingOn();
01129            
01130                 dMax_actor = vtkActor::New();
01131                 dMax_actor->SetMapper(dMax_mapper));
01132                 dMax_actor->GetProperty()->SetColor(1.00, 0.00, 0.00);
01133                 
01134                  dMin_line = vtkLineSource::New();
01135                  dMin_line->SetPoint1( lmin->GetFirst(), lmin->Item(1), 0.0);
01136                  dMin_line->SetPoint2( lmin->Item(2),    lmin->Item(3), 0.0);
01137                  
01138                   dMin_mapper = vtkPolyDataMapper::New();
01139                   dMin_mapper->SetInput(dMin_line->GetOutput());
01140                   dMin_mapper->ImmediateModeRenderingOn();
01141                   
01142                    dMin_actor = vtkActor::New();
01143                    dMin_actor->SetMapper(dMin_mapper);
01144                    dMin_actor->GetProperty()->SetColor(0.00, 0.00, 1.00);
01145                    
01146                         array set arr( params(), 0 )
01147                         if ( arr(e_debug_diameters) == 1 )
01148                         {
01149                         _prenderer2D->AddActor(dMax_actor);
01150                         _prenderer2D->AddActor(dMin_actor);
01151                         
01152                          }
01153                          
01154                           //GetRenderWindow Render
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 _pRenderer3D->IsInViewport(0, 0);
01174 
01175  busy hold
01176  Update();
01177  
01178   if ( _tmp_world_picker3D != 0)  tmp_world_picker3D->Delete();
01179   
01180    y =[ [ lindex [ $widgets(work3D) configure - height ] 4 ] - y - 1 ]
01181    
01182     _pickWPPos = Pick_point_local_actor $x $y _pRenderer3D _isoActor3D 0.001 ]
01183         
01184          _xc = _pickWPPos->item(1);
01185          _yc = _pickWPPos->item(2);
01186          _zc = _pickWPPos->item(3);
01187          #Chercher le point de l'axe le plus proche au point choisi sur la surface
01188          _indP = axisGrid3D->FindPoint(_xc, _yc, _zc);
01189          _coordsP = axisGrid3D->GetPoint(_indP);
01190          _xc =[lindex _coordsP 0]
01191          _yc =[lindex _coordsP 1]
01192          _zc =[lindex _coordsP 2]
01193          
01194           if ( _indP >= 0 )
01195           {
01196           $widgets(sclSlice) set $indP
01197           this->Set_Plane();
01198           }
01199           
01200            busy release .
01201            update
01202            
01203                 _pRenderWindow3D->Render();
01204         */
01205 }
01206 
01207 
01208 /* EED
01209 void wxQuantificationWidget::Refresh_Quant( )
01210 {
01211         if ( _real_first_point_quant != -1  &&  _real_last_point_quant  != -1  &&
01212                 _quant_sten->GetCount()  > 0) {
01213                 //_quant_sten = GetStenosisQuant();
01214                 //_sten  =  _quant_sten->Item(_widgets(sclSlice)->get() -
01215                 //                                       _real_first_point_quant  )
01216         }
01217         //this->update_blt_all_meassures();
01218 }
01219 */
01220 
01221 
01222 void  wxQuantificationWidget::Point_Intensity(double x, double y)
01223 {
01224         //y = [ lindex [ _pRenderWindow3D->Configure(height) ] ->Item(4) ] - y - 1;
01225         
01226         //if ( _tmp_picker != 0 )  _tmp_picker->Delete();
01227         //_tmp_picker = vtkWorldPointPicker::New();
01228         //_pickWP     = tmp_picker2D->Pick(x, y, 0) _pRenderer2D
01229         //_pickWPPos  = tmp_picker2D->GetPickPosition();
01230         
01231         //x = [ lindex [ split [ lindex $pickWPPos 0 ] . ] 0 ]
01232         //y = [ lindex [ split [ lindex $pickWPPos 1 ] . ] 0 ]
01233         //y = GetCutSize()  - y - 1;
01234         //_intensity = GetIntensityCut(x, y);
01235 }
01236 
01237 
01238 void wxQuantificationWidget::CleanContour()
01239 {
01240 /*  if ( _pRenderer2D != 0 ) {
01241 _pRenderer2D->RemoveActor(_debug2Actor3D);
01242 _pRenderer2D->RemoveActor(_debug1Actor3D);
01243 }
01244 if ( _debug2Actor3D != 0 )
01245 _debug2Actor3D->Delete();
01246 //if ( _connMapper3D != 0 )                     _connMapper3D->Delete();
01247 //if ( _isoStrips3D != 0 )                      _isoStrips3D->Delete();
01248 //if ( _cpd23D != 0 )                                   _cpd23D->Delete();
01249 //if ( _conn3D != 0 )                                   _conn3D->Delete();
01250 //if ( _cpd3D != 0 )                                    _cpd3D->Delete();
01251 if ( _debug1Actor3D != 0 )
01252 _debug1Actor3D->Delete();
01253 //if ( _cntVTKMapper3D != 0 )                   _cntVTKMapper3D->Delete();
01254 //if ( _cntVTK3D != 0 )                         _cntVTK3D->Delete();
01255 
01256   if ( _pRenderer2D != 0 ) {
01257   _pRenderer2D->RemoveActor(_aPolyLineActor2D);
01258   _pRenderer2D->RemoveActor(_aPolygonActor2D);
01259   }
01260   
01261         if ( _aPolyLineActor2D != 0 )
01262     _aPolyLineActor2D->Delete();
01263         //if ( _aPolyLineMapper2D != 0 )                _aPolyLineMapper2D->Delete();
01264         //if ( _aPolyLineGrid2D != 0 )          _aPolyLineGrid2D->Delete();
01265         //if ( _aPolyLine2D != 0 )                      _aPolyLine2D->Delete();
01266         //if ( _PointsContour2D != 0 )          _PointsContour2D->Delete();
01267         if ( _aPolygonActor2D != 0 )
01268     _aPolygonActor2D->Delete();
01269         //if ( _aPolygonMapper2D != 0 )         _aPolygonMapper2D->Delete();
01270         //if ( _aPolygonGrid2D != 0 )                   _aPolygonGrid2D->Delete();
01271         //if ( _aPolygon2D != 0 )                               _aPolygon2D->Delete();
01272         
01273           if ( _pRenderer2D != 0 ) {
01274           _pRenderer2D->RemoveActor(_dMaxActor2D);
01275           _pRenderer2D->RemoveActor(_dMinActor2D);
01276           }
01277           
01278                 if ( _dMaxActor2D != 0 )
01279                 _dMaxActor2D->Delete();
01280                 //if ( _dMaxMapper2D != 0 )                             _dMaxMapper2D->Delete();
01281                 //if ( _dMaxLine2D != 0 )                                       _dMaxLine2D->Delete();
01282                 if ( _dMinActor2D != 0 )
01283                 _dMinActor2D->Delete();
01284                 //if ( _dMinMapper2D != 0 )                             _dMinMapper2D->Delete();
01285                 //if ( _dMinLine2D != 0 )                                       _dMinLine2D->Delete();
01286                 
01287                   _pRenderWindow3D->Render();
01288         _pRenderWindow2D->Render();*/
01289 }
01290 
01291 
01292 //-----------------------------------------------------------------
01293 // Button
01294 void wxQuantificationWidget::Do_Quant()
01295 {
01296 /*
01297 if ( _quantifing == 0 )
01298 {
01299 this->Clean_Graph();
01300 this->Clean3D();
01301 
01302  _quantifing = 1;
01303  
01304   int f = ( _first_point_quant < _last_point_quant ) ? _first_point_quant : _last_point_quant;
01305   int l = ( _first_point_quant > _last_point_quant ) ? _first_point_quant : _last_point_quant;
01306   
01307    this->Controls(2);
01308    
01309         _quant_x     = _list;
01310         _quant_area  = _list;
01311         _quant_peri  = _list;
01312         _quant_darea = _list;
01313         _quant_dperi = _list;
01314         _quant_dmax  = _list;
01315         _quant_dmin  = _list;
01316         _quant_davg  = _list;
01317         
01318          for ( int i = f; i <= l; i++ )
01319          lappend _quant_x->Append(i);
01320          
01321           update_blt_all_meassures();
01322           
01323            startQuant(f);
01324            int  cont = f;
01325            changeSliceAxis(f);
01326            
01327         wxMessageDialog* Q_recalculate = new wxDialog(this,
01328                 _str_recalculate_contours,
01329                 "Question",
01330                 wxYES_NO|wxNO_DEFAULT|wxCENTRE,
01331                 wxPoint(100, 100));
01332                 
01333                  int recal = 0;
01334                  if (Q_recalculate->ShowModal() ==  wxID_OK)
01335                  recal = 1;
01336                  
01337                   delete Q_recalculate;
01338                   
01339                    this->Clean_Contour();
01340                    $widgets(sclSlice) set cont ;
01341                    planes_window::set_plane
01342                    _quant_shown = 1;
01343                    _params = GetContourParams();
01344                    this->Generate_IsoContour( (GetCutSize()  / 2) (GetCutSize() / 2)
01345                    (_params->Item(5) )
01346                                                                    (_params->Item(6) )
01347                                                                    while ( NextQuant(recal,IsoStrips3D) == 1 && cont <= l )
01348                                                                    {
01349                                                                    if ( _quantifing == 1 )
01350                                                                    {
01351                                                                    if ( _pRenderer2D != 0 )
01352                                                                    {
01353                                                                    _pRenderer2D->RemoveActor(_aPolygonActor2D);
01354                                                                    _pRenderer2D->RemoveActor(_aPolyLineActor2D);
01355                                                                    }
01356                                                                    if ( _aPolygonActor2D != 0 )   _aPolygonActor2D->Delete();
01357                                                                    if ( _aPolygonGrid2D != 0 )    _aPolygonGrid2D->Delete();
01358                                                                    if ( _aPolyLineActor2D != 0 )  _aPolyLineActor2D->Delete();
01359                                                                    if ( _aPolyLineMapper2D != 0 ) _aPolyLineMapper2D->Delete();
01360                                                                    if ( _aPolyLineGrid2D != 0 )   _aPolyLineGrid2D->Delete();
01361                                                                    if ( _aPolyLine2D != 0 )       _aPolyLine2D->Delete();
01362                                                                    if ( _PointsContour2D != 0 )   _PointsContour2D->Delete();
01363                                                                    if ( _aPolygon2D != 0 )        _aPolygon2D->Delete();
01364                                                                    
01365                                                                         _points = GetContourPoints();
01366                                                                         _taille = _points->GetLength() / 2;
01367                                                                         
01368                                                                          aPolygon2D = vtkPolygon::New();
01369                                                                          PointsContour2D = vtkPoints::New();
01370                                                                          
01371                                                                           aPolyLine2D = vtkPolyLine::New();
01372                                                                           _PointIds = aPolyLine2D->GetPointIds();
01373                                                                           _PointIds->SetNumberOfIds(_taille);
01374                                                                           _PointIdsPolygon = aPolygon2D->GetPointIds();
01375                                                                           _PointIdsPolygon->SetNumberOfIds( _taille);
01376                                                                           
01377                                                                            for ( int i =0; i < _taille ; i++ )
01378                                                                            {
01379                                                                            _PointIds->SetId(i, i);
01380                                                                            _PointIdsPolygon->SetId(i, i);
01381                                                                            PointsContour2D->InsertNextPoint( _points->Item( i * 2 ) + 0 ,
01382                                                                            _points->Item(i * 2) + 1, 0);
01383                                                                            }
01384                                                                            
01385                                                                                 aPolyLineGrid2D = vtkUnstructuredGrid::New();
01386                                                                                 aPolyLineGrid2D->Allocate(1, 1);
01387                                                                                 _param1 = aPolyLine2D->GetCellType();
01388                                                                                 _param2 = aPolyLine2D->GetPointIds();
01389                                                                                 aPolyLineGrid2D->InsertNextCell(_param1, _param2);
01390                                                                                 aPolyLineGrid2D->SetPoints(PointsContour2D)
01391                                                                                 
01392                                                                                  aPolyLineMapper2D = vtkDataSetMapper::New();
01393                                                                                  aPolyLineMapper2D->SetInput(aPolyLineGrid2D);
01394                                                                                  
01395                                                                                   aPolyLineActor2D = vtkActor::New();
01396                                                                                   aPolyLineActor2D->SetMapper(aPolyLineMapper2D);
01397                                                                                   _Property1 = aPolyLineActor2D->GetProperty();
01398                                                                                   _Property1->SetColor(0, 1, 0);
01399                                                                                   _Property1->SetLineWidth(2);
01400                                                                                   _Property1->SetPointSize(2);
01401                                                                                   _Property1->BackfaceCullingOff();
01402                                                                                   
01403                                                                                    _pRenderer2D->AddActor(aPolyLineActor2D);
01404                                                                                    
01405                                                                                         aPolygonGrid2D = vtkUnstructuredGrid::New();
01406                                                                                         aPolygonGri2D->Allocate(1, 1);
01407                                                                                         _param1 = aPolygon2D->GetCellType();
01408                                                                                         _param2 = aPolygon2D->GetPointIds();
01409                                                                                         aPolygonGrid2D->InsertNextCell(_param1, _param2);
01410                                                                                         aPolygonGrid2D->SetPoints(PointsContour2D);
01411                                                                                         
01412                                                                                          aPolygonMapper2D = vtkDataSetMapper::New();
01413                                                                                          aPolygonMapper2->SetInput(aPolygonGrid2D);
01414                                                                                          
01415                                                                                           aPolygonActor2D = vtkActor::New();
01416                                                                                           aPolygonActor2D->SetMapper(aPolygonMapper2D);
01417                                                                                           _Property1 = aPolygonActor2D->GetProperty();
01418                                                                                           _Property1->SetColor(0, 1, 0);
01419                                                                                           _Property1->SetLineWidth(2);
01420                                                                                           _Property1->SetPointSize(2);
01421                                                                                           _Property1->BackfaceCullingOff();
01422                                                                                           
01423                                                                                            int arr[] = Params(0);
01424                                                                                            if ( arr(e_debug_fill_area) == 1 )
01425                                                                                            _pRenderer2D->AddActor(aPolygonActor2D)
01426                                                                                            
01427                                                                                                 this->Show_Max_Min_Diameters();
01428                                                                                                 
01429                                                                                                  _pRenderWindow2D->Render();
01430                                                                                                  
01431                                                                                                   this->Draw3D_Contour(cont);
01432                                                                                                   
01433                                                                                                    _values = GetValues(cont);
01434                                                                                                    
01435                                                                                                         _quant_area->Append(_values->Item(1));
01436                                                                                                         _quant_peri->Append(_values->Item(2));
01437                                                                                                         _quant_darea->Append(_values->Item(3));
01438                                                                                                         _quant_dperi->Append(_values->Item(4));
01439                                                                                                         _quant_dmax->Append(_values->Item(5));
01440                                                                                                         _quant_dmin->Append(_values->Item(6));
01441                                                                                                         _quant_davg->Append(_values->Item(7));
01442                                                                                                         
01443                                                                                                          this->update_blt_all_meassures();
01444                                                                                                          
01445                                                                                                           _area  = _values->Item(1);
01446                                                                                                           _peri  = _values->Item(2);
01447                                                                                                           _darea = _values->Item(3);
01448                                                                                                           _dperi = _values->Item(4);
01449                                                                                                           _dmax  = _values->Item(5);
01450                                                                                                           _dmin  = _values->Item(6);
01451                                                                                                           _davg  = _values->Item(7);
01452                                                                                                           
01453                                                                                                            cont++;
01454                                                                                                            
01455                                                                                                                 this->Clean_contour();
01456                                                                                                                 
01457                                                                                                                  $widgets(sclSlice) set $cont;
01458                                                                                                                  this->Set_Plane;
01459                                                                                                                  _params = GetContourParams();
01460                                                                                                                  this->Generate_IsoContour [  [ GetCutSize() / 2 ]
01461                                                                                                                  [ GetCutSize() / 2 ]
01462                                                                                                                  [ _params->Item(5) ]
01463                                                                                                                  [ _params->Item(6) ];
01464                                                                                                                  update();
01465                                                                                                                  
01466                                                                                                                   }
01467                                                                                                                   else if ( _quantifing == 2 )
01468                                                                                                                   {
01469                                                                                                                   while ( _quantifing == 2 )
01470                                                                                                                   update();
01471                                                                                                                   }
01472                                                                                                                   else if ( _quantifing == 3 )
01473                                                                                                                   {
01474                                                                                                                   $widgets(btnPause) configure -text $string_table::str_pause
01475                                                                                                                   break;
01476                                                                                                                   }
01477                                                                                                                   
01478                                                                                                                    }
01479                                                                                                                    FinishQuant();
01480                                                                                                                    this->Clean_contour();
01481                                                                                                                    _quantifing = 0;
01482                                                                                                                    
01483                                                                                                                         }
01484                                                                                                                         else
01485                                                                                                                         {
01486                                                                                                                         _quantifing = 2;
01487                                                                                                                         wxMessageDialog* Q_stop = new wxDialog(this,
01488                                                                                                                         _str_stop_quantification,
01489                                                                                                                         "Question",
01490                                                                                                                         wxYES_NO|wxNO_DEFAULT|wxCENTRE,
01491                                                                                                                         wxPoint(100, 100));
01492                                                                                                                         
01493                                                                                                                          _quantifing = 1;
01494                                                                                                                          if (Q_stop->ShowModal() ==  wxID_OK)
01495                                                                                                                          _quantifing = 3;
01496                                                                                                                          delete Q_stop;
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);//"This option erase all 3D contours.\n Do you want to continue?","Alert"
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 //              std::string directory(  (const char *)(dialog.GetDirectory().mb_str()) );
01536 //              std::string filename(  (const char *)(dialog.GetFilename().mb_str())  );
01537 //              std::string pathfilename        = directory + "/" + filename;
01538 //              printf("EED> wxQuantificationWidget::OnSaveContours3D_BT  > %s\n",pathfilename.c_str());
01539                 FILE *ff;
01540                 ff=fopen(pathfilename.c_str(), "w+");
01541                   _mar->_experiment->getAxis()->SaveExisting3DContours(ff);
01542                 fclose(ff);
01543         }
01544         
01545 }
01546 
01547 // PS -> void wxQuantificationWidget::OnContour_BT(wxCommandEvent& event)
01548 // PS -> {
01549 // PS -> 
01550 // PS -> 
01551 // PS ->   int index;
01552 // PS -> 
01553 // PS ->   vtkPolyData* cnt;
01554 // PS ->   //marContour* cnt;
01555 // PS -> //  vtkUnstructuredGrid* allData;
01556 // PS -> 
01557 // PS ->   index = _sl_Slice->GetValue( );
01558 // PS -> //  this->CleanContour( );
01559 // PS ->   cnt = _mar->_experiment->generateContour(index, -1, -1, NULL);
01560 // PS -> //     allData = cnt->Draw( );
01561 // PS -> //  _2DWorld->SetContour( allData );
01562 // PS ->   _2DWorld->SetContour( cnt );
01563 // PS -> 
01564 // PS ->   _first_quant = 0;
01565 // PS -> 
01566 // PS ->   /*planes_window::show_max_min_diameters
01567 // PS -> 
01568 // PS ->        [ $widgets(image2D) GetRenderWindow ] Render
01569 // PS -> 
01570 // PS ->        planes_window::draw3D_contour $index
01571 // PS -> 
01572 // PS ->        set quant_data [ getValues_dll $index ]
01573 // PS ->        set actual_area  [ change_float_precision [ lindex $quant_data 0 ] 2 ]
01574 // PS ->        set actual_peri  [ change_float_precision [ lindex $quant_data 1 ] 2 ]
01575 // PS ->        set actual_darea [ change_float_precision [ lindex $quant_data 2 ] 2 ]
01576 // PS ->        set actual_dperi [ change_float_precision [ lindex $quant_data 3 ] 2 ]
01577 // PS ->        set actual_dmax  [ change_float_precision [ lindex $quant_data 4 ] 2 ]
01578 // PS ->        set actual_dmin  [ change_float_precision [ lindex $quant_data 5 ] 2 ]
01579 // PS ->        set actual_davg  [ change_float_precision [ lindex $quant_data 6 ] 2 ]
01580 // PS ->        set i [ lsearch -exact $actual_quant_x $index ]
01581 // PS ->        if { $i != -1 } {
01582 // PS -> 
01583 // PS ->                set actual_quant_area  [ lreplace $actual_quant_area  $i $i $actual_area ]
01584 // PS ->                set actual_quant_peri  [ lreplace $actual_quant_peri  $i $i $actual_peri ]
01585 // PS ->                set actual_quant_darea [ lreplace $actual_quant_darea $i $i $actual_darea ]
01586 // PS ->                set actual_quant_dperi [ lreplace $actual_quant_dperi $i $i $actual_dperi ]
01587 // PS ->                set actual_quant_dmax  [ lreplace $actual_quant_dmax  $i $i $actual_dmax ]
01588 // PS ->                set actual_quant_dmin  [ lreplace $actual_quant_dmin  $i $i $actual_dmin ]
01589 // PS ->                set actual_quant_davg  [ lreplace $actual_quant_davg  $i $i $actual_davg ]
01590 // PS ->                if { [ llength $actual_quant_sten ] > 0 } {
01591 // PS -> 
01592 // PS ->                        set actual_quant_sten [ getStenosisQuant_dll ]
01593 // PS ->                        set actual_sten [ change_float_precision [ lindex $actual_quant_sten [ expr $index - $real_first_point_quant ] ] 2 ]
01594 // PS -> 
01595 // PS ->                }
01596 // PS -> 
01597 // PS ->        }
01598 // PS ->        planes_window::update_blt_all_meassures*/
01599 // PS -> }
01600 
01601 
01602 // PS -> void wxQuantificationWidget::OnClean_BT(wxCommandEvent& event)
01603 // PS -> {
01604 // PS -> /*  this->CleanContour();*/
01605 // PS -> }
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 //FILE *ff;
01626 //ff = fopen("c:/temp/MaracasStadistics.txt","a+");
01627 //long int endtime = clock();
01628 //double sg = (double)(endtime-startTimeRI) / (double)CLK_TCK;
01629 //fprintf(ff,"EED %p wxQuantificationWidget::DetectHealthySickSlice > RI_t = %f \n",this,sg);
01630 //fclose(ff);
01631 
01632 
01633 //startTimeCalcule = clock();
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                         // this is equal to the minimum surface/diameter
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 //ff = fopen("c:/temp/MaracasStadistics.txt","a+");
01671 //endtime = clock();
01672 //sg = (double)(endtime-startTimeCalcule) / (double)CLK_TCK;
01673 //fprintf(ff,"EED %p wxQuantificationWidget::DetectHealthySickSlice > t = %f   ( %d , %d , %d )\n",this,sg,startslice,endslice, endslice-startslice);
01674 //fclose(ff);
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 /*EED Borrame 
01690 //------------------------------------------------------------------------
01691 void wxQuantificationWidget::AutoQuantification(){      
01692         int             analysisTypeStenosis    =       GetAnalysisTypeStenosis();
01693         int             slice                                   =       _sl_Slice->GetValue();
01694         int             healthySlice                    =       _mar->_experiment->getAxis()->getHealthySlice( );
01695         int             healthySliceStart               =       _mar->_experiment->getAxis()->getHealthySliceStart( );
01696         int             healthySliceEnd                 =       _mar->_experiment->getAxis()->getHealthySliceEnd( );
01697         double  maxStenosis                             =       -9999999;
01698         double  ste                                             =       0;
01699 
01700         if (healthySlice !=-1 ) {
01701                 int iSickSlice,startslice,endslice;
01702                 GetSliceLimites(0,startslice,endslice);
01703             if (startslice>endslice){
01704                         int temp=endslice;
01705                         endslice=startslice;
01706                         startslice=temp;
01707                 }
01708                 for (iSickSlice=startslice; iSickSlice<=endslice;iSickSlice++){
01709                         if (analysisTypeStenosis==1 ){ ste = GetStenosisDiameter(iSickSlice);   }
01710                         if (analysisTypeStenosis==2 ){ ste = GetStenosisArea(iSickSlice);               }
01711                         if (ste>maxStenosis){
01712                                 maxStenosis=ste;
01713                                 slice=iSickSlice;
01714                         }
01715                         MoveSlider( iSickSlice );
01716                         _sl_Slice->SetValue( iSickSlice );
01717                 }
01718                 MoveSlider( slice );
01719                 _sl_Slice->SetValue( slice );
01720         } else {
01721                 wxMessageBox( "Set an healthy slice.\n \n ","DxMM : MARACAS", wxOK | wxCENTRE | wxICON_INFORMATION, this);
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 /* EED borrame
01757 //------------------------------------------------------------------------
01758 void wxQuantificationWidget::OnHealthySlice_BT(wxCommandEvent& event){  
01759         SetHealthySlice( _sl_Slice->GetValue() );
01760 }
01761 */
01762 
01763 // PS -> void wxQuantificationWidget::OnCalculated_BT(wxCommandEvent& event)
01764 // PS -> {
01765 // PS ->     /*
01766 // PS ->     _index = ( $widgets(sclSlice) get )
01767 // PS -> 
01768 // PS ->     this->Clean_Contour();
01769 // PS ->        _points = GetContourPoints();
01770 // PS ->        _taille = _points->Item(2) / 2;
01771 // PS -> 
01772 // PS ->     if ( _taille > 0 )
01773 // PS ->        {
01774 // PS ->         aPolygon2D = vtkPolygon::New();
01775 // PS ->         PointsContour2D = vtkPoints::New();
01776 // PS ->                aPolyLine2D = vtkPolyLine::New();
01777 // PS -> 
01778 // PS ->                _PointIds = aPolyLine2D->GetPointIds();
01779 // PS ->                _PointIds->SetNumberOfIds(_taille);
01780 // PS ->         _PointIdsPolygon = aPolygon2D->GetPointIds();
01781 // PS ->                _PointIdsPolygon->SetNumberOfIds(_taille);
01782 // PS -> 
01783 // PS ->         for (int i=0; i< _taille ; i++ )
01784 // PS ->                {
01785 // PS ->             _PointIds->SetId(i, i);
01786 // PS ->             _PointIdsPolygon->SetId(i, i);
01787 // PS ->             PointsContour2D->InsertNextPoint( _points->Item(i * 2  + 0),
01788 // PS ->                                   _points->Item(i * 2  + 1),  0 );
01789 // PS -> 
01790 // PS ->         }
01791 // PS -> 
01792 // PS ->         aPolyLineGrid2D = vtkUnstructuredGrid::New();
01793 // PS ->                aPolyLineGrid2D->Allocate(1, 1);
01794 // PS ->         _param1 = aPolyLine2D->GetCellType();
01795 // PS ->         _param2 = aPolyLine2D->GetPointIds();
01796 // PS ->         aPolyLineGrid2D->InsertNextCell(_param1, _param2);
01797 // PS ->         aPolyLineGrid2D->SetPoints(PointsContour2D);
01798 // PS -> 
01799 // PS ->                aPolyLineMapper2D = vtkDataSetMapper::New();
01800 // PS ->                aPolyLineMapper2D->SetInput(aPolyLineGrid2D);
01801 // PS -> 
01802 // PS ->                aPolyLineActor2D = vtkActor::New();
01803 // PS ->                aPolyLineActor2D->SetMapper(aPolyLineMapper2D);
01804 // PS ->         _Property1 = aPolyLineActor2D->GetProperty();
01805 // PS ->                _Property1->SetColor(0, 1, 0);
01806 // PS ->         _Property1->SetLineWidth(2);
01807 // PS ->         _Property1->SetPointSize(2);
01808 // PS ->         _Property1->BackfaceCullingOff();
01809 // PS -> 
01810 // PS ->         _pRenderer2D->AddActor(aPolyLineActor2D);
01811 // PS -> 
01812 // PS ->                aPolygonGrid2D = vtkUnstructuredGrid::New();
01813 // PS ->                aPolygonGrid2D->Allocate(1, 1);
01814 // PS ->         _param1 = aPolygon2D->GetCellType();
01815 // PS ->         _param2 = aPolygon2D->GetPointIds();
01816 // PS ->         aPolygonGrid2D->InsertNextCell(_param1, _param2);
01817 // PS ->         aPolygonGrid2D->SetPoints(PointsContour2D);
01818 // PS -> 
01819 // PS ->                aPolygonMapper2D = vtkDataSetMapper::New();
01820 // PS ->                aPolygonMapper2D->SetInput(aPolygonGrid2D);
01821 // PS -> 
01822 // PS ->                aPolygonActor2D = vtkActor::New();
01823 // PS ->            aPolygonActor2D->SetMapper(aPolygonMapper2D);
01824 // PS ->                _Property1 = aPolygonActor2D->GetProperty();
01825 // PS ->                _Property1->SetColor(0, 1, 0);
01826 // PS ->         _Property1->SetLineWidth(2);
01827 // PS ->         _Property1->SetPointSize(2);
01828 // PS ->         _Property1->BackfaceCullingOff();
01829 // PS -> 
01830 // PS ->         int arr[] = this->Params(0);
01831 // PS ->                if ( arr(_e_debug_fill_area) == 1 )
01832 // PS ->                        _pRenderer2D->AddActor(aPolygonActor2D);
01833 // PS -> 
01834 // PS ->         _pRenderWindow3D->Render();
01835 // PS ->         _pRenderWindow2D->Render();
01836 // PS -> 
01837 // PS ->     }
01838 // PS ->  */
01839 // PS -> }
01840 
01841 
01842 
01843 // PS -> void wxQuantificationWidget::OnPause_BT(wxCommandEvent& event)
01844 // PS -> {
01845 // PS ->   if ( _quantifing == 1 ) {
01846 // PS ->     _quantifing = 2;
01847 // PS ->     _bt_Pause->SetLabel("Play");
01848 // PS ->     _mar->_experiment->backQuant();
01849 // PS ->   }
01850 // PS ->   else if ( _quantifing == 2 )
01851 // PS ->   {
01852 // PS ->     _quantifing = 1;
01853 // PS ->     _bt_Pause->SetLabel("Pause");
01854 // PS ->   }
01855 // PS -> }
01856 
01857 
01858 // PS -> void wxQuantificationWidget::OnDelete_BT(wxCommandEvent& event)
01859 // PS -> {
01860 // PS ->        /*
01861 // PS ->        wxMessageDialog* Q_erase = new wxDialog(this,
01862 // PS ->           _str_erase_quant_q,
01863 // PS ->           "Question",
01864 // PS ->           wxYES_NO|wxNO_DEFAULT|wxCENTRE,
01865 // PS ->           wxPoint(100, 100));
01866 // PS -> 
01867 // PS ->    if (Q_erase->ShowModal() ==  wxID_OK)
01868 // PS ->    {
01869 // PS ->       _first_quant = 1;
01870 // PS ->       _real_first_point_quant = -1;
01871 // PS ->       _real_last_point_quant = -1;
01872 // PS ->       this->controls(1);
01873 // PS ->       _quant_shown = false;
01874 // PS -> 
01875 // PS ->          this->clean_graph();
01876 // PS -> 
01877 // PS ->          if (_pRenderer3D != 0) _pRenderer3D->RemoveActor(hs_actor);
01878 // PS ->          if (_hs_actor != 0)   hs_actor->delete();
01879 // PS ->          if (_hs_mapper != 0)  hs_mapper->delete();
01880 // PS ->       if (_hs_grid != 0)   hs_grid->delete();
01881 // PS ->       if (_hs_points != 0)   hs_points->delete();
01882 // PS ->       if (_hs_poly_line != 0)   hs_poly_line->delete();
01883 // PS -> 
01884 // PS ->      foreach i $rings_index
01885 // PS ->                {
01886 // PS -> 
01887 // PS ->             catch { renderer_$widgets(work3D) RemoveActor cont3DActor_{$widgets(work3D)}_{$i} }
01888 // PS ->             catch { cont3DActor_{$widgets(work3D)}_{$i}    Delete }
01889 // PS ->             catch { cont3DMapper_{$widgets(work3D)}_{$i}   Delete }
01890 // PS ->             catch { cont3DGrid_{$widgets(work3D)}_{$i}     Delete }
01891 // PS ->             catch { cont3DPolyLine_{$widgets(work3D)}_{$i} Delete }
01892 // PS ->             catch { cont3DPoints_{$widgets(work3D)}_{$i}   Delete }
01893 // PS -> 
01894 // PS ->         }
01895 // PS ->       _rings_index = _list;
01896 // PS ->          _quant_x     = _list;
01897 // PS ->       _quant_area  = _list;
01898 // PS ->       _quant_peri  = _list;
01899 // PS ->       _quant_darea = _list;
01900 // PS ->       _quant_dperi = _list;
01901 // PS ->       _quant_dmax  = _list;
01902 // PS ->       _quant_dmin  = _list;
01903 // PS ->       _quant_davg  = _list;
01904 // PS ->       _quant_sten  = _list;
01905 // PS -> 
01906 // PS ->       _area = 0.00;
01907 // PS ->       _peri = 0.00;
01908 // PS ->       _darea = 0.00;
01909 // PS ->       _dperi = 0.00;
01910 // PS ->       _dmax  = 0.00;
01911 // PS ->       _dmin  = 0.00;
01912 // PS ->       _davg  = 0.00;
01913 // PS ->       _sten  = 0.00;
01914 // PS ->       _shown = false;
01915 // PS -> 
01916 // PS ->       _pRenderWindow3D->Render();
01917 // PS ->          this->clean_contour();
01918 // PS -> 
01919 // PS ->       wxMessageDialog* Q_extract = new wxDialog(this,
01920 // PS ->                        _str_erase_extracted_contours,
01921 // PS ->                        "Question",
01922 // PS ->                        wxYES_NO|wxNO_DEFAULT|wxCENTRE,
01923 // PS ->                        wxPoint(100, 100));
01924 // PS -> 
01925 // PS ->       if (Q_extract->ShowModal() ==  wxID_OK)
01926 // PS ->                 this->cleanData();
01927 // PS -> 
01928 // PS ->          delete Q_extract;
01929 // PS -> 
01930 // PS ->    }
01931 // PS ->    delete Q_erase;
01932 // PS ->    */
01933 // PS -> }
01934 
01935 
01936 
01937 
01938 // PS -> void wxQuantificationWidget::OnSetPoint_BT(wxCommandEvent& event)
01939 // PS -> {
01940 // PS ->     //set slice = [ $widgets(sclSlice) get ]
01941 // PS ->     //this->select_axis_point( 0, 0, $slice
01942 // PS -> }
01943 
01944 
01945 
01946 //--------------------------------------------------------------------
01947 // CheckBox
01948 void wxQuantificationWidget::OnHealthySlice_CB(wxCommandEvent& event)
01949 {
01950         // Visible
01951         /*  if ( _show_hs == 1 ) {
01952     if ( _pRenderer3D != 0 )
01953         _pRenderer3D->AddActor(_hsActor3D);
01954         }
01955         // Hide
01956         else {
01957     if ( _pRenderer3D != 0 )
01958         _pRenderer3D->RemoveActor(_hsActor3D);
01959         }
01960         
01961         _pRenderWindow3D->Render();  // Maj*/
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         // GetNumberOfAxisPoints()
01986         /*  int noap = _mar->_experiment->getNumberOfAxes();
01987         for (int i= 0; i < noap;  i++ ) {
01988     if ( _show_rings == 0 ) {
01989         if ( _pRenderer3D != 0 )
01990         _pRenderer3D->RemoveActor(_contActor3D[i]);
01991     }
01992     else  {
01993         if ( _pRenderer3D != 0 )
01994         _pRenderer3D->AddActor(_contActor3D[i]);
01995     }
01996         }
01997         _pRenderWindow3D->Render(); // Maj*/
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 // RadioButton
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         // Create Volume
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         // Fill Volume
02192         int i;
02193         for (i=wz1;i<=wz2;i++)
02194         {
02195                 // GetImage
02196                 imagedata=_mar->_experiment->getSliceImage(i);
02197 
02198                 // InsertImage
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 // EOF - wxQuantificationWidget.cxx
02296 
02297 
02298 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1