X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMaracas_ViewerWidget.cxx;h=b07d32f974b22a87833ed4facf471ef342e5e145;hb=28c74ab5eb531ce001260e9bc3fcb0151fcfc56b;hp=f10eac6739610d3869fdadfd54997eeb4dcdabf2;hpb=a4ee3758aa0477f677fb981e2c4d6e29995e8db8;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index f10eac6..b07d32f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_ViewerWidget.cxx,v $ Language: C++ - Date: $Date: 2009/05/14 13:54:35 $ - Version: $Revision: 1.12 $ + Date: $Date: 2009/10/16 15:17:57 $ + Version: $Revision: 1.18 $ Copyright: (c) 2002, 2003 License: @@ -30,7 +30,7 @@ //------------------------------------------------------------------------------------------------------------ - wxMaracas_ViewerWidget::wxMaracas_ViewerWidget(wxWindow *parent, vtkImageData* imagedata, int type) + wxMaracas_ViewerWidget::wxMaracas_ViewerWidget(wxWindow *parent, vtkImageData* imagedata, int type, vtkMPRBaseData *vtkmprbasedata) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { wxPanel *panel = this; @@ -38,9 +38,18 @@ mType = type; - marImageData *marimagedata = new marImageData( imagedata ); - mvtkmprbasedata = new vtkMPRBaseData(); - mvtkmprbasedata->SetMarImageData(marimagedata); + + if (vtkmprbasedata==NULL) + { + minternalVtkmprbasedata = true; + mvtkmprbasedata = new vtkMPRBaseData(); + marImageData *marimagedata = new marImageData( imagedata ); + mvtkmprbasedata->SetMarImageData(marimagedata); + } else { + minternalVtkmprbasedata = false; + mvtkmprbasedata = vtkmprbasedata; + } + mvtk2Dbaseview = NULL; mvtkmpr2Dview_X = NULL; @@ -191,7 +200,12 @@ wxMaracas_ViewerWidget::~wxMaracas_ViewerWidget() { - if (mvtkmprbasedata) { delete mvtkmprbasedata; } + + if (minternalVtkmprbasedata==true) + { + if (mvtkmprbasedata) { delete mvtkmprbasedata; } + } + if (mvtk2Dbaseview) { delete mvtk2Dbaseview; } if (mvtkmpr2Dview_X) { delete mvtkmpr2Dview_X; } if (mvtkmpr2Dview_Y) { delete mvtkmpr2Dview_Y; } @@ -199,10 +213,9 @@ if (mwidgetMesure) { delete mwidgetMesure; } if (mvtkplane2Dview) { delete mvtkplane2Dview; } if (mwxsphereview) { delete mwxsphereview; } + if (mwxvtkmpr3Dview) { delete mwxvtkmpr3Dview; } if (mwxvtkclipping3Dview) { delete mwxvtkclipping3Dview; } if (mwxvtk3Dbaseview_Clipping3D){ delete mwxvtk3Dbaseview_Clipping3D; } - if (mwxvtkmpr3Dview) { delete mwxvtkmpr3Dview; } - } //------------------------------------------------------------------------------------------------------------ // Methods @@ -374,3 +387,48 @@ // return mvtk2Dbaseview->GetVtkBaseData()->GetZ(); } + void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){ + if(mvtkmpr2Dview_X!=NULL){ + mvtkmpr2Dview_X->setColorTransferFunction(colortable); + } + if(mvtkmpr2Dview_Y!=NULL){ + mvtkmpr2Dview_Y->setColorTransferFunction(colortable); + } + if(mvtkmpr2Dview_Z!=NULL){ + mvtkmpr2Dview_Z->setColorTransferFunction(colortable); + } + if(mwxvtkmpr3Dview!=NULL){ + mwxvtkmpr3Dview->setColorTransferFunction(colortable); + } + } + + void wxMaracas_ViewerWidget::setWindowLevel(double level){ + if(mvtkmpr2Dview_X!=NULL){ + mvtkmpr2Dview_X->setWindowLevel(level); + } + if(mvtkmpr2Dview_Y!=NULL){ + mvtkmpr2Dview_Y->setWindowLevel(level); + } + if(mvtkmpr2Dview_Z!=NULL){ + mvtkmpr2Dview_Z->setWindowLevel(level); + } + /*if(mwxvtkmpr3Dview!=NULL){ + mwxvtkmpr3Dview->setWindowLevel(level); + }*/ + } + + void wxMaracas_ViewerWidget::setColorLevel(double level){ + if(mvtkmpr2Dview_X!=NULL){ + mvtkmpr2Dview_X->setColorLevel(level); + } + if(mvtkmpr2Dview_Y!=NULL){ + mvtkmpr2Dview_Y->setColorLevel(level); + } + if(mvtkmpr2Dview_Z!=NULL){ + mvtkmpr2Dview_Z->setColorLevel(level); + } + /*if(mwxvtkmpr3Dview!=NULL){ + mwxvtkmpr3Dview->setColorLevel(level); + }*/ + } +