wxPanelCuttingImageData Class Reference

#include <wxPanelCuttingImageData.h>

Collaboration diagram for wxPanelCuttingImageData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxPanelCuttingImageData (wxWindow *parent)
 ~wxPanelCuttingImageData ()
void OnTransform (wxScrollEvent &event)
void OnOpacityFig (wxScrollEvent &event)
void OnTypeFig (wxCommandEvent &event)
void OnExtract (wxCommandEvent &event)
void SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata)
void SetVtkClipping3DDataViewer (vtkClipping3DDataViewer *vtkclipping3Ddataviewer)
void SetWxVtk3DBaseView (wxVtk3DBaseView *wxvtk3Dbaseview)
void SetParamsOfTransformation ()
void Configure ()
void Refresh ()
void RefreshView ()
void RemoveActors ()

Private Member Functions

void CreateModel ()
void CreateInterface ()
void Create3DViewObjects ()
void RefreshOpacity ()
wxWindow * CreatePlotHistogrammeInterface ()
void InitHistogramme ()

Private Attributes

wxSlider * _opacityFig
wxSlider * _scaleX
wxSlider * _scaleY
wxSlider * _scaleZ
wxSlider * _rotationX
wxSlider * _rotationY
wxSlider * _rotationZ
wxRadioButton * _volIntern
wxRadioButton * _volExtern
wxCheckBox * _histogrammeAccumulated
wxSlider * _isoValue
wxSlider * _valueBeforeIsoValue
wxSlider * _valueAfterIsoValue
wxChoice * _typeFig
wxStaticText * _infoToVo
wxStaticText * _infoSuVo
wxStaticText * _infoSuVoA
wxStaticText * _infoPixLe
wxStaticText * _infoPixHi
figureCuttingCylinderModel_modelCylinder
figureCuttingCubeModel_modelCube
figureCuttingSphereModel_modelSphere
figureCuttingModel_actualCuttingModel
vtkCubeSource * _vtkcube
vtkSphereSource * _vtksphere
vtkCylinderSource * _vtkcylinder
vtkPolyDataMapper * _cubeMapper
vtkPolyDataMapper * _sphereMapper
vtkPolyDataMapper * _cylinderMapper
vtkActor * _cubeActor
vtkActor * _sphereActor
vtkActor * _cylinderActor
vtkActor * _actualActor
vtkMPRBaseData_vtkmprbasedata
wxVtk3DBaseView_wxvtk3Dbaseview
vtkImageData * _imageData
vtkClipping3DDataViewer_vtkclipping3Ddataviewer
vtkImageData * _histogrammeVector
vtkXYPlotActor * _xyplot
wxVtkBaseView_wxvtkbaseView
vtkRenderer * _renplotter

Detailed Description

Definition at line 20 of file wxPanelCuttingImageData.h.


Constructor & Destructor Documentation

wxPanelCuttingImageData::wxPanelCuttingImageData ( wxWindow *  parent  ) 

Definition at line 12 of file wxPanelCuttingImageData.cxx.

References _histogrammeVector, _imageData, _wxvtk3Dbaseview, _wxvtkbaseView, Create3DViewObjects(), CreateInterface(), and CreateModel().

00013 : wxPanel( parent, -1)
00014 {
00015         _imageData=NULL;
00016         _histogrammeVector=NULL;
00017         _wxvtk3Dbaseview=NULL;
00018         _wxvtkbaseView=NULL;
00019         CreateInterface();
00020         CreateModel();
00021         Create3DViewObjects();
00022 }

Here is the call graph for this function:

wxPanelCuttingImageData::~wxPanelCuttingImageData (  ) 

Definition at line 25 of file wxPanelCuttingImageData.cxx.

References _cubeActor, _cubeMapper, _cylinderActor, _cylinderMapper, _histogrammeVector, _modelCube, _modelCylinder, _modelSphere, _renplotter, _sphereActor, _sphereMapper, _vtkcube, _vtkcylinder, _vtksphere, _wxvtkbaseView, and _xyplot.

00026 {
00027 
00028 
00029         delete _modelCube;      
00030         delete _modelSphere;    
00031         delete _modelCylinder;  
00032         _vtkcube                -> Delete();    
00033         _vtksphere              -> Delete();    
00034         _vtkcylinder    -> Delete();    
00035         _cubeMapper             -> Delete();    
00036         _sphereMapper   -> Delete();    
00037         _cylinderMapper -> Delete();    
00038         _cubeActor              -> Delete();    
00039         _sphereActor    -> Delete();    
00040         _cylinderActor  -> Delete();    
00041 //      _xyplot->RemoveAllInputs();     
00042         _xyplot                 -> Delete();    
00043         _histogrammeVector->Delete();   
00044         _renplotter->Delete();
00045         
00046         if(_wxvtkbaseView!=NULL){
00047                 delete _wxvtkbaseView;
00048         }
00049         //delete _vtkclipping3Ddataviewer;
00050         
00051 
00052         //fclose(file);
00053 
00054 }


Member Function Documentation

void wxPanelCuttingImageData::Configure (  ) 
void wxPanelCuttingImageData::Create3DViewObjects (  )  [private]

Definition at line 77 of file wxPanelCuttingImageData.cxx.

References _cubeActor, _cubeMapper, _cylinderActor, _cylinderMapper, _modelCube, _modelCylinder, _modelSphere, _sphereActor, _sphereMapper, _vtkcube, _vtkcylinder, _vtksphere, and figureCuttingModel::GetVtkTransform().

Referenced by wxPanelCuttingImageData().

00078 {
00079         // Sphere
00080         _vtksphere              = vtkSphereSource::New();
00081         _vtksphere->SetThetaResolution (20);
00082         _vtksphere->SetPhiResolution (20);
00083         _sphereMapper   = vtkPolyDataMapper::New();
00084         _sphereMapper->SetInput( _vtksphere->GetOutput() );
00085         _sphereActor    = vtkActor::New();
00086         _sphereActor->SetMapper(_sphereMapper);
00087         _sphereActor->SetOrigin(0, 0, 0);
00088         _sphereActor->SetPosition(0, 0, 0);
00089         _sphereActor->GetProperty()->SetColor(1, 0, 0);
00090         _sphereActor->SetUserTransform( _modelSphere->GetVtkTransform() );      
00091 
00092         // cube
00093         _vtkcube                = vtkCubeSource::New();
00094         _vtkcube->SetXLength (1);
00095         _vtkcube->SetYLength (1);
00096         _vtkcube->SetZLength (1);
00097         _cubeMapper             = vtkPolyDataMapper::New();
00098         _cubeMapper->SetInput( _vtkcube->GetOutput() );
00099         _cubeActor              = vtkActor::New();
00100         _cubeActor->SetMapper(_cubeMapper);
00101         _cubeActor->SetOrigin(0, 0, 0);
00102         _cubeActor->SetPosition(0, 0, 0);
00103         _cubeActor->GetProperty()->SetColor(1, 0, 0);
00104         _cubeActor->SetUserTransform( _modelCube->GetVtkTransform() );          
00105 
00106         // cylinder
00107         _vtkcylinder    = vtkCylinderSource::New();
00108         _vtkcylinder->SetResolution(20);
00109         _cylinderMapper = vtkPolyDataMapper::New();
00110         _cylinderMapper->SetInput( _vtkcylinder->GetOutput() );
00111         _cylinderActor  = vtkActor::New();
00112         _cylinderActor->SetMapper(_cylinderMapper);
00113         _cylinderActor->SetOrigin(0, 0, 0);
00114         _cylinderActor->SetPosition(0, 0, 0);
00115         _cylinderActor->GetProperty()->SetColor(1, 0, 0);
00116         _cylinderActor->SetUserTransform( _modelCylinder->GetVtkTransform() );          
00117 
00118 
00119 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::CreateInterface (  )  [private]

Definition at line 205 of file wxPanelCuttingImageData.cxx.

References _histogrammeAccumulated, _infoPixHi, _infoPixLe, _infoSuVo, _infoSuVoA, _infoToVo, _isoValue, _opacityFig, _rotationX, _rotationY, _rotationZ, _scaleX, _scaleY, _scaleZ, _typeFig, _valueAfterIsoValue, _valueBeforeIsoValue, _volExtern, _volIntern, CreatePlotHistogrammeInterface(), OnExtract(), OnOpacityFig(), OnTransform(), and OnTypeFig().

Referenced by wxPanelCuttingImageData().

00206 {
00207         SetSize(300,500);
00208         wxBoxSizer      *topsizer               = new wxBoxSizer(wxVERTICAL);   // Principal sizer
00209 
00210         wxBoxSizer              *sizerH0        = new wxBoxSizer(wxHORIZONTAL   );  // type of segmentation figure
00211         wxBoxSizer          *sizerH2    = new wxBoxSizer(wxHORIZONTAL   );      // scale
00212         wxBoxSizer              *sizerH3        = new wxBoxSizer(wxHORIZONTAL   );      // rotation
00213         wxBoxSizer              *sizerH4        = new wxBoxSizer(wxHORIZONTAL   );  // intern extern
00214         wxBoxSizer              *sizerH5        = new wxBoxSizer(wxHORIZONTAL   );  // Isovalue
00215         wxBoxSizer              *sizerH6        = new wxBoxSizer(wxHORIZONTAL   );  // Buttons
00216         wxFlexGridSizer *sizerH7        = new wxFlexGridSizer(2                 );  // Volumic information 
00217 
00218         
00219         _typeFig        = new wxChoice(this,-1);
00220         _opacityFig     = new wxSlider(this,-1,100,0,100, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00221 
00222         _scaleX         = new wxSlider(this,-1,6,0,500  , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00223         _scaleY         = new wxSlider(this,-1,20,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00224         _scaleZ         = new wxSlider(this,-1,7,0,500  , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00225 
00226         _rotationX      = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00227         _rotationY      = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00228         _rotationZ      = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00229 
00230         _volIntern              = new wxRadioButton(this,-1, _T("Volume intern " ));
00231         _volExtern              = new wxRadioButton(this,-1, _T("Volume extern " ));
00232 
00233         _histogrammeAccumulated = new wxCheckBox(this,-1,_T("Histogramme accumulated"));
00234 
00235         _isoValue                               = new wxSlider(this,-1, 200, 0,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00236         _valueBeforeIsoValue    = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00237         _valueAfterIsoValue             = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
00238 
00239         wxButton *btnExtract    = new wxButton(this, -1,_T("Extract"));
00240 
00241         _infoToVo       = new wxStaticText(this,-1,_T("########################"));
00242         _infoSuVoA      = new wxStaticText(this,-1,_T("############"));
00243         _infoSuVo       = new wxStaticText(this,-1,_T("############"));
00244         _infoPixLe      = new wxStaticText(this,-1,_T("############"));
00245         _infoPixHi      = new wxStaticText(this,-1,_T("############"));
00246 
00247 
00248         
00249 
00250         _typeFig->Append(_T("Cylindre"));
00251         _typeFig->Append(_T("Cube"));
00252         _typeFig->Append(_T("Sphere"));
00253         _typeFig->SetSelection(0);
00254         _volIntern->SetValue(true);
00255 
00256         Connect(_typeFig->GetId()                               , wxEVT_COMMAND_CHOICE_SELECTED         , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTypeFig ); 
00257 
00258         Connect(_opacityFig->GetId()                    , wxEVT_COMMAND_SLIDER_UPDATED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnOpacityFig ); 
00259         Connect(_rotationX->GetId()                             , wxEVT_COMMAND_SLIDER_UPDATED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform ); 
00260         Connect(_rotationY->GetId()                             , wxEVT_COMMAND_SLIDER_UPDATED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform ); 
00261         Connect(_rotationZ->GetId()                             , wxEVT_COMMAND_SLIDER_UPDATED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform ); 
00262         Connect(_scaleX->GetId()                                , wxEVT_COMMAND_SLIDER_UPDATED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform ); 
00263         Connect(_scaleY->GetId()                                , wxEVT_COMMAND_SLIDER_UPDATED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform ); 
00264         Connect(_scaleZ->GetId()                                , wxEVT_COMMAND_SLIDER_UPDATED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform ); 
00265         Connect(btnExtract->GetId()                             , wxEVT_COMMAND_BUTTON_CLICKED          , (wxObjectEventFunction) &wxPanelCuttingImageData::OnExtract   ); 
00266          
00267 
00268 //      wxStaticText *text=new wxStaticText(this,-1, " ");
00269 
00270         sizerH0 -> Add( new wxStaticText(this,-1, _T("Fig. Type:   "),wxDefaultPosition, wxSize(50,20)) ,1,wxALL  ,0);
00271         sizerH0 -> Add( _typeFig                ,1,wxALL  ,0);
00272         sizerH0 -> Add( _opacityFig             ,1,wxALL|wxEXPAND  ,0);
00273 
00274         sizerH2 -> Add( new wxStaticText(this,-1,_T("Scale :   "))              ,1,wxALL  ,0);
00275         sizerH2 -> Add( _scaleX         ,1,wxALL | wxEXPAND ,0 );
00276         sizerH2 -> Add( _scaleY         ,1,wxALL | wxEXPAND ,0 );
00277         sizerH2 -> Add( _scaleZ         ,1,wxALL | wxEXPAND ,0 );
00278 
00279         sizerH3 -> Add( new wxStaticText(this,-1,_T("Rotation :   "))   ,1,wxALL  ,0);
00280         sizerH3 -> Add( _rotationX      ,1,wxALL | wxEXPAND ,0 );
00281         sizerH3 -> Add( _rotationY      ,1,wxALL | wxEXPAND ,0 );
00282         sizerH3 -> Add( _rotationZ      ,1,wxALL | wxEXPAND ,0 );
00283 
00284 
00285         sizerH4 -> Add( new wxStaticText(this,-1,_T("Intern / Extern :   "))    ,1,wxALL  ,0);
00286         sizerH4 -> Add( _volIntern                                              ,1,wxALL  ,0);
00287         sizerH4 -> Add( new wxStaticText(this,-1, _T(" "))      ,1,wxALL  ,0);
00288         sizerH4 -> Add( _volExtern                                              ,1,wxALL  ,0);
00289 
00290         sizerH5 -> Add( new wxStaticText(this,-1,_T("Isovalue   "))     ,1,wxALL  ,0);
00291         sizerH5 -> Add( _isoValue                                               ,1,wxALL | wxEXPAND ,0 );
00292         sizerH5 -> Add( _valueBeforeIsoValue                    ,1,wxALL | wxEXPAND ,0 );
00293         sizerH5 -> Add( _valueAfterIsoValue                             ,1,wxALL | wxEXPAND ,0 );
00294 
00295         sizerH6 -> Add( new wxStaticText(this,-1, _T(" "))              ,1,wxALL  ,0);
00296         sizerH6 -> Add( btnExtract      ,1,wxALL  ,0);
00297 
00298         sizerH7 -> Add( new wxStaticText(this,-1,_T("Total Volume: "), wxDefaultPosition, wxSize(200,12))                       , 1 , wxALL  ,0);
00299         sizerH7 -> Add( _infoToVo                                                                               , 1 , wxALL  ,0);
00300         sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume:   "), wxDefaultPosition, wxSize(200,12) )               , 1 , wxALL  ,0);
00301         sizerH7 -> Add( _infoSuVo                                                                               , 1 , wxALL  ,0);
00302         sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume (ana.): "), wxDefaultPosition, wxSize(200,12))   , 1 , wxALL  ,0);
00303         sizerH7 -> Add( _infoSuVoA                                                                              , 1 , wxALL  ,0);
00304         sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix < isovalue:   ") , wxDefaultPosition, wxSize(200,12))  , 1 , wxALL  ,0);
00305         sizerH7 -> Add( _infoPixLe                                                                              , 1 , wxALL  ,0);
00306         sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix > isovalue: "), wxDefaultPosition, wxSize(200,12))     , 1 , wxALL  ,0);
00307         sizerH7 -> Add( _infoPixHi                                                                              , 1 , wxALL  ,0);
00308 //      sizerH7 -> SetMinSize(300, 120);
00309 
00310         // Figure type
00311         topsizer -> Add( sizerH0 ,1,wxALL|wxEXPAND  ,0);
00312 
00313         // Scale
00314         topsizer -> Add( sizerH2 ,1,wxALL|wxEXPAND  ,0);
00315 
00316         // Rotation
00317         topsizer -> Add( sizerH3 ,1,wxALL|wxEXPAND  ,0);
00318 
00319         // Intern / Extern
00320         topsizer -> Add( sizerH4 ,1,wxALL  ,0);
00321 
00322 
00323         // Isovalue limite
00324         topsizer -> Add( sizerH5 ,1,wxALL |wxEXPAND ,0);
00325 
00326         // btn Extraction
00327         topsizer -> Add( sizerH6        , 1 , wxALL  ,0);
00328 
00329         // Histograme
00330         topsizer -> Add( _histogrammeAccumulated ,1,  wxALL  ,0);
00331 
00332         // Volumic information
00333         topsizer -> Add( sizerH7                                , 1 , wxALL|wxEXPAND   ,0);
00334 
00335 
00336 
00337 //    wxBoxSizer *sizerHor = new wxBoxSizer(wxHORIZONTAL);
00338     wxBoxSizer *sizerHor = new wxBoxSizer(wxVERTICAL);
00339         sizerHor -> Add( topsizer                               , 1 , wxALL | wxEXPAND  ,0);
00340 
00341 
00342         wxWindow *panelPlotHistogramme = CreatePlotHistogrammeInterface();
00343         sizerHor -> Add( panelPlotHistogramme   , 1 , wxGROW  ,0);
00344 
00345 
00346         this->SetAutoLayout(true);
00347         this->SetSizer( sizerHor );      
00348         this->Layout(); 
00349 //EEDxx2.4
00350 //      this->FitInside();
00351 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::CreateModel (  )  [private]

Definition at line 122 of file wxPanelCuttingImageData.cxx.

References _modelCube, _modelCylinder, and _modelSphere.

Referenced by wxPanelCuttingImageData().

00123 {
00124         _modelCube              = new figureCuttingCubeModel();
00125         _modelSphere    = new figureCuttingSphereModel();
00126         _modelCylinder  = new figureCuttingCylinderModel();
00127 
00128 //      _modelCube->SetVtkTransform( _modelCube->GetVtkTransform()                      );
00129 //      _modelSphere->SetVtkTransform( _modelSphere->GetVtkTransform()          );
00130 //      _modelCylinder->SetVtkTransform( _modelCylinder->GetVtkTransform()      );
00131 }

Here is the caller graph for this function:

wxWindow * wxPanelCuttingImageData::CreatePlotHistogrammeInterface (  )  [private]

Definition at line 170 of file wxPanelCuttingImageData.cxx.

References _renplotter, _wxvtkbaseView, _xyplot, wxVtkBaseView::Configure(), wxVtkBaseView::GetRenWin(), wxVtkBaseView::GetWxVTKRenderWindowInteractor(), and InitHistogramme().

Referenced by CreateInterface().

00171 {
00172         _xyplot = vtkXYPlotActor::New();
00173         InitHistogramme();
00174         _xyplot->GetPositionCoordinate()->SetValue(0.00, 0.00, 0);
00175         _xyplot->GetPosition2Coordinate()->SetValue(1.0, 1.00, 0); //relative to Position
00176         _xyplot->SetXValuesToArcLength();
00177         _xyplot->SetNumberOfXLabels(6);
00178 
00179         _xyplot->SetTitle("Histogramme");
00180         _xyplot->SetXTitle("Gray level");
00181         _xyplot->SetYTitle("Occurrences ");
00182         _xyplot->GetProperty()->SetColor(1, 0, 0);
00183         _xyplot->GetProperty()->SetPointSize(2);
00184         vtkTextProperty *tprop = _xyplot->GetTitleTextProperty();
00185         tprop->SetColor( 1,0,1 );
00186         tprop->BoldOff ();
00187         _xyplot->SetAxisTitleTextProperty(tprop);
00188         _xyplot->SetAxisLabelTextProperty(tprop);
00189         _xyplot->PlotPointsOn();
00190         _xyplot->GetProperty()->SetPointSize(3);
00191 
00192         _wxvtkbaseView = new wxVtkBaseView(this);
00193         _wxvtkbaseView->Configure();
00194 
00195         _renplotter = vtkRenderer::New();
00196         vtkRenderWindow *renWin = _wxvtkbaseView->GetRenWin();
00197         renWin->AddRenderer( _renplotter );
00198         _renplotter->AddActor2D( _xyplot );
00199 
00200         return _wxvtkbaseView->GetWxVTKRenderWindowInteractor();
00201 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::InitHistogramme (  )  [private]

Definition at line 135 of file wxPanelCuttingImageData.cxx.

References _histogrammeVector, _imageData, and _xyplot.

Referenced by CreatePlotHistogrammeInterface(), and OnExtract().

00136 {
00137         double rangeA[2];
00138         if (_imageData==NULL)
00139         {
00140                 rangeA[1]=1;
00141         } else {
00142                 _imageData->GetScalarRange(rangeA);
00143         }
00144         _xyplot->RemoveAllInputs();
00145 /*
00146         if ( _histogrammeVector!=NULL )
00147         {
00148                 _histogrammeVector -> Delete();
00149         }
00150 */
00151         _histogrammeVector =  vtkImageData::New();
00152     _histogrammeVector -> SetDimensions ( (int)(rangeA[1]),1,1 );
00153     _histogrammeVector -> SetScalarTypeToUnsignedShort();
00154     _histogrammeVector -> AllocateScalars();    
00155     _histogrammeVector -> Update(); 
00156         
00157         unsigned short *p_vol = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
00158         int i,size = (int) (rangeA[1]);
00159         for (i=0; i < size; i++)
00160         {
00161                 *p_vol=0;
00162                 p_vol++;
00163         }
00164         _xyplot->SetXRange(0, rangeA[1]);
00165         _xyplot->SetYRange(0, 10);
00166         _xyplot->AddInput( _histogrammeVector );
00167 }

Here is the caller graph for this function:

void wxPanelCuttingImageData::OnExtract ( wxCommandEvent &  event  ) 

Definition at line 355 of file wxPanelCuttingImageData.cxx.

References _actualCuttingModel, _histogrammeAccumulated, _histogrammeVector, _imageData, _infoPixHi, _infoPixLe, _infoSuVo, _infoSuVoA, _infoToVo, _isoValue, _valueAfterIsoValue, _valueBeforeIsoValue, _volExtern, _volIntern, _vtkclipping3Ddataviewer, _wxvtkbaseView, _xyplot, figureCuttingModel::CalculeInversMatrix(), figureCuttingModel::GetTheoricVolume(), wxVtkBaseView::GetWxVTKRenderWindowInteractor(), figureCuttingModel::IfPointInside(), InitHistogramme(), min, wxVtkBaseView::Refresh(), and vtkClipping3DDataViewer::RefreshSurface().

Referenced by CreateInterface().

00356 {
00357         wxBusyCursor wait;
00358 
00359         bool                    inside;
00360         bool                    volInt, volExt;
00361         int                             xx,yy,zz;
00362         unsigned short  *pOrg;
00363         unsigned short  *p_histogramme;
00364         int                             dim[3];
00365         double                  spc[3];
00366         long int                contAfter = 0;
00367         long int                contBefor = 0;
00368 
00369         double min=999999999;
00370         double max=-999999999;
00371 
00372         volExt=_volExtern->GetValue();
00373         volInt=_volIntern->GetValue();
00374         int isoValue                = _isoValue->GetValue();
00375         int valueBeforeIsoValue = _valueBeforeIsoValue->GetValue(); 
00376         int valueAfterIsoValue  = _valueAfterIsoValue ->GetValue(); 
00377 
00378         InitHistogramme();
00379         p_histogramme = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
00380 
00381         _imageData->GetDimensions(dim);    
00382         _imageData->GetSpacing(spc);    
00383         _actualCuttingModel->CalculeInversMatrix();
00384 
00385         for (xx=0;xx<dim[0]; xx++)
00386         {
00387                 for (yy=0;yy<dim[1]; yy++)
00388                 {
00389                         for (zz=0;zz<dim[2];zz++)
00390                         {
00391                                 inside=_actualCuttingModel->IfPointInside(xx,yy,zz);
00392                                 if (  ((inside==true)&&(volInt==true)) || ((!inside==true)&&(volExt==true)) )
00393                                 {
00394                                         pOrg=(unsigned short*)_imageData->GetScalarPointer (xx,yy,zz); 
00395 
00396                                         if ((*pOrg)<isoValue)
00397                                         {
00398                                                 contBefor++;
00399                                                 if (valueBeforeIsoValue!=-1)
00400                                                 {
00401                                                         *pOrg=valueBeforeIsoValue;
00402                                                 }
00403                                         } else {
00404                                                 contAfter++;
00405                                                 if (valueAfterIsoValue!=-1)
00406                                                 {
00407                                                         *pOrg=valueAfterIsoValue;
00408                                                 } // if
00409                                         } // if isovalue
00410 
00411                                         p_histogramme[*pOrg]++;
00412                                         if (*pOrg<min) min=*pOrg; 
00413                                         if (*pOrg>max) max=*pOrg; 
00414                                 } // if inside
00415                         } // for zz
00416                 } // for yy
00417         } // for xx
00418 
00419 
00420         // Information
00421         wxString infoToVo;
00422         wxString infoSuVo;
00423         wxString infoSuVoA;
00424         wxString infoPixLe;
00425         wxString infoPixHi;
00426 
00427         double volumeUnit = spc[0]*spc[1]*spc[2];
00428         long int totalSubVolume = contBefor + contAfter;
00429         double contBeforPorc    = 100*(double)contBefor/(double)totalSubVolume;
00430         double contAfterPorc    = 100*(double)contAfter/(double)totalSubVolume;
00431         infoToVo.Printf(_T("%dx%dx%d = %d"),dim[0],dim[1],dim[2], dim[0]*dim[1]*dim[2] );
00432         infoSuVo.Printf(_T("%ld") , totalSubVolume);
00433         infoSuVoA.Printf(_T("%.2f"), _actualCuttingModel->GetTheoricVolume() );
00434         infoPixLe.Printf(_T("%ld pix.   (%.2f %s)  -  %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit);
00435         infoPixHi.Printf(_T("%ld pix.   (%.2f %s)  -  %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit);
00436 
00437         _infoToVo->SetLabel(infoToVo);
00438         _infoSuVo->SetLabel(infoSuVo);
00439         _infoSuVoA->SetLabel(infoSuVoA);
00440         _infoPixLe->SetLabel(infoPixLe);
00441         _infoPixHi->SetLabel(infoPixHi);
00442 
00443         // Histogram
00444         if ( _histogrammeAccumulated->GetValue()==true )
00445         {
00446                 int dimHist[3];
00447                 _histogrammeVector -> GetDimensions ( dimHist );
00448 
00449                 int i,size=dimHist[0];
00450                 for (i=1; i<=size; i++)
00451                 {
00452                         p_histogramme[i] = p_histogramme[i] + p_histogramme[i-1];
00453                 }
00454         }
00455         double range[2];
00456         _histogrammeVector->Update();
00457         _histogrammeVector->GetScalarRange(range);
00458         _xyplot->SetYRange( 0   , range[1]      );
00459         _xyplot->SetXRange( min , max           );
00460 
00461         _vtkclipping3Ddataviewer->RefreshSurface();
00462         _wxvtkbaseView->Refresh();
00463 
00464 //      _wxvtkbaseView->RefreshView();
00465         wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
00466         _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
00467 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::OnOpacityFig ( wxScrollEvent &  event  ) 

Definition at line 500 of file wxPanelCuttingImageData.cxx.

References Refresh(), and RefreshOpacity().

Referenced by CreateInterface().

00501 {
00502         RefreshOpacity();
00503         Refresh();
00504 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::OnTransform ( wxScrollEvent &  event  ) 

Definition at line 538 of file wxPanelCuttingImageData.cxx.

References RefreshView().

Referenced by CreateInterface().

00539 {
00540         RefreshView();
00541 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::OnTypeFig ( wxCommandEvent &  event  ) 

Definition at line 471 of file wxPanelCuttingImageData.cxx.

References _actualActor, _actualCuttingModel, _cubeActor, _cylinderActor, _modelCube, _modelCylinder, _modelSphere, _sphereActor, _typeFig, _wxvtk3Dbaseview, wxVtk3DBaseView::GetRenderer(), RefreshOpacity(), and RefreshView().

Referenced by CreateInterface().

00472 {
00473         _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
00474 
00475         if (_typeFig->GetSelection()==0){
00476                 _actualCuttingModel=_modelCylinder;
00477                 _actualActor=_cylinderActor;
00478         }
00479         if (_typeFig->GetSelection()==1){
00480                 _actualCuttingModel=_modelCube;
00481                 _actualActor=_cubeActor;
00482         }
00483         if (_typeFig->GetSelection()==2){
00484                 _actualCuttingModel=_modelSphere;
00485                 _actualActor=_sphereActor;
00486         }
00487         _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
00488         RefreshOpacity();
00489         RefreshView();
00490 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::Refresh (  ) 

Definition at line 512 of file wxPanelCuttingImageData.cxx.

References _wxvtk3Dbaseview, and wxVtk3DBaseView::Refresh().

Referenced by OnOpacityFig(), and RefreshView().

00513 {
00514         _wxvtk3Dbaseview->Refresh();
00515 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::RefreshOpacity (  )  [private]

Definition at line 493 of file wxPanelCuttingImageData.cxx.

References _actualActor, and _opacityFig.

Referenced by OnOpacityFig(), and OnTypeFig().

00494 {
00495         double op= _opacityFig->GetValue()/100.0;
00496         _actualActor->GetProperty()->SetOpacity( op );
00497 }

Here is the caller graph for this function:

void wxPanelCuttingImageData::RefreshView (  ) 

Definition at line 506 of file wxPanelCuttingImageData.cxx.

References Refresh(), and SetParamsOfTransformation().

Referenced by Configure(), OnTransform(), OnTypeFig(), wxMPRWidget::RefreshView(), and wxManualRegistration3D::RefreshView().

00507 {
00508         SetParamsOfTransformation( );
00509         Refresh();
00510 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::RemoveActors (  ) 

Definition at line 57 of file wxPanelCuttingImageData.cxx.

References _actualActor, _wxvtk3Dbaseview, and wxVtk3DBaseView::GetRenderer().

Referenced by wxMPRWidget::OnCutImagaData(), and wxManualRegistration3D::OnCutImagaData().

00058 {
00059         _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
00060 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::SetParamsOfTransformation (  ) 

Definition at line 518 of file wxPanelCuttingImageData.cxx.

References _actualCuttingModel, _rotationX, _rotationY, _rotationZ, _scaleX, _scaleY, _scaleZ, _vtkmprbasedata, vtkBaseData::GetImageData(), vtkMPRBaseData::GetX(), vtkMPRBaseData::GetY(), and vtkBaseData::GetZ().

Referenced by Configure(), and RefreshView().

00519 {
00520         double spc[3];
00521         vtkImageData *vtkimagedata = _vtkmprbasedata->GetImageData();
00522         vtkimagedata->GetSpacing(spc);
00523         int px = (int) (_vtkmprbasedata->GetX() );
00524         int py = (int) (_vtkmprbasedata->GetY() );
00525         int pz = (int) (_vtkmprbasedata->GetZ() );
00526         int sx = (int) (_scaleX->GetValue() * spc[0] );
00527         int sy = (int) (_scaleY->GetValue() * spc[1] );
00528         int sz = (int) (_scaleZ->GetValue() * spc[2] );
00529         _actualCuttingModel     -> SetScale             ( sx    , sy    , sz );
00530         _actualCuttingModel     -> SetPosition  ( px    , py , pz       );
00531         _actualCuttingModel     -> SetRotation  ( _rotationX->GetValue()        , _rotationY->GetValue() , _rotationZ->GetValue()       );
00532         _actualCuttingModel     -> SetSpacing   ( spc[0]        , spc[1]    , spc[2] );
00533         _actualCuttingModel     -> CalculeMatrix();
00534 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::SetVtkClipping3DDataViewer ( vtkClipping3DDataViewer vtkclipping3Ddataviewer  ) 

Definition at line 71 of file wxPanelCuttingImageData.cxx.

References _vtkclipping3Ddataviewer.

Referenced by wxMPRWidget::OnCutImagaData().

00072 {
00073         this->_vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
00074 }

Here is the caller graph for this function:

void wxPanelCuttingImageData::SetVtkMPRBaseData ( vtkMPRBaseData vtkmprbasedata  ) 

Definition at line 544 of file wxPanelCuttingImageData.cxx.

References _imageData, _vtkmprbasedata, and vtkBaseData::GetImageData().

Referenced by wxMPRWidget::OnCutImagaData(), and wxManualRegistration3D::OnCutImagaData().

00545 {
00546         _vtkmprbasedata = vtkmprbasedata;
00547         _imageData              = _vtkmprbasedata->GetImageData();
00548 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPanelCuttingImageData::SetWxVtk3DBaseView ( wxVtk3DBaseView wxvtk3Dbaseview  ) 

Definition at line 64 of file wxPanelCuttingImageData.cxx.

References _wxvtk3Dbaseview.

Referenced by wxMPRWidget::OnCutImagaData(), and wxManualRegistration3D::OnCutImagaData().

00065 {
00066         _wxvtk3Dbaseview=wxvtk3Dbaseview;
00067 }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 79 of file wxPanelCuttingImageData.h.

Referenced by Configure(), OnTypeFig(), RefreshOpacity(), and RemoveActors().

vtkPolyDataMapper* wxPanelCuttingImageData::_cubeMapper [private]

Definition at line 73 of file wxPanelCuttingImageData.h.

Referenced by Create3DViewObjects(), and ~wxPanelCuttingImageData().

vtkPolyDataMapper* wxPanelCuttingImageData::_cylinderMapper [private]

Definition at line 75 of file wxPanelCuttingImageData.h.

Referenced by Create3DViewObjects(), and ~wxPanelCuttingImageData().

Definition at line 51 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

vtkImageData* wxPanelCuttingImageData::_imageData [private]
wxStaticText* wxPanelCuttingImageData::_infoPixHi [private]

Definition at line 61 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

wxStaticText* wxPanelCuttingImageData::_infoPixLe [private]

Definition at line 60 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

wxStaticText* wxPanelCuttingImageData::_infoSuVo [private]

Definition at line 58 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

wxStaticText* wxPanelCuttingImageData::_infoSuVoA [private]

Definition at line 59 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

wxStaticText* wxPanelCuttingImageData::_infoToVo [private]

Definition at line 57 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

Definition at line 52 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

Definition at line 41 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and RefreshOpacity().

vtkRenderer* wxPanelCuttingImageData::_renplotter [private]

Definition at line 45 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and SetParamsOfTransformation().

Definition at line 46 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and SetParamsOfTransformation().

Definition at line 47 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and SetParamsOfTransformation().

wxSlider* wxPanelCuttingImageData::_scaleX [private]

Definition at line 42 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and SetParamsOfTransformation().

wxSlider* wxPanelCuttingImageData::_scaleY [private]

Definition at line 43 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and SetParamsOfTransformation().

wxSlider* wxPanelCuttingImageData::_scaleZ [private]

Definition at line 44 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and SetParamsOfTransformation().

vtkPolyDataMapper* wxPanelCuttingImageData::_sphereMapper [private]

Definition at line 74 of file wxPanelCuttingImageData.h.

Referenced by Create3DViewObjects(), and ~wxPanelCuttingImageData().

wxChoice* wxPanelCuttingImageData::_typeFig [private]

Definition at line 55 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnTypeFig().

Definition at line 54 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

Definition at line 53 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

wxRadioButton* wxPanelCuttingImageData::_volExtern [private]

Definition at line 50 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

wxRadioButton* wxPanelCuttingImageData::_volIntern [private]

Definition at line 49 of file wxPanelCuttingImageData.h.

Referenced by CreateInterface(), and OnExtract().

Definition at line 85 of file wxPanelCuttingImageData.h.

Referenced by OnExtract(), and SetVtkClipping3DDataViewer().

vtkCubeSource* wxPanelCuttingImageData::_vtkcube [private]

Definition at line 70 of file wxPanelCuttingImageData.h.

Referenced by Create3DViewObjects(), and ~wxPanelCuttingImageData().

vtkCylinderSource* wxPanelCuttingImageData::_vtkcylinder [private]

Definition at line 72 of file wxPanelCuttingImageData.h.

Referenced by Create3DViewObjects(), and ~wxPanelCuttingImageData().

Definition at line 82 of file wxPanelCuttingImageData.h.

Referenced by SetParamsOfTransformation(), and SetVtkMPRBaseData().

vtkSphereSource* wxPanelCuttingImageData::_vtksphere [private]

Definition at line 71 of file wxPanelCuttingImageData.h.

Referenced by Create3DViewObjects(), and ~wxPanelCuttingImageData().

vtkXYPlotActor* wxPanelCuttingImageData::_xyplot [private]

The documentation for this class was generated from the following files:

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1