From: Eduardo Davila Date: Wed, 14 Nov 2012 07:30:49 +0000 (+0000) Subject: Bug #1373 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=543dfcbe8f5ff78bbed90ef1e20c722bfa0ef248;p=creaMaracasVisu.git Bug #1373 Visualize images of type double in the ViewerNV Feature #1756 Synchronize WindowColor and LevelColor in all views Bug #1757 Synchronize free planes in 3D view Clean Debug Comments --- diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index c8e287f..122af45 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -123,19 +123,14 @@ void ViewerNV::Process() _mwxwidget->setColorTransferFunction(bbGetInputColorFunction()); } - if(bbGetInputWindowLevel()!=-1) - { - _mwxwidget->setWindowLevel(bbGetInputWindowLevel()); - } - if(bbGetInputColorLevel()!=-1) + if( (bbGetInputColorLevel()!=-1) && (bbGetInputWindowLevel()!=-1)) { if(bbGetInputColorLevel() == 0) { - std::cout<<"colorlevel "<setColorLevel(0.1); + _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , 0.1 ); }else{ - _mwxwidget->setColorLevel(bbGetInputColorLevel()); + _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , bbGetInputColorLevel() ); } } }// mwxwidget != NULL diff --git a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx index 0527b07..6361cad 100644 --- a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx +++ b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx @@ -1,7 +1,7 @@ #include "volumerendererdata.h" #include "vtkObjectFactory.h" -vtkCxxRevisionMacro(VolumeRendererData, "$Revision: 1.9 $"); +vtkCxxRevisionMacro(VolumeRendererData, "$Revision: 1.10 $"); vtkStandardNewMacro(VolumeRendererData); VolumeRendererData::VolumeRendererData() @@ -16,14 +16,9 @@ VolumeRendererData::VolumeRendererData() void VolumeRendererData::ShowVolume(bool checked){ - printf("EED VolumeRendererData::ShowVolume 1 \n"); try{ - printf("EED VolumeRendererData::ShowVolume 2 \n"); if(checked){ - printf("EED VolumeRendererData::ShowVolume 3 \n"); invariant(); - printf("EED VolumeRendererData::ShowVolume 4 \n"); - cout<<"JPRG::VolumeRendererData::ShowVolume"<addVolume(ImageData, Interactor); @@ -53,32 +48,29 @@ void VolumeRendererData::ShowVolume(bool checked){ } -void VolumeRendererData::invariant(){ - if(!ImageData){ +void VolumeRendererData::invariant() +{ + if(!ImageData) + { throw "Image data not set"; } - if(!Renderer){ + if(!Renderer) + { throw "renderer not initialized"; } } -void VolumeRendererData::OpacityChanged(vector greyvalues, vector values){ +void VolumeRendererData::OpacityChanged(vector greyvalues, vector values) +{ //invariant(); - - - printf("EED VolumeRendererData::OpacityChanged 1\n"); - if(VolRendManager==NULL) - { - printf("EED VolumeRendererData::OpacityChanged 2\n"); - } else{ + if(VolRendManager!=NULL) + { ShowVolume(true); - printf("EED VolumeRendererData::OpacityChanged 3\n"); VolRendManager->setVolumeOpacity(greyvalues,values); - } - - printf("EED VolumeRendererData::OpacityChanged 4\n"); + } } + void VolumeRendererData::BoundingBoxChanged(bool checked){ // invariant(); @@ -95,12 +87,16 @@ void VolumeRendererData::BoundingBoxChanged(bool checked){ VolRendManager->DisableBoundingBox(); } } + } + void VolumeRendererData::changeCompositeMIPFunction(int function){ invariant(); if(VolRendManager) + { VolRendManager->changeCompositeMIPFunction(0, function); + } } /** @@ -111,5 +107,7 @@ void VolumeRendererData::changeCompositeMIPFunction(int function){ void VolumeRendererData::changeInterpolationType(int type){ invariant(); if(VolRendManager) + { VolRendManager->changeInterpolationType(type); + } } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx index db587e3..ae28411 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx @@ -24,7 +24,6 @@ manualInteractorWindowLevel::~manualInteractorWindowLevel() bool manualInteractorWindowLevel::OnMouseMove() // virtual { - if (_stateWindowLevel==true) { int tmpPx,tmpPy; @@ -64,19 +63,31 @@ bool manualInteractorWindowLevel::OnMouseMove() // virtual { colorWin=100000; } - - if (colorLev<0) - { - colorLev=0; - } + +//EED 2 Nov 2012 This lets see negative values with the interaction of Window-Level Color +// if (colorLev<0) +// { +// colorLev=0; +// } + if (colorLev>100000) { colorLev=100000; } - vtkImageViewer2 *vtkimageviewer2; - vtkimageviewer2=((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2(); - vtkimageviewer2->SetColorWindow(colorWin); - vtkimageviewer2->SetColorLevel(colorLev); + + wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView(); + vtkBaseData *vtkbasedata = wxvtk2Dbaseview->GetVtkBaseData(); + +//EED Borrame +// vtkImageViewer2 *vtkimageviewer2 = wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2(); +// vtkimageviewer2->SetColorWindow(colorWin); +// vtkimageviewer2->SetColorLevel(colorLev); + + vtkbasedata->SetColorWindow(colorWin); + vtkbasedata->SetColorLevel(colorLev); + + this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); + // vtkimageviewer2->Render(); } return true; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx index bcec976..26de1a6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx @@ -24,7 +24,8 @@ void vtkBaseData::SetMarImageData(marImageData *marimagedata) //------------------------------------------------------------------- vtkImageData* vtkBaseData::GetImageData() { - if(_marImageData){ + if(_marImageData) + { return _marImageData->GetImageDataT(_t); }else{ return 0; @@ -41,6 +42,26 @@ marImageData* vtkBaseData::GetMarImageData() void vtkBaseData::Configure() // virtual { + vtkImageData* imageData = _marImageData->GetImageData(); + if(imageData !=NULL) + { + double range[2]; + imageData->GetScalarRange(range); + if (range[1]<20000){ + //EED Borrame + //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( (range[1]-range[0])/2 ); + //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( (range[1]+range[0])/4 ); + SetColorWindow( (range[1]-range[0])/2 ); + SetColorLevel( (range[1]+range[0])/4 ); + } else { + //EED Borrame + //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 ); + //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 ); + SetColorWindow( 1000 ); + SetColorLevel( 500 ); + + } // range + } // img } //------------------------------------------------------------------- @@ -84,16 +105,19 @@ void vtkBaseData::SetZ(double z){ _z=z; } } + //------------------------------------------------------------------- double vtkBaseData::GetZ() { return _z; } + //------------------------------------------------------------------- int vtkBaseData::GetT() { return _t; } + //------------------------------------------------------------------- void vtkBaseData::SetT(double t) { @@ -109,3 +133,27 @@ void vtkBaseData::SetT(double t) _t=(int)t; } +//------------------------------------------------------------------- +void vtkBaseData::SetColorWindow(double colorWindow) +{ + _colorWindow = colorWindow; +} + +//------------------------------------------------------------------- +void vtkBaseData::SetColorLevel(double colorLevel) +{ + _colorLevel=colorLevel; +} + +//------------------------------------------------------------------- +double vtkBaseData::GetColorWindow() +{ + return _colorWindow; +} + +//------------------------------------------------------------------- +double vtkBaseData::GetColorLevel() +{ + return _colorLevel; +} + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h index dad5fac..31f6008 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h @@ -19,11 +19,19 @@ public: int GetT(); void SetT(double t); - + + void SetColorWindow(double colorWindow); + void SetColorLevel(double colorLevel); + double GetColorWindow(); + double GetColorLevel(); + protected: marImageData *_marImageData; double _z; int _t; + + double _colorWindow; + double _colorLevel; }; #endif /*VTKBASEDATA_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index e5b8804..901a7d7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx @@ -248,8 +248,6 @@ void vtkClipping3DDataViewer::Configure_Volume() { // Volume - - /** if(_newvol != NULL) { _newvol->Delete(); @@ -257,8 +255,6 @@ void vtkClipping3DDataViewer::Configure_Volume() _volumeProperty->Delete(); }*/ - - _tfun = vtkPiecewiseFunction::New(); _ctfun = vtkColorTransferFunction::New(); @@ -266,8 +262,6 @@ void vtkClipping3DDataViewer::Configure_Volume() this->_vtkmprbasedata->GetImageData()->GetScalarRange(range); double max = range[1]; - printf("EED::vtkClipping3DDataViewer::Configure_Volume max=%f \n",max); - /* adding the poinst of the transference function */ @@ -328,20 +322,14 @@ void vtkClipping3DDataViewer::Configure_Volume() // EED 13/03/2011 - - // _volumeMapper = vtkVolumeRayCastMapper::New(); _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() ); - - _volumeMapper->SetVolumeRayCastFunction(_compositeFunction); - // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP); - + // - _volumeMapper->SetClippingPlanes( _volumePlanes ); _volumeMapper->AutoAdjustSampleDistancesOn(); @@ -351,17 +339,9 @@ void vtkClipping3DDataViewer::Configure_Volume() _volumeProperty->SetScalarOpacity( _tfun ); // EED 31/03/2008 - _volumeProperty->DisableGradientOpacityOn(); - -// _ - - -// _ - - // _volumeProperty->SetInterpolationTypeToNearest(); // _volumeProperty->ShadeOff(); // _volumeProperty->SetAmbient(0.3); @@ -373,7 +353,7 @@ void vtkClipping3DDataViewer::Configure_Volume() _newvol->SetMapper(_volumeMapper ); _newvol->SetProperty(_volumeProperty ); - _observerV = boxSurfaceObserver::New(); + _observerV = boxSurfaceObserver::New(); _observerV->SetPlanes( _volumePlanes ); _observerV->SetActor( _newvol ); _observerV->SetvtkVolumeRayCastMapper( _volumeMapper ); @@ -382,25 +362,18 @@ void vtkClipping3DDataViewer::Configure_Volume() void vtkClipping3DDataViewer::Configure_VolumeBox() { - cout<<"EED::JPRG::vtkClipping3DDataViewer::Configure_VolumeBox() start"<SetImageData(_vtkmprbasedata->GetImageData()); vector *gv = this->GetGreyValuesTransferenceFVector(); vector *op = this->GetIntensityValuesTransferenceFVector(); - printf("EED::vtkClipping3DDataViewer::Configure_VolumeBox _ctfun=%p \n",_ctfun); - - _volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun)); _volumerendererdata->OpacityChanged(*gv, *op); //_wxvtkclipping3Dview->VisibleVolumeActor( false ); //_volumerendererdata->ShowVolume(event.IsChecked() ); //_volumerendererdata->BoundingBoxChanged(event.IsChecked() ); - - cout<<"EED::JPRG::vtkClipping3DDataViewer::Configure_VolumeBox() end"<GetImageData()){ + if(_vtkmprbasedata->GetImageData()) + { _vtkmprbasedata->GetImageData()->GetScalarRange(range); - max = range[1]; + delta = range[1]-range[0]; _ctFunVectorPoint.clear(); - _ctFunVectorPoint.push_back(max*0/4); - _ctFunVectorPoint.push_back(max*1/4); - _ctFunVectorPoint.push_back(max*2/4); - _ctFunVectorPoint.push_back(max*3/4); - _ctFunVectorPoint.push_back(max*4/4); + _ctFunVectorPoint.push_back( range[0] + delta*0/4 ); + _ctFunVectorPoint.push_back( range[0] + delta*1/4 ); + _ctFunVectorPoint.push_back( range[0] + delta*2/4 ); + _ctFunVectorPoint.push_back( range[0] + delta*3/4 ); + _ctFunVectorPoint.push_back( range[0] + delta*4/4 ); _ctFunVectorRed.clear(); _ctFunVectorRed.push_back(0.0); @@ -176,7 +177,8 @@ void vtkMPR3DDataViewer::Configure() _ctFunVectorBlue.push_back(0.0); - if(_ctfun==NULL){ + if(_ctfun==NULL) + { _ctfun = vtkColorTransferFunction::New(); } _ctfun->RemoveAllPoints(); @@ -319,7 +321,8 @@ vtkImageActor * vtkMPR3DDataViewer::GetvtkActor_axial() void vtkMPR3DDataViewer::SetPositionX(int pos){ int x1,x2,y1,y2,z1,z2; _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); - if(_saggital){ + if(_saggital) + { _saggital->SetDisplayExtent( pos , pos , y1 ,y2 , z1 , z2 ); } } @@ -327,7 +330,8 @@ void vtkMPR3DDataViewer::SetPositionX(int pos){ void vtkMPR3DDataViewer::SetPositionY(int pos){ int x1,x2,y1,y2,z1,z2; _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); - if(_coronal){ + if(_coronal) + { _coronal->SetDisplayExtent(x1,x2, pos,pos, z1,z2); } } @@ -335,7 +339,8 @@ void vtkMPR3DDataViewer::SetPositionY(int pos){ void vtkMPR3DDataViewer::SetPositionZ(int pos){ int x1,x2,y1,y2,z1,z2; _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); - if(_axial){ + if(_axial) + { _axial->SetDisplayExtent(x1,x2, y1,y2, pos,pos); } } @@ -351,7 +356,8 @@ bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition) } void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){ - if(_saggitalColors){ + if(_saggitalColors) + { _saggitalColors->SetLookupTable(colortable); _coronalColors->SetLookupTable(colortable); _axialColors->SetLookupTable(colortable); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx index 5e63470..1d75077 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx @@ -38,26 +38,35 @@ vtkMPRBaseData::vtkMPRBaseData() _transformOrientation = NULL; _marImageData = NULL; } + //------------------------------------------------------------------- vtkMPRBaseData::~vtkMPRBaseData() { if (_marImageData) delete _marImageData; if (_transformOrientation) _transformOrientation ->Delete(); } + //------------------------------------------------------------------- void vtkMPRBaseData::Configure() { + //EED 03nov2012 + vtkBaseData::Configure(); + vtkImageData* img = _marImageData->GetImageData(); - if(img !=NULL){ + if(img !=NULL) + { img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2); - //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<setColorTransferFunction(colortable); } - if (wxwindow2!=NULL) { + + if (wxwindow2!=NULL) + { wxwindow2->setColorTransferFunction(colortable); } - if (wxwindow3!=NULL) { + + if (wxwindow3!=NULL) + { wxwindow3->setColorTransferFunction(colortable); } - if (wxwindow4!=NULL) { + + if (wxwindow4!=NULL) + { wxwindow4->setColorTransferFunction(colortable); } } -void wxMaracas_N_ViewersWidget::setWindowLevel(double level){ - if (wxwindow1!=NULL) { - wxwindow1->setWindowLevel(level); - } - if (wxwindow2!=NULL) { - wxwindow2->setWindowLevel(level); - } - if (wxwindow3!=NULL) { - wxwindow3->setWindowLevel(level); - } - if (wxwindow4!=NULL) { - wxwindow4->setWindowLevel(level); - } -} -void wxMaracas_N_ViewersWidget::setColorLevel(double level){ - if (wxwindow1!=NULL) { - wxwindow1->setColorLevel(level); +//----------------------------------------------------------------------------------- +void wxMaracas_N_ViewersWidget::SetColorWindowLevel(double colorWindow, double colorLevel) +{ + if (wxwindow1!=NULL) + { + wxwindow1->SetColorWindowLevel(colorWindow, colorLevel); } - if (wxwindow2!=NULL) { - wxwindow2->setColorLevel(level); + + if (wxwindow2!=NULL) + { + wxwindow2->SetColorWindowLevel(colorWindow, colorLevel); } - if (wxwindow3!=NULL) { - wxwindow3->setColorLevel(level); + + if (wxwindow3!=NULL) + { + wxwindow3->SetColorWindowLevel(colorWindow, colorLevel); } - if (wxwindow4!=NULL) { - wxwindow4->setColorLevel(level); + + if (wxwindow4!=NULL) + { + wxwindow4->SetColorWindowLevel(colorWindow, colorLevel); } + RefreshView(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h index b20c91f..f33798d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_N_ViewersWidget.h,v $ Language: C++ - Date: $Date: 2010/10/23 12:01:32 $ - Version: $Revision: 1.12 $ + Date: $Date: 2012/11/14 07:30:52 $ + Version: $Revision: 1.13 $ Copyright: (c) 2002, 2003 License: @@ -105,9 +105,7 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel double GetZ(); void setColorTransferFunction(vtkColorTransferFunction* colortable); - - void setWindowLevel(double level); - void setColorLevel(double level); + void SetColorWindowLevel(double colorWindow, double colorLevel); //------------------------------------------------------------------------------------------------------------ // Attributes diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index a0ca639..4097c98 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: 2012/10/11 10:45:16 $ - Version: $Revision: 1.36 $ + Date: $Date: 2012/11/14 07:30:52 $ + Version: $Revision: 1.37 $ Copyright: (c) 2002, 2003 License: @@ -259,11 +259,6 @@ if (mvtkmprbasedata!=NULL) { mvtkmprbasedata->Configure(); - /* - x = mvtkmprbasedata->GetMaxPositionX()/2; - y = mvtkmprbasedata->GetMaxPositionY()/2; - z = mvtkmprbasedata->GetMaxPositionZ()/2; - */ if(mvtkmprbasedata->GetImageData() != NULL) { @@ -330,12 +325,11 @@ } - //------------------------------------------------------------------------- - - void wxMaracas_ViewerWidget::Refresh(bool eraseBackground ,const wxRect* rect ) // virtual eraseBackground=true , rect=NULL - { - wxPanel::Refresh(false); - } +//------------------------------------------------------------------------- +void wxMaracas_ViewerWidget::Refresh(bool eraseBackground ,const wxRect* rect ) // virtual eraseBackground=true , rect=NULL +{ + wxPanel::Refresh(false); +} //------------------------------------------------------------------------- void wxMaracas_ViewerWidget::RefreshView() @@ -453,47 +447,64 @@ // 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::setColorTransferFunction(vtkColorTransferFunction* colortable) +{ + if(mvtkmpr2Dview_X!=NULL) + { + mvtkmpr2Dview_X->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); - }*/ + + 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::SetColorWindowLevel(double colorWindow, double colorLevel) +{ + mvtkmprbasedata->SetColorWindow(colorWindow); + mvtkmprbasedata->SetColorLevel(colorLevel); +//EED Borrame +/* + RefreshView(); + if(mvtk2Dbaseview!=NULL) + { + mvtk2Dbaseview->SetColorWindow(level); + } + + if(mvtkmpr2Dview_X!=NULL) + { + mvtkmpr2Dview_X->SetColorWindow(level); + } + + if(mvtkmpr2Dview_Y!=NULL) + { + mvtkmpr2Dview_Y->SetColorWindow(level); + } + + if(mvtkmpr2Dview_Z!=NULL) + { + mvtkmpr2Dview_Z->SetColorWindow(level); + } + + if(mwxvtkmpr3Dview!=NULL) + { + mwxvtkmpr3Dview->SetColorWindow(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); - }*/ - } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h index 04408f9..1720af7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_ViewerWidget.h,v $ Language: C++ - Date: $Date: 2011/06/29 09:37:52 $ - Version: $Revision: 1.11 $ + Date: $Date: 2012/11/14 07:30:52 $ + Version: $Revision: 1.12 $ Copyright: (c) 2002, 2003 License: @@ -78,9 +78,8 @@ void setColorTransferFunction(vtkColorTransferFunction* colortable); - void setWindowLevel(double level); - - void setColorLevel(double level); + void SetColorWindowLevel(double colorWindow, double colorLevel); + private: int mType; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index 61607c3..fe3b851 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@ -181,6 +181,8 @@ void wxVtk2DBaseView::Configure(bool okimage) imageData->GetExtent (x1,x2,y1,y2,z1,z2); SetImageToVtkViewer(imageData); _imageViewer2XYZ->SetExtentDimension(x1,x2,y1,y2,z1,z2); + +/*EED Borrame, now is syncroniced in vtkBaseData for all windows double range[2]; imageData->GetScalarRange(range); if (range[1]<20000){ @@ -190,6 +192,8 @@ void wxVtk2DBaseView::Configure(bool okimage) _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 ); _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 ); } +*/ + // EED 31 Janvier 2007 //vtkImageActor *vtkimageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor (); //vtkimageactor->InterpolateOff (); @@ -271,20 +275,35 @@ void wxVtk2DBaseView::SetVtkBaseData(vtkBaseData *vtkbasedata) } //------------------------------------------------------------------- +void wxVtk2DBaseView::UpdateColorWindowLevel() +{ + //EED 24oct2010 + //EED 02nov2012 + +// vtkImageViewer2 *vtkimageviewer2 = _imageViewer2XYZ->GetVtkImageViewer2(); + + + vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel(); + imagemaptowindowlevel->SetWindow( _vtkbasedata->GetColorWindow() ); + imagemaptowindowlevel->SetLevel( _vtkbasedata->GetColorLevel() ); + +// EED Borrame +// vtkimageviewer2->SetColorWindow( _vtkbasedata->GetColorWindow() ); +// vtkimageviewer2->SetColorLevel( _vtkbasedata->GetColorLevel() ); + _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified(); +} +//------------------------------------------------------------------- void wxVtk2DBaseView::Refresh() { - int z = (int)(GetVtkBaseData()->GetZ()); - _imageViewer2XYZ->SetZSlice( z ); - -//EED 24oct2010 - _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified(); - - wxVtkBaseView::Refresh(); + int z = (int)(GetVtkBaseData()->GetZ()); + _imageViewer2XYZ->SetZSlice( z ); + //EED 01nov2012 + UpdateColorWindowLevel(); + wxVtkBaseView::Refresh(); } //------------------------------------------------------------------- - void wxVtk2DBaseView::SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview) { SetInteractorStyleBaseView(interactorstylebaseview); @@ -307,6 +326,7 @@ vtkRenderer* wxVtk2DBaseView::GetRenderer() // virtual { return _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer(); } + //--------------------------------------------------------------------------- vtkRenderWindow* wxVtk2DBaseView::GetRenWin() // virtual { @@ -317,7 +337,8 @@ vtkRenderWindow* wxVtk2DBaseView::GetRenWin() // virtual void wxVtk2DBaseView::GetSpacing(double spc[3]) // virtual { vtkImageData *imageData = GetVtkBaseData()->GetImageData(); - if(imageData){ + if(imageData) + { imageData->GetSpacing(spc); }else{ spc[0] = 0; @@ -329,28 +350,26 @@ void wxVtk2DBaseView::GetSpacing(double spc[3]) // virtual //------------------------------------------------------------------- void wxVtk2DBaseView::setColorTransferFunction(vtkColorTransferFunction* colortable) { - if(_imageViewer2XYZ!=NULL){ + if(_imageViewer2XYZ!=NULL) + { _imageViewer2XYZ->setColorTransferFunction(colortable); this->Refresh(); } } //------------------------------------------------------------------- -void wxVtk2DBaseView::setWindowLevel(double level) +void wxVtk2DBaseView::SetColorWindow(double level) { // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow(level); - - vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel(); - imagemaptowindowlevel->SetWindow(level); + _vtkbasedata->SetColorWindow(level); this->Refresh(); } //------------------------------------------------------------------- -void wxVtk2DBaseView::setColorLevel(double level) +void wxVtk2DBaseView::SetColorLevel(double level) { // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel(level); - vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel(); - imagemaptowindowlevel->SetLevel(level); + _vtkbasedata->SetColorLevel(level); this->Refresh(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h index 7a3e47b..4c6e30c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h @@ -37,11 +37,14 @@ public: void setColorTransferFunction(vtkColorTransferFunction* colortable); - void setWindowLevel(double level); - - void setColorLevel(double level); + void SetColorWindow(double level); + void SetColorLevel(double level); + virtual int GetDirection(); void SetImageToVtkViewer(vtkImageData *imageData); + + //EED 01nov2012 + void UpdateColorWindowLevel(); private: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx index 58ba013..9a12bcc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx @@ -53,11 +53,9 @@ void wxVtk3DBaseView::Refresh() void wxVtk3DBaseView::SetStereo(int type) { //EED 02/06/2012 - printf("EED wxVtk3DBaseView::SetStereo start\n"); - + if (_renWin!=NULL) { - printf("EED wxVtk3DBaseView::SetStereo 2\n"); if (type==0) { _renWin->SetStereoRender(0); // OFF @@ -79,18 +77,14 @@ void wxVtk3DBaseView::SetStereo(int type) } // if type } // _renWin - printf("EED wxVtk3DBaseView::SetStereo end\n"); - } //------------------------------------------------------------------- void wxVtk3DBaseView::Configure() { - printf("EED wxVtk3DBaseView::Configure A\n"); if (_configure==false) { - printf("EED wxVtk3DBaseView::Configure B\n"); _configure=true; //wxVtkBaseView::Configure(); _aRenderer = vtkRenderer::New(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index 3d1d5a9..fa6be72 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -218,9 +218,6 @@ void wxVtkClipping3DView::Configure(){ // between the planes is actually rendered. _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange(); - cout<<"EED::JPRG::wxVtkClipping3DView::SetVtkClipping3DDataViewer::GetRenderer()::"<GetWxvtk3Dbaseview()->GetRenderer()<GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()<SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer()); _vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index 0bd418b..b98d250 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@ -46,14 +46,9 @@ vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata() //------------------------------------------------------------------- void wxVtkMPR2DView::Configure() { - printf("EED wxVtkMPR2DView::Configure"); - wxVtk2DBaseView::Configure(); - - int x1,x2,y1,y2,z1,z2; GetVtkmprbasedata() -> GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); - double spc[3]; vtkImageData* img = GetVtkmprbasedata()->GetImageData(); if(_interactorstylemprview==NULL) @@ -81,9 +76,6 @@ void wxVtkMPR2DView::Configure() z2 = (int)(z2*spc[2]); _visibleAxis = true; - - - } // Axe A @@ -96,11 +88,8 @@ void wxVtkMPR2DView::Configure() _ptsA->SetNumberOfPoints(2); _ptsA->SetPoint(0, -1000 , -1000 , -1000 ); _ptsA->SetPoint(1, 1000 , 1000 , 1000 ); - _pdA = vtkPolyData::New(); - _lineAMapper = vtkPolyDataMapper::New(); - _lineAMapper->SetInput(_pdA); _lineAMapper->ImmediateModeRenderingOn(); _lineAActor->SetMapper(_lineAMapper); @@ -123,12 +112,10 @@ void wxVtkMPR2DView::Configure() _lineBActor->GetProperty()->SetLineWidth(0.5); _lineBMapper = vtkPolyDataMapper::New(); _lineBActor->SetMapper(_lineBMapper); - _ptsB = vtkPoints::New(); _ptsB->SetNumberOfPoints(2); _ptsB->SetPoint(0, -1000 , -1000 , -1000 ); _ptsB->SetPoint(1, 1000 , 1000 , 1000 ); - // _lineBActor->GetProperty()->BackfaceCullingOn(); } @@ -141,12 +128,8 @@ void wxVtkMPR2DView::Configure() _pdB->SetPoints( _ptsB ); _pdB->SetLines( linesB ); linesB->Delete(); //do not delete lines ?? - - _lineBMapper->SetInput(_pdB); _lineBMapper->ImmediateModeRenderingOn(); - - if(_imageViewer2XYZ){ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor ); _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor ); @@ -202,7 +185,6 @@ void wxVtkMPR2DView::Configure() // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160); // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800); } - } void wxVtkMPR2DView::SetVisibleAxis(bool ok) @@ -227,16 +209,7 @@ void wxVtkMPR2DView::SetVisibleAxis(bool ok) //------------------------------------------------------------------- void wxVtkMPR2DView::Refresh() { - - printf("wxVtkMPR2DView::Refresh start\n"); - //wxVtk2DBaseView::Refresh(); - - - //vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2(); // JPRx - //vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera(); // JPRx - - int x1 = 0,x2 = 0,y1 = 0,y2 = 0,z1 = 0,z2 = 0; int x = 0, y = 0, z = 0; int xx = 0, yy = 0, zz = 0; @@ -245,10 +218,6 @@ void wxVtkMPR2DView::Refresh() double xx1,yy1,zz1,xx2,yy2,zz2; - - //GetVtkmprbasedata()->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); - - vtkImageData* img = GetVtkmprbasedata()->GetImageData(); if(img!=NULL){ origin = img->GetOrigin(); @@ -346,13 +315,9 @@ void wxVtkMPR2DView::Refresh() _backZ=zz; } -//EED 24oct2010 -_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified(); - +//EED 01nov2012 + UpdateColorWindowLevel(); wxVtkBaseView::Refresh(); - - printf("wxVtkMPR2DView::Refresh end\n"); - } } //------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index a05e831..72acc37 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -5,7 +5,6 @@ #include "vtkProbeFilter.h" #include "vtkStructuredPoints.h" #include "vtkMetaImageWriter.h" -#include "vtkDataSetMapper.h" #include "vtkImageChangeInformation.h" #include "vtkPointData.h" #include "vtkWindowLevelLookupTable.h" @@ -15,12 +14,103 @@ #include "vtkmyPWCallback_3DPointWidget.h" #include "vtkProperty.h" #include "vtkCellPicker.h" - +#include "vtkInteractorStyleBaseView.h" +#include #ifdef _DEBUG #define new DEBUG_NEW #endif + + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +class vtkWindowLevelImagePlaneWidgetCallback : public vtkCommand +{ + public: + static vtkWindowLevelImagePlaneWidgetCallback *New() + { + return new vtkWindowLevelImagePlaneWidgetCallback; + } + + void Execute( vtkObject *caller, unsigned long ev, void *callData ) + { + bool needRefresh=false; + double slicePosition; + vtkImagePlaneWidget* ipw =dynamic_cast< vtkImagePlaneWidget* >( caller ); + if ( ev == vtkCommand::WindowLevelEvent) + { + double info[2]; + ipw->GetWindowLevel(info); + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetColorWindow(info[0]); + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetColorLevel(info[1]); + needRefresh=true; + } // if ev + + if ( ev == vtkCommand::InteractionEvent) + { + needRefresh=true; + if (ipw->GetCursorDataStatus()) + { + double xyzv[4]; + ipw->GetCursorData(xyzv); + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX(xyzv[0]); + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY(xyzv[1]); + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ(xyzv[2]); + } else { + + + vtkImageData *image = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); + double spc[3]; + if(image) + { + image->GetSpacing(spc); + } + + double normal[3]; + slicePosition = ipw->GetSlicePosition(); + ipw->GetNormal(normal); + + // FreePlaneX + if ((normal[0]==1)&&(normal[1]==0)&&(normal[2]==0)) + { + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX( slicePosition/spc[0] ); + } + // FreePlaneY + if ((normal[0]==0)&&(normal[1]==1)&&(normal[2]==0)) + { + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY( slicePosition/spc[1] ); + } + // FreePlaneZ + if ((normal[0]==0)&&(normal[1]==0)&&(normal[2]==1)) + { + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ( slicePosition/spc[2] ); + } + }// ipw->GetCursorDataStatus + }// ev + + if (needRefresh) + { + vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView(); + isbv->SetParent_refresh_waiting(); + isbv->EvaluateToRefresh(); + } + + } // Execute + + vtkWindowLevelImagePlaneWidgetCallback(){} + wxVtkMPR3DView *_wxvtkmpr3Dview; +}; + + + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- + + + wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview ) { _wxvtk3Dbaseview = wxvtk3Dbaseview; @@ -33,9 +123,9 @@ wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview ) _probe = NULL; _contourMapper = NULL; - _planeWidgetX = 0; - _planeWidgetY = 0; - _planeWidgetZ = 0; + _planeWidgetX = NULL; + _planeWidgetY = NULL; + _planeWidgetZ = NULL; //EED Fev 3 2010 //Free Planes } @@ -113,7 +203,6 @@ void wxVtkMPR3DView::Configure() { vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); - printf("EED wxMaracas_ViewerWidget::ConfigureVTK \n"); _wxvtk3Dbaseview->Configure(); _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(); @@ -217,7 +306,6 @@ void wxVtkMPR3DView::Configure() _probe->SetSource( imageData ); _contourMapper->SetScalarRange( imageData->GetScalarRange() ); - ConfigureFreePlanes(); } @@ -250,20 +338,32 @@ void wxVtkMPR3DView::ConfigureFreePlanes() picker->UnRegister(NULL); + // ColorWindow ColorLevel Callback + vtkWindowLevelImagePlaneWidgetCallback *wlipwc = vtkWindowLevelImagePlaneWidgetCallback::New(); + wlipwc->_wxvtkmpr3Dview = this; + _planeWidgetX->AddObserver(vtkCommand::WindowLevelEvent, wlipwc ); + _planeWidgetY->AddObserver(vtkCommand::WindowLevelEvent, wlipwc ); + _planeWidgetZ->AddObserver(vtkCommand::WindowLevelEvent, wlipwc ); + + // Cursor Callback + _planeWidgetX->AddObserver(vtkCommand::InteractionEvent, wlipwc ); + _planeWidgetY->AddObserver(vtkCommand::InteractionEvent, wlipwc ); + _planeWidgetZ->AddObserver(vtkCommand::InteractionEvent, wlipwc ); } //------------------------------------------------------------------- vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker) { - vtkProperty* prop1 = 0; - vtkImagePlaneWidget* planeWidget = 0; - planeWidget = vtkImagePlaneWidget::New(); + vtkProperty* prop1 = 0; + vtkImagePlaneWidget* planeWidget = 0; + planeWidget = vtkImagePlaneWidget::New(); planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); planeWidget->EnabledOff(); - vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); + vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); int xMin = 0, xMax = 0, yMin = 0, yMax = 0, zMin = 0, zMax = 0; double xSpacing = 0, ySpacing = 0, zSpacing = 0; - if(image){ + if(image) + { planeWidget->SetInput( image ); image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax); image->GetSpacing(xSpacing, ySpacing, zSpacing); @@ -295,10 +395,22 @@ vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, return planeWidget; } +//------------------------------------------------------------------- +void wxVtkMPR3DView::SetFreePlanesOrtho() +{ + _planeWidgetX->SetPlaneOrientationToXAxes(); + _planeWidgetY->SetPlaneOrientationToYAxes(); + _planeWidgetZ->SetPlaneOrientationToZAxes(); + vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)GetWxvtk3Dbaseview()->GetInteractorStyleBaseView(); + isbv->SetParent_refresh_waiting(); + isbv->EvaluateToRefresh(); +} + //------------------------------------------------------------------- void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok) { - if(_planeWidgetX){ + if(_planeWidgetX) + { if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn(); if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn(); if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn(); @@ -311,7 +423,8 @@ void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok) //------------------------------------------------------------------- void wxVtkMPR3DView::FreePlaneInteraction(bool ok) { - if(_planeWidgetX){ + if(_planeWidgetX) + { if (ok==true) { _planeWidgetX->InteractionOn(); @@ -322,10 +435,11 @@ void wxVtkMPR3DView::FreePlaneInteraction(bool ok) _planeWidgetY->InteractionOff(); _planeWidgetZ->InteractionOff(); } - } + } // if _planeWidgetX } + //------------------------------------------------------------------- void wxVtkMPR3DView::setColorTransferFunction(vtkColorTransferFunction* colortable) { @@ -360,31 +474,52 @@ void wxVtkMPR3DView::RefreshView() // virtual //double nx=1,ny=0,nz=0; // JPRx Refresh(); - double x=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetX(); - double y=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetY(); - double z=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetZ(); + double x=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX(); + double y=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY(); + double z=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ(); + + SetColorWindow( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() ); + SetColorLevel( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() ); + + double normal[3]; + // FreePlaneX + _planeWidgetX->GetNormal(normal); + if ((normal[0]==1)&&(normal[1]==0)&&(normal[2]==0)) + { + _planeWidgetX->SetSlicePosition( x*spc[0] ); + } + // FreePlaneY + _planeWidgetY->GetNormal(normal); + if ((normal[0]==0)&&(normal[1]==1)&&(normal[2]==0)) + { + _planeWidgetY->SetSlicePosition( y*spc[1] ); + } + // FreePlaneZ + _planeWidgetZ->GetNormal(normal); + if ((normal[0]==0)&&(normal[1]==0)&&(normal[2]==1)) + { + _planeWidgetZ->SetSlicePosition( z*spc[2] ); + } + x=x*spc[0]; y=y*spc[1]; z=z*spc[2]; if(_pointWidget){ _pointWidget->SetPosition( x,y,z ); - - double in[3]; double normal[3]; vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation(); in[0]=1; in[1]=0; in[2]=0; transform->TransformPoint(in,normal); _planeWidget->SetNormal( normal[0],normal[1],normal[2] ); - - _planeWidget->SetCenter( x,y,z ); _planeWidget->UpdatePlacement(); _planeWidget->GetPolyData(_vtkplane); } } + //------------------------------------------------------------------- wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent, bool align) { @@ -482,8 +617,19 @@ void wxVtkMPR3DView::InitOrientationPointWidget() this->_planeWidget->SetNormal(1,0,0); } +//------------------------------------------------------------------- +void wxVtkMPR3DView::SetColorWindow(double colorWindow) +{ + double colorLevel = _planeWidgetX->GetLevel(); + _planeWidgetX->SetWindowLevel(colorWindow,colorLevel); +} - +//------------------------------------------------------------------- +void wxVtkMPR3DView::SetColorLevel(double colorLevel) +{ + double colorWindow = _planeWidgetX->GetWindow(); + _planeWidgetX->SetWindowLevel(colorWindow,colorLevel); +} //------------------------------------------------------------------- // EED 25 Janvier 2007 testLoic @@ -672,7 +818,7 @@ void wxVtkMPR3DView::TestLoic2() // interact with data renWin->Render(); iren->Start(); +} -} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h index e6333f9..1cd96df 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h @@ -53,7 +53,11 @@ public: vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker); void FreePlaneVisible(int plane, bool ok); void FreePlaneInteraction(bool ok); + void SetFreePlanesOrtho(); + void SetColorWindow(double colorWindow); + void SetColorLevel(double colorLevel); + private: wxVtk3DBaseView *_wxvtk3Dbaseview; @@ -68,8 +72,8 @@ private: // Point Widget (3D) vtkPointWidget *_pointWidget; //vtkmyPWCallback_3DPointWidget *_myCallback; - vtkProbeFilter *_probe; - vtkPolyDataMapper *_contourMapper; + vtkProbeFilter *_probe; + vtkPolyDataMapper *_contourMapper; //Free planes vtkImagePlaneWidget *_planeWidgetX; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx index a5df47a..ab7322f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx @@ -28,32 +28,35 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV wxButton *btnColorTable = new wxButton (panel, -1, _T("Edit Color Table") ); */ - ckBoxX = new wxCheckBox(panel,-1,_T("X ")); - _positionX = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS); - ckBoxY = new wxCheckBox(panel,-1,_T("Y ")); - _positionY = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS); - ckBoxZ = new wxCheckBox(panel,-1,_T("Z ")); - _positionZ = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS); - wxButton *btnColorTable = new wxButton (panel, -1, _T("Color Table") ); - - _ckBoxXYZ = new wxCheckBox(panel,-1,_T("Show XYZ axis ")); - _ckBoxPlane = new wxCheckBox(panel,-1,_T("Show Planes")); - - _ckFreePlaneX= new wxCheckBox(panel,-1,_T("free X"));; - _ckFreePlaneY= new wxCheckBox(panel,-1,_T("free Y"));; - _ckFreePlaneZ= new wxCheckBox(panel,-1,_T("free Z"));; - _ckFreePlaneInteraction= new wxCheckBox(panel,-1,_T("Interaction "));; + _ckBoxX = new wxCheckBox(panel,-1,_T("X ")); + _positionX = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS); + _ckBoxY = new wxCheckBox(panel,-1,_T("Y ")); + _positionY = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS); + _ckBoxZ = new wxCheckBox(panel,-1,_T("Z ")); + _positionZ = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS); + + _ckBoxXYZ = new wxCheckBox(panel,-1,_T("XYZ axis ")); + _ckBoxPlane = new wxCheckBox(panel,-1,_T("Plane")); +////EED 05Nov2012 _ckBox_BW_Color_Plane = new wxCheckBox(panel,-1,_T("GL/Color")); + wxButton *btnColorTable = new wxButton (panel, -1, _T("Color table") ); + wxButton *btnFreePlanesOrtho= new wxButton (panel, -1, _T("Orthogonal planes GL") ); + + _ckFreePlaneX= new wxCheckBox(panel,-1,_T("X "));; + _ckFreePlaneY= new wxCheckBox(panel,-1,_T("Y "));; + _ckFreePlaneZ= new wxCheckBox(panel,-1,_T("Z "));; + _ckFreePlaneInteraction= new wxCheckBox(panel,-1,_T("Interaction planes GL"));; //EED: If-else statements added 30 Nov 2009 - _ckFreePlaneX->SetValue(true); + _ckFreePlaneX->SetValue(false); _ckFreePlaneY->SetValue(false); _ckFreePlaneZ->SetValue(false); _ckFreePlaneInteraction->SetValue(true); - ckBoxX->SetValue(false); - ckBoxY->SetValue(false); - ckBoxZ->SetValue(false); + _ckBoxX->SetValue(false); + _ckBoxY->SetValue(false); + _ckBoxZ->SetValue(false); _ckBoxXYZ->SetValue(false); +////EED 05Nov2012 _ckBox_BW_Color_Plane->SetValue(true); _ckBoxPlane->SetValue(false); _positionX->SetSize(400,20); @@ -76,23 +79,25 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV - Connect(ckBoxX->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX ); - Connect(_positionX->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX ); - Connect(ckBoxY->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY ); - Connect(_positionY->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY ); - Connect(ckBoxZ->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ ); - Connect(_positionZ->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ ); - Connect(btnColorTable->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnEditColorTable ); - - Connect(_ckBoxXYZ->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ ); - Connect(_ckBoxPlane->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisiblePlane ); - - Connect(_ckFreePlaneX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneX ); - Connect(_ckFreePlaneY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneY ); - Connect(_ckFreePlaneZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneZ ); + Connect(_ckBoxX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX ); + Connect(_positionX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX ); + Connect(_ckBoxY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY ); + Connect(_positionY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY ); + Connect(_ckBoxZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ ); + Connect(_positionZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ ); + + Connect(btnColorTable->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnEditColorTable ); + Connect(_ckBoxXYZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ ); + Connect(_ckBoxPlane->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisiblePlane ); +////EED 05Nov2012 Connect(_ckBox_BW_Color_Plane->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::On_BW_Color_Plane ); + + Connect(_ckFreePlaneX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneX); + Connect(_ckFreePlaneY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneY); + Connect(_ckFreePlaneZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneZ); + Connect(btnFreePlanesOrtho->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnFreePlanesOrtho ); Connect(_ckFreePlaneInteraction->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneInteraction ); - Connect(_cbStereo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnSetStereo ); + Connect(_cbStereo->GetId() , wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnSetStereo ); wxFlexGridSizer *sizer; @@ -104,33 +109,48 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV wxFlexGridSizer *sizerH4; wxFlexGridSizer *sizerH5; wxFlexGridSizer *sizerH6; - wxFlexGridSizer *sizerH7; + if(align) { sizer = new wxFlexGridSizer(4); - - sizerH4 = new wxFlexGridSizer(2); + sizerH4 = new wxFlexGridSizer(3); + + sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH4->Add( new wxStaticText(panel, -1,_T("GL")) , 1, wxALL|wxEXPAND, 0); + sizerH4->Add( new wxStaticText(panel, -1,_T("Color ")) , 1, wxALL|wxEXPAND, 0); + sizerH4->Add( _positionX ,1,wxGROW , 0 ); - sizerH4->Add( ckBoxX ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _ckFreePlaneX, 1, wxALL|wxEXPAND, 0); + sizerH4->Add( _ckBoxX ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _positionY ,1,wxGROW, 0 ); - sizerH4->Add( ckBoxY ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _ckFreePlaneY, 1, wxALL|wxEXPAND, 0); + sizerH4->Add( _ckBoxY ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _positionZ ,1,wxGROW, 0 ); - sizerH4->Add( ckBoxZ ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _ckFreePlaneZ, 1, wxALL|wxEXPAND, 0); + sizerH4->Add( _ckBoxZ ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + + + + sizerH5 = new wxFlexGridSizer(1); sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0); sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); - //sizerH5->Add( new wxStaticText(panel, -1,_T(" ")), 1, wxALL|wxEXPAND, 0); +////EED 05Nov2012 sizerH5->Add( _ckBox_BW_Color_Plane , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( btnFreePlanesOrtho , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( _cbStereo, 1, wxALL|wxEXPAND, 0); + + sizer->Add( sizerH4, 1, wxALL|wxGROW, 2); + sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2); - sizerH6 = new wxFlexGridSizer(1); - sizerH6->Add( _ckFreePlaneX, 1, wxALL|wxEXPAND, 0); - sizerH6->Add( _ckFreePlaneY, 1, wxALL|wxEXPAND, 0); - sizerH6->Add( _ckFreePlaneZ, 1, wxALL|wxEXPAND, 0); - sizerH6->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND, 0); } else { sizer = new wxFlexGridSizer(1); @@ -140,16 +160,17 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV sizerH6 = new wxFlexGridSizer(10); sizerH4->Add( _positionX , 1, wxGROW , 0 ); - sizerH4->Add( ckBoxX , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _ckBoxX , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); sizerH4->Add( _positionY , 1, wxGROW , 0 ); - sizerH4->Add( ckBoxY , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _ckBoxY , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); sizerH4->Add( _positionZ , 1, wxGROW , 0 ); - sizerH4->Add( ckBoxZ , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( _ckBoxZ , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); sizerH4->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); - sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0); +////EED 05Nov2012 sizerH5->Add( _ckBox_BW_Color_Plane , 1, wxALL|wxEXPAND, 0); + sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); sizerH6 = new wxFlexGridSizer(10); sizerH6->Add( _ckFreePlaneX , 1, wxALL|wxEXPAND, 0); @@ -159,11 +180,17 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV sizerH6->Add( _ckFreePlaneZ , 1, wxALL|wxEXPAND, 0); sizerH6->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); sizerH6->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND, 0); + sizerH6->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH6->Add( btnFreePlanesOrtho , 0 , wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH6->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH6->Add( _cbStereo, 1, wxALL|wxEXPAND, 0); + + sizer->Add( sizerH4, 1, wxALL|wxGROW, 2); + sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2); + sizer->Add( sizerH6, 1, wxALL|wxEXPAND,2); } - sizerH7 = new wxFlexGridSizer(1); - sizerH7->Add( _cbStereo, 1, wxALL|wxEXPAND, 0); //EED 28 sep 2006 @@ -195,10 +222,6 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV // sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0); // sizerH5->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0); - sizer->Add( sizerH4, 1, wxALL|wxGROW, 2); - sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2); - sizer->Add( sizerH6, 1, wxALL|wxEXPAND,2); - sizer->Add( sizerH7, 1, wxALL|wxEXPAND,2); panel->SetSize(400,50); panel->SetAutoLayout(true); @@ -211,29 +234,15 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV } - - - //------------------------------------------------------------------- - void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() { vtkMPRBaseData* basedata = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData(); if(basedata != NULL){ - /*int maxX = basedata->GetMaxPositionX(); - int maxY = basedata->GetMaxPositionY(); - int maxZ = basedata->GetMaxPositionZ();*/ vtkImageData* img = basedata->GetImageData(); int x0,x1,y0,y1,z0,z1; - /*int maxX = x1-x0;//basedata->GetMaxPositionX(); - int maxY = y1-y0;//basedata->GetMaxPositionY(); - int maxZ = z1-z0;//basedata->GetMaxPositionZ();*/ - - //std::cout<<"wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() maxX="<Update(); // _positionY->Update(); // _positionZ->Update(); // this->Update(); - } + }//img - } + }//basedata } @@ -296,10 +304,26 @@ int wxVtkMPR3DViewCntrlPanel::GetIdTissue() } */ +//------------------------------------------------------------------- +//void wxVtkMPR3DViewCntrlPanel::On_BW_Color_Plane(wxCommandEvent& event) +//{ +// printf ("EED wxVtkMPR3DViewCntrlPanel::On_BW_Color_Plane ...... NOT Implemented\n "); +//} + + //------------------------------------------------------------------- void wxVtkMPR3DViewCntrlPanel::OnEditColorTable(wxCommandEvent& event) { + vtkImageData *imagedata = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); + + if ( imagedata->GetScalarType()!=VTK_UNSIGNED_SHORT ) + { + wxMessageDialog windowMessage1(NULL,_T("This option is just available for UNSIGNED SHORT images."), _T("Alert !"), wxOK); + windowMessage1.ShowModal(); + return; + } + vtkColorTransferFunction *ctfun = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetvtkColorTransferFunction(); std::vector *ctfunVectorPoint = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorPoint(); std::vector *ctfunVectorRed = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorRed(); @@ -311,8 +335,6 @@ void wxVtkMPR3DViewCntrlPanel::OnEditColorTable(wxCommandEvent& event) int i=0,xi,r,g,b; - vtkImageData *imagedata = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); - HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Color table"),imagedata,2); @@ -438,6 +460,12 @@ void wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneInteraction(wxCommandEvent& eve _wxvtkmpr3Dview->FreePlaneInteraction( event.IsChecked() ); } +//------------------------------------------------------------------- +void wxVtkMPR3DViewCntrlPanel::OnFreePlanesOrtho(wxCommandEvent& event) +{ + _wxvtkmpr3Dview->SetFreePlanesOrtho(); +} + //------------------------------------------------------------------- void wxVtkMPR3DViewCntrlPanel::OnSetStereo(wxCommandEvent& event) { @@ -520,22 +548,24 @@ void wxVtkMPR3DViewCntrlPanel::OnPositionZ(wxScrollEvent& event) _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); } + + //------------------------------------------------------------------- bool wxVtkMPR3DViewCntrlPanel::GetVisibleX() { - return ckBoxX->GetValue(); + return _ckBoxX->GetValue(); } //------------------------------------------------------------------- bool wxVtkMPR3DViewCntrlPanel::GetVisibleY() { - return ckBoxY->GetValue(); + return _ckBoxY->GetValue(); } //------------------------------------------------------------------- bool wxVtkMPR3DViewCntrlPanel::GetVisibleZ() { - return ckBoxZ->GetValue(); + return _ckBoxZ->GetValue(); } //------------------------------------------------------------------- @@ -544,6 +574,13 @@ bool wxVtkMPR3DViewCntrlPanel::GetVisibleXYZ() return _ckBoxXYZ->GetValue(); } +//------------------------------------------------------------------- +////EED 05Nov2012 +//bool wxVtkMPR3DViewCntrlPanel::Get_BW_Color_Plane() +//{ +// return _ckBox_BW_Color_Plane; +//} + //------------------------------------------------------------------- bool wxVtkMPR3DViewCntrlPanel::GetVisiblePlane() { @@ -553,7 +590,7 @@ bool wxVtkMPR3DViewCntrlPanel::GetVisiblePlane() //------------------------------------------------------------------- void wxVtkMPR3DViewCntrlPanel::SetVisibleX(bool value) { - ckBoxX->SetValue(value); + _ckBoxX->SetValue(value); _wxvtkmpr3Dview->VisibleImageActor(0, value ); _wxvtkmpr3Dview->Refresh(); @@ -565,7 +602,7 @@ void wxVtkMPR3DViewCntrlPanel::SetVisibleX(bool value) //------------------------------------------------------------------- void wxVtkMPR3DViewCntrlPanel::SetVisibleY(bool value) { - ckBoxY->SetValue(value); + _ckBoxY->SetValue(value); _wxvtkmpr3Dview->VisibleImageActor(1, value ); _wxvtkmpr3Dview->Refresh(); @@ -577,7 +614,7 @@ void wxVtkMPR3DViewCntrlPanel::SetVisibleY(bool value) //------------------------------------------------------------------- void wxVtkMPR3DViewCntrlPanel::SetVisibleZ(bool value) { - ckBoxZ->SetValue(value); + _ckBoxZ->SetValue(value); _wxvtkmpr3Dview->VisibleImageActor(2, value ); _wxvtkmpr3Dview->Refresh(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h index a9880a9..fbd17a5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h @@ -21,15 +21,15 @@ public: void OnVisibleAxisXYZ(wxCommandEvent& event); void OnVisiblePlane(wxCommandEvent& event); void OnEditColorTable(wxCommandEvent& event); +////EED 05Nov2012 void On_BW_Color_Plane(wxCommandEvent& event); void OnVisibleFreePlaneX(wxCommandEvent& event); void OnVisibleFreePlaneY(wxCommandEvent& event); void OnVisibleFreePlaneZ(wxCommandEvent& event); void OnVisibleFreePlaneInteraction(wxCommandEvent& event); void OnSetStereo(wxCommandEvent& event); + void OnFreePlanesOrtho(wxCommandEvent& event); - - virtual void Refresh(); void UpdateControlPanel(); @@ -38,6 +38,7 @@ public: bool GetVisibleZ(); bool GetVisibleXYZ(); bool GetVisiblePlane(); +////EED 05Nov2012 bool Get_BW_Color_Plane(); void SetVisibleX(bool value); void SetVisibleY(bool value); void SetVisibleZ(bool value); @@ -62,10 +63,13 @@ private: wxSlider *_positionZ; //CPR: Added 30 nov 2009 - wxCheckBox *ckBoxX; - wxCheckBox *ckBoxY; - wxCheckBox *ckBoxZ; - + wxCheckBox *_ckBoxX; + wxCheckBox *_ckBoxY; + wxCheckBox *_ckBoxZ; + + //EED 03 nov 2012 +////EED 05Nov2012 wxCheckBox *_ckBox_BW_Color_Plane; + wxCheckBox *_ckBoxXYZ; wxCheckBox *_ckBoxPlane;