wxImageViewerWidget Class Reference

Panel class composed of a vtk renderwindow with double click available and add some buttons. More...

#include <wxImageViewerWidget.h>

Inheritance diagram for wxImageViewerWidget:
Inheritance graph
[legend]
Collaboration diagram for wxImageViewerWidget:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxImageViewerWidget (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSUNKEN_BORDER, const wxString &name=wxPanelNameStr)
 ~wxImageViewerWidget ()
virtual void ConstructVTK (vtkImageData *imageData)
virtual void ExecuteEvent (vtkObject *wdg, unsigned long event, void *calldata)
void ExecuteEvent1 (vtkObject *wdg, unsigned long event, void *calldata)
void ExecuteEvent2 (vtkObject *wdg, unsigned long event, void *calldata)
void SetImage (vtkImageData *imagedata)
void SetInterfaceVtkPanelWidgets (InterfaceVtkPanelWidgets *intVtkPanWid)
void SetState (int state)
void SetStateManualContour (int state)
void CreateNewManualContour ()
int GetNumberOfPointsSplineManualContour ()
double * GetVectorPointsXManualContour ()
double * GetVectorPointsYManualContour ()
void EraseManualContour ()
void SetZSlice (int z)
int GetZSlice ()
void Render ()
void AddObserver_1 ()
void AddObserver_2 ()

Protected Attributes

int _state
marZoomROIObserver_Observer
vtkInteractorStyle2DMaracas_interactorStyle2DMaracas
vtkImageViewer2 * _imageViewer
InterfaceVtkPanelWidgets_intVtkPanWid
wxVTKRenderWindowInteractorEditContour_wxVTKiren

Private Attributes

manualContourControler_manContControl
manualContourModel_mContourModel
manualViewContour_mViewContour

Detailed Description

Panel class composed of a vtk renderwindow with double click available and add some buttons.

Definition at line 60 of file wxImageViewerWidget.h.


Constructor & Destructor Documentation

wxImageViewerWidget::wxImageViewerWidget ( wxWindow *  parent,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxSUNKEN_BORDER,
const wxString &  name = wxPanelNameStr 
)

Definition at line 111 of file wxImageViewerWidget.cxx.

References _imageViewer, _intVtkPanWid, _manContControl, _mContourModel, _mViewContour, _Observer, _state, and _wxVTKiren.

00116                                                            :
00117                    wxPanel( parent, id, pos, size, style, name )
00118 {
00119         _manContControl = NULL;
00120         _mContourModel  = NULL;
00121         _mViewContour   = NULL;
00122         _Observer               = NULL;
00123 
00124         _state=1;
00125         //vtkOutputWindow::GetInstance()->PromptUserOff();
00126         _wxVTKiren              = new wxVTKRenderWindowInteractorEditContour( this, -1 );
00127         _imageViewer    = vtkImageViewer2::New();
00128 
00129         wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
00130         sizer_1->Add(_wxVTKiren, 1, wxGROW, 0);
00131         SetAutoLayout(true);
00132         SetSizer(sizer_1);
00133         Layout();
00134 
00135   _intVtkPanWid = NULL;
00136 
00137 
00138 }

wxImageViewerWidget::~wxImageViewerWidget (  ) 

Todo:
I can't find a way to delete a renderWindow on Win32
Todo:
The following two lines shouldn't be commented

Definition at line 141 of file wxImageViewerWidget.cxx.

References _imageViewer, _manContControl, _mContourModel, _mViewContour, _Observer, and _wxVTKiren.

00141                                          {
00142 
00143         //imageViewer->GetInput()->Delete();
00144         if ( _Observer !=NULL )  { _Observer->Delete(); }
00145 
00148 
00149         if ( _imageViewer !=NULL )  { _imageViewer->Delete(); }
00150         //wxVTKiren->SetRenderWhenDisabled( false );
00151 
00152         if ( _wxVTKiren !=NULL )  { _wxVTKiren->Delete(); }
00153 
00154 
00155         if ( _manContControl !=NULL )  { delete _manContControl;  }
00156         if ( _mContourModel  !=NULL )  { delete _mContourModel; }
00157         if ( _mViewContour   !=NULL )  { delete _mViewContour;    }
00158 }


Member Function Documentation

void wxImageViewerWidget::AddObserver_1 (  ) 

Definition at line 248 of file wxImageViewerWidget.cxx.

References _Observer, and _wxVTKiren.

Referenced by ConstructVTK().

00248                                        {
00249 
00250   //wxVTKiren->AddObserver(vtkCommand::MiddleButtonPressEvent, _Observer);
00251   //use interactor style to override -for real- the default behavior
00252   _wxVTKiren->GetInteractorStyle()->AddObserver( vtkCommand::MiddleButtonPressEvent , _Observer);
00253   _wxVTKiren->AddObserver(vtkCommand::MouseMoveEvent, _Observer);
00254   //wxVTKiren->AddObserver(vtkCommand::MiddleButtonReleaseEvent, _Observer);
00255    _wxVTKiren->GetInteractorStyle()->AddObserver( vtkCommand::MiddleButtonReleaseEvent , _Observer);
00256 
00257   //EED  _wxVTKiren->AddObserver(vtkCommand::MouseWheelForwardEvent, _Observer);
00258   _wxVTKiren->AddObserver( wxEVT_MOUSEWHEEL+10000 , _Observer);
00259 
00260   //EED  _wxVTKiren->AddObserver(vtkCommand::MouseWheelBackwardEvent, _Observer);
00261   _wxVTKiren->AddObserver( wxEVT_MOUSEWHEEL+10001 , _Observer);
00262 
00263 }

Here is the caller graph for this function:

void wxImageViewerWidget::AddObserver_2 (  ) 

Definition at line 268 of file wxImageViewerWidget.cxx.

00268                                        {
00269 /*
00270 //  _wxVTKiren->AddObserver(vtkCommand::LeftButtonPressEvent    , _Observer);
00271 //  _wxVTKiren->AddObserver(vtkCommand::LeftButtonReleaseEvent, _Observer);
00272 
00273   _wxVTKiren->AddObserver(vtkCommand::MiddleButtonPressEvent    , _Observer);
00274   _wxVTKiren->AddObserver(vtkCommand::MiddleButtonReleaseEvent, _Observer);
00275 
00276 //      _wxVTKiren->AddObserver(vtkCommand::RightButtonPressEvent       , _Observer);
00277   _wxVTKiren->AddObserver(vtkCommand::MouseMoveEvent            , _Observer);
00278 */
00279 }

void wxImageViewerWidget::ConstructVTK ( vtkImageData *  imageData  )  [virtual]

This doesn't seems to be straight forward to overload left button mouse evtn as vtkImageViewer2 overload window Level event / which is bind to left mouse click -> as a hack use Middle mouse, (doesn't seems to usefull)

Reimplemented in wxImageViewerWidgetRoi.

Definition at line 162 of file wxImageViewerWidget.cxx.

References _imageViewer, _interactorStyle2DMaracas, _manContControl, _mContourModel, _mViewContour, _Observer, _wxVTKiren, AddObserver_1(), wxVtk2DView_TMP::Configure(), wxVtkBaseView::GetInteractorStyleBaseView(), marZoomROIObserver::ImageViewerWdg, vtkMaracasImageViewer2Callback::IV, vtkMaracasImageViewer2Callback::New(), vtkInteractorStyle2DMaracas::New(), marZoomROIObserver::New(), InteractorStyleMaracas::SetActive(), manualViewBaseContour::SetModel(), manualContourBaseControler::SetModelView(), wxVTKRenderWindowInteractorEditContour::SetObserver(), manualViewBaseContour::SetRange(), SetState(), manualViewBaseContour::SetWxVtkBaseView(), wxVtk2DView_TMP::SetWxVTKRenderWindowInteractor(), and manualContourBaseControler::SetZ().

Referenced by wxQuantificationWidget::ShowMARACASData().

00163 {
00164   _imageViewer->SetInput ( imageData );
00165   _imageViewer->SetupInteractor ( _wxVTKiren );
00166   vtkCamera *camera =_imageViewer->GetRenderer()->GetActiveCamera();
00167   camera->Zoom(2.5);
00168   _imageViewer->GetRenderer()->ResetCamera ();
00169 
00170 //  int ww=2000;
00171 //  _imageViewer->GetRenderer()->ResetCameraClippingRange(-ww,ww,-ww,ww,-ww,ww);  
00172 
00173   //imageViewer->Render();  //NEVER call it explicitely !!!
00174 
00175   //Some images have a bad range, rescale it by default:
00176   imageData->UpdateInformation();
00177   imageData->SetUpdateExtent( imageData->GetWholeExtent());
00178   imageData->Update();
00179   double *range = imageData->GetScalarRange();
00180 //  _imageViewer->SetColorWindow( range[1] - range[0] );
00181 //  _imageViewer->SetColorLevel( 0.5*(range[1] + range[0]) );
00182 
00183   _Observer = marZoomROIObserver::New();
00184   _Observer->ImageViewerWdg = this;
00185  
00186   SetState(1);   // observer 1
00187   AddObserver_1();
00188         _wxVTKiren->SetObserver(_Observer);
00189 
00196 //  wxVTKiren->GetInteractorStyle()->AddObserver(vtkCommand::LeftButtonPressEvent, _Observer);
00197 
00198 
00199         _manContControl  = new manualContourControler();
00200         _mContourModel   = new manualContourModel();
00201         _mViewContour    = new manualViewContour();
00202 
00203         _manContControl->SetZ(100);
00204         _mViewContour->SetModel(_mContourModel);
00205         wxVtk2DView_TMP *wxvtkbaseview_tmp =new wxVtk2DView_TMP(_imageViewer);
00206         _mViewContour->SetWxVtkBaseView( wxvtkbaseview_tmp );
00207         _mViewContour->SetRange( 2 );
00208         _manContControl->SetActive(false);
00209         _manContControl->SetModelView(_mContourModel,_mViewContour);
00210         wxvtkbaseview_tmp->SetWxVTKRenderWindowInteractor(_wxVTKiren);
00211         wxvtkbaseview_tmp->Configure();
00212         wxvtkbaseview_tmp->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContControl );
00213 
00214     _interactorStyle2DMaracas = vtkInteractorStyle2DMaracas::New(); 
00215     _interactorStyle2DMaracas->SetInteractor ( _wxVTKiren );
00216     _wxVTKiren->SetInteractorStyle(_interactorStyle2DMaracas);
00217     vtkMaracasImageViewer2Callback *cbk = vtkMaracasImageViewer2Callback::New();
00218     cbk->IV = _imageViewer;
00219     _interactorStyle2DMaracas->AddObserver( vtkCommand::WindowLevelEvent, cbk);
00220     _interactorStyle2DMaracas->AddObserver( vtkCommand::StartWindowLevelEvent, cbk);
00221     _interactorStyle2DMaracas->AddObserver( vtkCommand::ResetWindowLevelEvent, cbk);
00222     cbk->Delete();
00223 
00224 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxImageViewerWidget::CreateNewManualContour (  ) 

Definition at line 236 of file wxImageViewerWidget.cxx.

References _manContControl, _mViewContour, manualContourBaseControler::CreateNewManualContour(), manualViewBaseContour::Refresh(), and InteractorStyleMaracas::SetActive().

Referenced by wxQuantificationWidget::SetManualContour_2DWorld().

00236                                                 {
00237         _manContControl->CreateNewManualContour();
00238         _manContControl->SetActive(true);
00239         _mViewContour->Refresh();
00240         Refresh();
00241 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxImageViewerWidget::EraseManualContour (  ) 

Definition at line 243 of file wxImageViewerWidget.cxx.

References _manContControl, and manualContourBaseControler::DeleteContour().

Referenced by wxQuantificationWidget::SetManualContour_2DWorld().

00243                                             {
00244         _manContControl->DeleteContour();
00245 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxImageViewerWidget::ExecuteEvent ( vtkObject *  wdg,
unsigned long  event,
void *  calldata 
) [virtual]

Reimplemented in wxImageViewerWidgetRoi.

Definition at line 283 of file wxImageViewerWidget.cxx.

References _state, ExecuteEvent1(), and ExecuteEvent2().

Referenced by marZoomROIObserver::Execute().

00283                                                                                          {
00284         if (_state==1) {        ExecuteEvent1(wdg,event,calldata);      }
00285         if (_state==2) {        ExecuteEvent2(wdg,event,calldata);      }
00286 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxImageViewerWidget::ExecuteEvent1 ( vtkObject *  wdg,
unsigned long  event,
void *  calldata 
)

Definition at line 290 of file wxImageViewerWidget.cxx.

References _intVtkPanWid, and InterfaceVtkPanelWidgets::CallBackOnMouseWheel().

Referenced by ExecuteEvent().

00290                                                                                           {
00291 
00292         if ( event == vtkCommand::MiddleButtonPressEvent ){
00293         }else if ( event == vtkCommand::MouseMoveEvent ){
00294         }
00295 
00296         if ( event == vtkCommand::MiddleButtonReleaseEvent ){
00297                 //EED } else if ( event == vtkCommand::MouseWheelForwardEvent ){
00298         } else if ( event == wxEVT_MOUSEWHEEL+10000 ){
00299                         wxMouseEvent mouseEvent;
00300                         mouseEvent.m_wheelRotation=130;
00301                         if (_intVtkPanWid!=NULL) { _intVtkPanWid->CallBackOnMouseWheel(mouseEvent);}
00302                 //EED }else if ( event == vtkCommand::MouseWheelBackwardEvent ){
00303         }else if ( event == wxEVT_MOUSEWHEEL+10001 ){
00304                         wxMouseEvent mouseEvent;
00305                         mouseEvent.m_wheelRotation=-130;
00306                         if (_intVtkPanWid!=NULL) { _intVtkPanWid->CallBackOnMouseWheel(mouseEvent);}
00307         }
00308 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxImageViewerWidget::ExecuteEvent2 ( vtkObject *  wdg,
unsigned long  event,
void *  calldata 
)

Definition at line 312 of file wxImageViewerWidget.cxx.

References _manContControl, _wxVTKiren, manualContourBaseControler::DeleteActualMousePoint(), manualContourControler::MouseClickLeft(), manualContourBaseControler::MouseClickRight(), manualContourControler::MouseDLeft(), manualContourControler::MouseMove(), and manualContourBaseControler::MouseReleaseLeft().

Referenced by ExecuteEvent().

00312                                                                                           {
00313         int X,Y;
00314         _wxVTKiren->GetEventPosition(X, Y);
00315         if (event==wxEVT_LEFT_DOWN ){
00316                 _manContControl->MouseClickLeft(X,Y);
00317         }
00318 
00319         if (event==wxEVT_RIGHT_DOWN ){
00320                 _manContControl->MouseClickRight(X,Y);
00321         }
00322 
00323         if (event==wxEVT_LEFT_UP){
00324                 _manContControl->MouseReleaseLeft(X,Y);
00325         }
00326 
00327         if (event==wxEVT_LEFT_DCLICK){
00328                 _manContControl->MouseDLeft(X,Y);
00329         }
00330 
00331         if (event==wxEVT_MOTION){
00332                 _manContControl->MouseMove(X,Y);
00333         }
00334 
00335         if (event==WXK_CLEAR){
00336                 _manContControl->DeleteActualMousePoint(X,Y);
00337         }
00338 }

Here is the call graph for this function:

Here is the caller graph for this function:

int wxImageViewerWidget::GetNumberOfPointsSplineManualContour (  ) 

Definition at line 348 of file wxImageViewerWidget.cxx.

References _manContControl, and manualContourBaseControler::GetNumberOfPointsSplineManualContour().

Referenced by wxQuantificationWidget::SetManualContour_ReplaceContour().

00348                                                              {
00349         return _manContControl->GetNumberOfPointsSplineManualContour();
00350 }

Here is the call graph for this function:

Here is the caller graph for this function:

double * wxImageViewerWidget::GetVectorPointsXManualContour (  ) 

Definition at line 352 of file wxImageViewerWidget.cxx.

References _manContControl, and manualContourBaseControler::GetVectorPointsXManualContour().

Referenced by wxQuantificationWidget::SetManualContour_ReplaceContour().

00352                                                           {
00353         return _manContControl->GetVectorPointsXManualContour();
00354 }

Here is the call graph for this function:

Here is the caller graph for this function:

double * wxImageViewerWidget::GetVectorPointsYManualContour (  ) 

Definition at line 356 of file wxImageViewerWidget.cxx.

References _manContControl, and manualContourBaseControler::GetVectorPointsYManualContour().

Referenced by wxQuantificationWidget::SetManualContour_ReplaceContour().

00356                                                           {
00357         return _manContControl->GetVectorPointsYManualContour();
00358 }

Here is the call graph for this function:

Here is the caller graph for this function:

int wxImageViewerWidget::GetZSlice (  ) 

Definition at line 369 of file wxImageViewerWidget.cxx.

References _imageViewer.

00369                                   {
00370         return _imageViewer->GetZSlice();
00371 }

void wxImageViewerWidget::Render (  ) 

Definition at line 373 of file wxImageViewerWidget.cxx.

References _imageViewer.

Referenced by wxQuantificationWidget::SetManualContour_2DWorld().

00373                                 {
00374         _imageViewer->Render();
00375 }

Here is the caller graph for this function:

void wxImageViewerWidget::SetImage ( vtkImageData *  imagedata  ) 

Definition at line 342 of file wxImageViewerWidget.cxx.

References _imageViewer.

Referenced by wxQuantificationWidget::RefreshAxis().

00342                                                          {
00343   _imageViewer->SetInput(imagedata);
00344   _imageViewer->Render( );
00345 }

Here is the caller graph for this function:

void wxImageViewerWidget::SetInterfaceVtkPanelWidgets ( InterfaceVtkPanelWidgets intVtkPanWid  )  [inline]

Definition at line 78 of file wxImageViewerWidget.h.

References _intVtkPanWid.

00078 { _intVtkPanWid = intVtkPanWid; };

void wxImageViewerWidget::SetState ( int  state  ) 

Definition at line 227 of file wxImageViewerWidget.cxx.

References _state, _wxVTKiren, and wxVTKRenderWindowInteractorEditContour::SetState().

Referenced by ConstructVTK(), and wxQuantificationWidget::SetManualContour_2DWorld().

00227                                            {
00228         _state=state;
00229         _wxVTKiren->SetState(state);
00230 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxImageViewerWidget::SetStateManualContour ( int  state  ) 
void wxImageViewerWidget::SetZSlice ( int  z  ) 

Definition at line 360 of file wxImageViewerWidget.cxx.

References _imageViewer.

00360                                         {
00361 #if (VTK_MAJOR_VERSION >= 5)
00362                 _imageViewer->SetSlice( z );
00363 #else
00364                 _imageViewer->SetZSlice( z );
00365 #endif
00366 
00367 }


Member Data Documentation

vtkImageViewer2* wxImageViewerWidget::_imageViewer [protected]

Definition at line 98 of file wxImageViewerWidget.h.

Referenced by wxImageViewerWidgetRoi::ConstructVTK(), and ConstructVTK().

Definition at line 105 of file wxImageViewerWidget.h.

Referenced by ConstructVTK(), wxImageViewerWidget(), and ~wxImageViewerWidget().

int wxImageViewerWidget::_state [protected]

Definition at line 96 of file wxImageViewerWidget.h.

Referenced by ExecuteEvent(), SetState(), and wxImageViewerWidget().


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

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1