Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
Language: C++
- Date: $Date: 2010/03/26 14:52:24 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2010/08/25 17:51:12 $
+ Version: $Revision: 1.19 $
Copyright: (c) 2002, 2003
License:
}
+ }
+ /**
+ * @pre A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer
+ * @post The layout of the viewer is initialized, if no image is provided at first, a default image is
+ * used
+ * @param wxWindow* parent of the window
+ * @param std::vector<int>* vector of the type for the viewer
+ * @param vtkImageData* imagedata of the viewer
+ */
+ wxMaracas_N_ViewersWidget::wxMaracas_N_ViewersWidget(wxWindow *parent, std::vector<int> *nTypeView, vtkImageData* imagedata)
+ : wxPanel( parent, -1){
+ wxwindow1 = NULL;
+ wxwindow2 = NULL;
+ wxwindow3 = NULL;
+ wxwindow4 = NULL;
+ _currentwxw = NULL;
+ mvtkmprbasedata = NULL;
+
+ wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(sizer);
+ this->SetAutoLayout(true);
+
+ this->SetType(nTypeView);
+
+ /*if(imagedata==NULL){
+ double spc[3];
+ spc[0] = 1;
+ spc[1] = 1;
+ spc[2] = 1;
+ int extent[6];
+ extent[0] = 0;
+ extent[1] = 1;
+ extent[2] = 0;
+ extent[3] = 1;
+ extent[4] = 0;
+ extent[5] = 0;
+
+ imagedata = vtkImageData::New();
+ imagedata->SetSpacing(spc);
+ imagedata->SetExtent(extent);
+ imagedata->SetScalarTypeToUnsignedChar();
+ imagedata->AllocateScalars();
+ }*/
+
+ this->UpdateLayout(imagedata);
}
//-------------------------------------------------------------------------
}
//panel->SetDimension()
- sizer->Add( wxwindow , 1, wxEXPAND);
+ sizer->Add( wxwindow , 1, wxGROW);
sizer->Layout();
- _currentwxw = wxwindow;
- _currentwxw->Show(true);
+ //_currentwxw = wxwindow;
+ //_currentwxw->Show(true);
- this->Layout();
- this->Refresh();
+ //this->Layout();
+ //this->Refresh();
}
if (wxwindow2!=NULL) { wxwindow2->SetImage(image); }
if (wxwindow3!=NULL) { wxwindow3->SetImage(image); }
if (wxwindow4!=NULL) { wxwindow4->SetImage(image); }
+ ConfigureVTK();
+
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
double wxMaracas_N_ViewersWidget :: GetX()
-{
+{
+ invariant();
return mvtkmprbasedata->GetX();
// return wxwindow1->GetX();
}
//-----------------------------------------------------------------------------------
double wxMaracas_N_ViewersWidget :: GetY()
{
+ invariant();
return mvtkmprbasedata->GetY();
// return wxwindow1->GetY();
}
//-----------------------------------------------------------------------------------
double wxMaracas_N_ViewersWidget :: GetZ()
{
+ invariant();
return mvtkmprbasedata->GetZ();
// return wxwindow1->GetZ();
}
+void wxMaracas_N_ViewersWidget :: invariant(){
+ if(mvtkmprbasedata == 0){
+ throw "The image has not been set in the viewer";
+ }
+}
+
void wxMaracas_N_ViewersWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
if (wxwindow1!=NULL) {
wxwindow1->setColorTransferFunction(colortable);