wxQuantificationWidgetCT.cxx

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

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1