wxMaracas_N_ViewersWidget Class Reference

#include <wxMaracas_N_ViewersWidget.h>

Collaboration diagram for wxMaracas_N_ViewersWidget:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxMaracas_N_ViewersWidget (wxWindow *parent, vtkImageData *imagedata=NULL, std::vector< int > *nTypeView=NULL)
 wxMaracas_N_ViewersWidget (wxWindow *parent, std::vector< int > *nTypeView, vtkImageData *imagedata=NULL)
 ~wxMaracas_N_ViewersWidget ()
void Update ()
vtkRenderer * GetRenderer ()
void RefreshView ()
virtual void OnRefreshView (wxCommandEvent &event)
void OnDClickLeft (wxCommandEvent &event)
wxMaracas_ViewerWidgetGetWindow (int iWin)
wxVtkBaseViewGetwxVtkBaseView (int iWin)
virtual void Refresh (bool eraseBackground=true, const wxRect *rect=NULL)
void SetImage (vtkImageData *image)
void ConfigureVTK ()
void SetType (std::vector< int > *type)
void UpdateLayout (vtkImageData *imagedata)
double GetX ()
double GetY ()
double GetZ ()
void setColorTransferFunction (vtkColorTransferFunction *colortable)
void setWindowLevel (double level)
void setColorLevel (double level)

Private Member Functions

void invariant ()
 DECLARE_EVENT_TABLE ()

Private Attributes

wxMaracas_ViewerWidgetwxwindow1
wxMaracas_ViewerWidgetwxwindow2
wxMaracas_ViewerWidgetwxwindow3
wxMaracas_ViewerWidgetwxwindow4
wxWindow * _currentwxw
std::vector< int > * nTypeView
vtkMPRBaseDatamvtkmprbasedata

Detailed Description

Definition at line 47 of file wxMaracas_N_ViewersWidget.h.


Constructor & Destructor Documentation

wxMaracas_N_ViewersWidget::wxMaracas_N_ViewersWidget ( wxWindow *  parent,
vtkImageData *  imagedata = NULL,
std::vector< int > *  nTypeView = NULL 
)
Precondition:
A wxWindow* object must be provided as a parent for the viewer
Postcondition:
The layout of the viewer is initialize, if there is no image or type set, only the panel of the viwer is created with no vtk objects
Parameters:
wxWindow* parent of the window
vtkImageData* imagedata of the viewer
std::vector<int>* vector of the type for the viewer
Deprecated:

This method will be eliminated in future versions,

the viewers will start with a default image if it is not specified,

this is in order to create the layout of the viewer,

the vtkInteractors* and the object vtkRenderer* use second constructor

Definition at line 45 of file wxMaracas_N_ViewersWidget.cxx.

00046                 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
00047         {
00048                 wxwindow1               = NULL;
00049                 wxwindow2               = NULL;
00050                 wxwindow3               = NULL;
00051                 wxwindow4               = NULL;
00052                 _currentwxw             = NULL;
00053                 mvtkmprbasedata = NULL;
00054                 
00055                 wxSizer *sizer  = new wxBoxSizer(wxVERTICAL);
00056                 this->SetSizer(sizer);
00057                 this->SetAutoLayout(true);
00058                 
00059                 
00060                 if(imagedata!=NULL && nTypeView!=NULL ){
00061                         this->SetType(nTypeView);
00062                         this->UpdateLayout(imagedata);
00063                 }
00064 
00065                 
00066         }

wxMaracas_N_ViewersWidget::wxMaracas_N_ViewersWidget ( wxWindow *  parent,
std::vector< int > *  nTypeView,
vtkImageData *  imagedata = NULL 
)
Precondition:
A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer
Postcondition:
The layout of the viewer is initialized, if no image is provided at first, a default image is used
Parameters:
wxWindow* parent of the window
std::vector<int>* vector of the type for the viewer
vtkImageData* imagedata of the viewer

Definition at line 75 of file wxMaracas_N_ViewersWidget.cxx.

References _currentwxw, mvtkmprbasedata, SetType(), UpdateLayout(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

00076         : wxPanel( parent, -1){
00077                 wxwindow1               = NULL;
00078                 wxwindow2               = NULL;
00079                 wxwindow3               = NULL;
00080                 wxwindow4               = NULL;
00081                 _currentwxw             = NULL;
00082                 mvtkmprbasedata = NULL;
00083                 
00084                 wxSizer *sizer  = new wxBoxSizer(wxVERTICAL);
00085                 this->SetSizer(sizer);
00086                 this->SetAutoLayout(true);
00087                 
00088                 this->SetType(nTypeView);
00089                 
00090                 /*if(imagedata==NULL){
00091                         double spc[3];
00092                         spc[0] = 1;
00093                         spc[1] = 1;
00094                         spc[2] = 1;
00095                         int extent[6];
00096                         extent[0] = 0;
00097                         extent[1] = 1;
00098                         extent[2] = 0;
00099                         extent[3] = 1;
00100                         extent[4] = 0;
00101                         extent[5] = 0;
00102                         
00103                         imagedata = vtkImageData::New();
00104                         imagedata->SetSpacing(spc);
00105                         imagedata->SetExtent(extent);
00106                         imagedata->SetScalarTypeToUnsignedChar();
00107                         imagedata->AllocateScalars();
00108                 }*/
00109                 
00110                 this->UpdateLayout(imagedata);
00111         }

Here is the call graph for this function:

wxMaracas_N_ViewersWidget::~wxMaracas_N_ViewersWidget (  ) 
Precondition:
none
Postcondition:
the viewer window is deleted, all of the interactors and the renderer are deleted

Definition at line 114 of file wxMaracas_N_ViewersWidget.cxx.

References mvtkmprbasedata.

00115         {
00116                 if (mvtkmprbasedata!=NULL)
00117                 {
00118                         delete mvtkmprbasedata;
00119                 }
00120 
00121         }


Member Function Documentation

void wxMaracas_N_ViewersWidget::ConfigureVTK (  ) 

Definition at line 306 of file wxMaracas_N_ViewersWidget.cxx.

References wxMaracas_ViewerWidget::ConfigureVTK(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

Referenced by SetImage().

00307  {
00308          if (wxwindow1!=NULL) { wxwindow1->ConfigureVTK(); }
00309          if (wxwindow2!=NULL) { wxwindow2->ConfigureVTK(); }
00310          if (wxwindow3!=NULL) { wxwindow3->ConfigureVTK(); }
00311          if (wxwindow4!=NULL) { wxwindow4->ConfigureVTK(); }
00312  }

Here is the call graph for this function:

Here is the caller graph for this function:

wxMaracas_N_ViewersWidget::DECLARE_EVENT_TABLE (  )  [private]
vtkRenderer * wxMaracas_N_ViewersWidget::GetRenderer (  ) 

Definition at line 150 of file wxMaracas_N_ViewersWidget.cxx.

00151         {
00152                 return NULL; //renderer;
00153         }

wxMaracas_ViewerWidget * wxMaracas_N_ViewersWidget::GetWindow ( int  iWin  ) 

Definition at line 164 of file wxMaracas_N_ViewersWidget.cxx.

References wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

Referenced by wxMaracasSuperpositionPanel::createSuperpositionPanel(), and GetwxVtkBaseView().

00165         {
00166                 wxMaracas_ViewerWidget *tmpWin=NULL;
00167                 if  (iWin==1)
00168                 {
00169                         tmpWin=wxwindow1;
00170                 }
00171                 if  (iWin==2)
00172                 {
00173                         tmpWin=wxwindow2;
00174                 }
00175                 if  (iWin==3)
00176                 {
00177                         tmpWin=wxwindow3;
00178                 }
00179                 if  (iWin==4)
00180                 {
00181                         tmpWin=wxwindow4;
00182                 }
00183                 return tmpWin;
00184         }

Here is the caller graph for this function:

wxVtkBaseView * wxMaracas_N_ViewersWidget::GetwxVtkBaseView ( int  iWin  ) 

Definition at line 187 of file wxMaracas_N_ViewersWidget.cxx.

References GetWindow(), and wxMaracas_ViewerWidget::GetwxVtkBaseView().

Referenced by wxMaracasSuperpositionPanel::GetWxVtkBaseView(), and wxMaracasSuperpositionPanel::GetwxVtkMPR2DView().

00188         { 
00189                 wxVtkBaseView *wxvtkbaseview=NULL;
00190                 wxMaracas_ViewerWidget *tmpWin=GetWindow(iWin);
00191                 if (tmpWin!=NULL){  wxvtkbaseview = tmpWin->GetwxVtkBaseView();  }
00192                 return wxvtkbaseview;
00193         }

Here is the call graph for this function:

Here is the caller graph for this function:

double wxMaracas_N_ViewersWidget::GetX (  ) 

Definition at line 315 of file wxMaracas_N_ViewersWidget.cxx.

References vtkMPRBaseData::GetX(), invariant(), and mvtkmprbasedata.

Referenced by wxMaracasDialog_NViewers::OnRefreshView().

00316 {       
00317         invariant();
00318         return mvtkmprbasedata->GetX();
00319 //      return wxwindow1->GetX();
00320 }

Here is the call graph for this function:

Here is the caller graph for this function:

double wxMaracas_N_ViewersWidget::GetY (  ) 

Definition at line 323 of file wxMaracas_N_ViewersWidget.cxx.

References vtkMPRBaseData::GetY(), invariant(), and mvtkmprbasedata.

Referenced by wxMaracasDialog_NViewers::OnRefreshView().

00324 {
00325         invariant();
00326         return mvtkmprbasedata->GetY();
00327 //      return wxwindow1->GetY();
00328 }

Here is the call graph for this function:

Here is the caller graph for this function:

double wxMaracas_N_ViewersWidget::GetZ (  ) 

Definition at line 332 of file wxMaracas_N_ViewersWidget.cxx.

References vtkBaseData::GetZ(), invariant(), and mvtkmprbasedata.

Referenced by wxMaracasDialog_NViewers::OnRefreshView().

00333 {
00334         invariant();
00335         return mvtkmprbasedata->GetZ();
00336 //      return wxwindow1->GetZ();
00337 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMaracas_N_ViewersWidget::invariant (  )  [private]

Definition at line 339 of file wxMaracas_N_ViewersWidget.cxx.

References mvtkmprbasedata.

Referenced by GetX(), GetY(), and GetZ().

00339                                            {
00340         if(mvtkmprbasedata == 0){
00341                 throw "The image has not been set in the viewer";
00342         }
00343 }

Here is the caller graph for this function:

void wxMaracas_N_ViewersWidget::OnDClickLeft ( wxCommandEvent &  event  ) 

Definition at line 143 of file wxMaracas_N_ViewersWidget.cxx.

References RefreshView().

Referenced by wxMaracasDialog_NViewers::OnDClickLeft().

00144         {
00145                 RefreshView();
00146         }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMaracas_N_ViewersWidget::OnRefreshView ( wxCommandEvent &  event  )  [virtual]

Definition at line 138 of file wxMaracas_N_ViewersWidget.cxx.

References RefreshView().

Referenced by wxMaracasDialog_NViewers::OnRefreshView().

00139         {
00140                 RefreshView();
00141         }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMaracas_N_ViewersWidget::Refresh ( bool  eraseBackground = true,
const wxRect *  rect = NULL 
) [virtual]

Definition at line 196 of file wxMaracas_N_ViewersWidget.cxx.

00197         {
00198                 wxPanel::Refresh(false);
00199         }

void wxMaracas_N_ViewersWidget::RefreshView (  ) 

Definition at line 155 of file wxMaracas_N_ViewersWidget.cxx.

References wxMaracas_ViewerWidget::RefreshView(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

Referenced by OnDClickLeft(), and OnRefreshView().

00156         {               
00157                 if (wxwindow1!=NULL) {wxwindow1->RefreshView(); }
00158                 if (wxwindow2!=NULL) {wxwindow2->RefreshView(); }
00159                 if (wxwindow3!=NULL) {wxwindow3->RefreshView(); }
00160                 if (wxwindow4!=NULL) {wxwindow4->RefreshView(); }
00161         }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMaracas_N_ViewersWidget::setColorLevel ( double  level  ) 

Definition at line 374 of file wxMaracas_N_ViewersWidget.cxx.

References wxMaracas_ViewerWidget::setColorLevel(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

00374                                                          {
00375         if (wxwindow1!=NULL) {
00376                 wxwindow1->setColorLevel(level);
00377         }
00378         if (wxwindow2!=NULL) {
00379                 wxwindow2->setColorLevel(level);
00380         }
00381         if (wxwindow3!=NULL) {
00382                 wxwindow3->setColorLevel(level);
00383         }
00384         if (wxwindow4!=NULL) {
00385                 wxwindow4->setColorLevel(level);
00386         }
00387 }

Here is the call graph for this function:

void wxMaracas_N_ViewersWidget::setColorTransferFunction ( vtkColorTransferFunction *  colortable  ) 

Definition at line 345 of file wxMaracas_N_ViewersWidget.cxx.

References wxMaracas_ViewerWidget::setColorTransferFunction(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

00345                                                                                             {
00346     if (wxwindow1!=NULL) {
00347                 wxwindow1->setColorTransferFunction(colortable);
00348         }
00349         if (wxwindow2!=NULL) {
00350                 wxwindow2->setColorTransferFunction(colortable);
00351         }
00352         if (wxwindow3!=NULL) {
00353                 wxwindow3->setColorTransferFunction(colortable);
00354         }
00355         if (wxwindow4!=NULL) {
00356                 wxwindow4->setColorTransferFunction(colortable);
00357         }
00358 }

Here is the call graph for this function:

void wxMaracas_N_ViewersWidget::SetImage ( vtkImageData *  image  ) 

Definition at line 295 of file wxMaracas_N_ViewersWidget.cxx.

References ConfigureVTK(), wxMaracas_ViewerWidget::SetImage(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

Referenced by wxMaracasSuperpositionPanel::ChangeImage().

00296  {      
00297          if (wxwindow1!=NULL) { wxwindow1->SetImage(image); }
00298          if (wxwindow2!=NULL) { wxwindow2->SetImage(image); } 
00299          if (wxwindow3!=NULL) { wxwindow3->SetImage(image); }
00300          if (wxwindow4!=NULL) { wxwindow4->SetImage(image); }
00301          ConfigureVTK();
00302          
00303  }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMaracas_N_ViewersWidget::SetType ( std::vector< int > *  type  ) 

Definition at line 288 of file wxMaracas_N_ViewersWidget.cxx.

References nTypeView.

Referenced by wxMaracas_N_ViewersWidget().

00288                                                             {
00289          nTypeView = type;
00290  }

Here is the caller graph for this function:

void wxMaracas_N_ViewersWidget::setWindowLevel ( double  level  ) 

Definition at line 360 of file wxMaracas_N_ViewersWidget.cxx.

References wxMaracas_ViewerWidget::setWindowLevel(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

00360                                                           {
00361         if (wxwindow1!=NULL) {
00362                 wxwindow1->setWindowLevel(level);
00363         }
00364         if (wxwindow2!=NULL) {
00365                 wxwindow2->setWindowLevel(level);
00366         }
00367         if (wxwindow3!=NULL) {
00368                 wxwindow3->setWindowLevel(level);
00369         }
00370         if (wxwindow4!=NULL) {
00371                 wxwindow4->setWindowLevel(level);
00372         }
00373 }

Here is the call graph for this function:

void wxMaracas_N_ViewersWidget::Update (  ) 

Definition at line 129 of file wxMaracas_N_ViewersWidget.cxx.

00130         {
00131                 //wxvtkrenderwindowinteractor->Render();
00132         //    wxvtkrenderwindowinteractor->Refresh();
00133         //    Refresh();
00134         }

void wxMaracas_N_ViewersWidget::UpdateLayout ( vtkImageData *  imagedata  ) 

Definition at line 202 of file wxMaracas_N_ViewersWidget.cxx.

References _currentwxw, wxMaracas_ViewerWidget::ConfigureVTK(), mvtkmprbasedata, nTypeView, vtkBaseData::SetMarImageData(), wxwindow1, wxwindow2, wxwindow3, and wxwindow4.

Referenced by wxMaracas_N_ViewersWidget().

00203         {
00204 
00205                 wxWindow                                *wxwindow       = NULL;
00206                 wxSizer *sizer                                          = this->GetSizer();     
00207                 
00208                 if (mvtkmprbasedata!=NULL)
00209                 {
00210                         delete mvtkmprbasedata;
00211                 }
00212                 
00213                 marImageData    *marimagedata   = new marImageData( imagedata );                        
00214                 mvtkmprbasedata                                 = new vtkMPRBaseData(); 
00215                 mvtkmprbasedata->SetMarImageData(marimagedata);
00216                 
00217                 if(_currentwxw != NULL){
00218                         _currentwxw->Show(false);
00219                         delete _currentwxw;
00220                         //sizer->Remove(currentwxwindow);                       
00221                         //delete currentwxwindow;
00222                 }
00223 
00224                 //std::cout<<"size "<<nTypeView->size()<<std::endl;
00225                 if (nTypeView->size()==1)
00226                 {
00227                         wxwindow1 = new wxMaracas_ViewerWidget(this, imagedata, (*nTypeView)[0], mvtkmprbasedata);
00228 
00229                         wxwindow1->ConfigureVTK();
00230                         wxwindow = wxwindow1;
00231                 }else   if (nTypeView->size()==2)       {
00232                         wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
00233                         spliter->SetMinimumPaneSize(1);
00234                         wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0], mvtkmprbasedata);
00235                         wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1], mvtkmprbasedata);
00236                         wxwindow1->ConfigureVTK();
00237                         wxwindow2->ConfigureVTK();
00238                         spliter -> SplitVertically( wxwindow1 , wxwindow2  );
00239                         wxwindow = spliter;                     
00240                 }else if (nTypeView->size()==3)
00241                 {
00242                         wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
00243                         wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
00244                         spliter->SetMinimumPaneSize(1);
00245                         spliterA->SetMinimumPaneSize(1);
00246                         wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0], mvtkmprbasedata);
00247                         wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1], mvtkmprbasedata);
00248                         wxwindow3 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[2], mvtkmprbasedata);
00249                         wxwindow1->ConfigureVTK();
00250                         wxwindow2->ConfigureVTK();
00251                         wxwindow3->ConfigureVTK();
00252                         spliter -> SplitVertically( wxwindow1 , spliterA   );
00253                         spliterA-> SplitHorizontally( wxwindow2 , wxwindow3  );
00254                         wxwindow = spliter;
00255                 }else if (nTypeView->size()>=4){
00256                         wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
00257                         wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
00258                         wxSplitterWindow        *spliterB       = new wxSplitterWindow( spliter , -1);
00259                         spliter->SetMinimumPaneSize(1);
00260                         spliterA->SetMinimumPaneSize(1);
00261                         spliterB->SetMinimumPaneSize(1);
00262                         wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0], mvtkmprbasedata);
00263                         wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1], mvtkmprbasedata);
00264                         wxwindow3 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[2], mvtkmprbasedata);
00265                         wxwindow4 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[3], mvtkmprbasedata);
00266                         wxwindow1->ConfigureVTK();
00267                         wxwindow2->ConfigureVTK();
00268                         wxwindow3->ConfigureVTK();
00269                         wxwindow4->ConfigureVTK();
00270                         spliter -> SplitVertically( spliterA , spliterB   );
00271                         spliterA-> SplitHorizontally( wxwindow1 , wxwindow2  );
00272                         spliterB-> SplitHorizontally( wxwindow3 , wxwindow4  );
00273                         wxwindow = spliter;
00274                 }
00275                 
00276                 //panel->SetDimension()
00277                 sizer->Add( wxwindow , 1, wxGROW);
00278                 sizer->Layout();
00279                 //_currentwxw = wxwindow;               
00280                 //_currentwxw->Show(true);
00281                 
00282                 //this->Layout();
00283                 //this->Refresh();
00284  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 123 of file wxMaracas_N_ViewersWidget.h.

Referenced by UpdateLayout(), and wxMaracas_N_ViewersWidget().

std::vector<int>* wxMaracas_N_ViewersWidget::nTypeView [private]

Definition at line 126 of file wxMaracas_N_ViewersWidget.h.

Referenced by SetType(), and UpdateLayout().


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

Generated on 20 Oct 2010 for creaMaracasVisu_lib by  doxygen 1.6.1