From: reyes Date: Wed, 29 Jun 2011 09:37:46 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v1.0.4~90 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a236b3d0da0e436f9027b701df86c3576e9c25fe;p=creaMaracasVisu.git *** empty log message *** --- diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5246cbb..b4c4d0f 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -6,3 +6,4 @@ ADD_SUBDIRECTORY(doxygen) #JCP 31-05-11 ADD_SUBDIRECTORY(GUI) ADD_SUBDIRECTORY(Kernel) +ADD_SUBDIRECTORY(itkToVtk) diff --git a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx index e0b2af6..ddbc1c5 100644 --- a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx +++ b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx @@ -1,4 +1,8 @@ #include "volumerendererdata.h" +#include "vtkObjectFactory.h" + +vtkCxxRevisionMacro(VolumeRendererData, "$Revision: 1.4 $"); +vtkStandardNewMacro(VolumeRendererData); VolumeRendererData::VolumeRendererData() { @@ -11,13 +15,10 @@ VolumeRendererData::VolumeRendererData() void VolumeRendererData::ShowVolume(bool checked){ if(checked){ - invariant(); + // invariant(); + cout<<"JPRG::VolumeRendererData::ShowVolume"<SetLookupTable(LookUpTable); - } + VolRendData->SetLookupTable(LookUpTable); Renderer->AddActor(VolRendData->getProp3D()); }else{ Renderer->RemoveActor(VolRendData->getProp3D()); @@ -35,13 +36,28 @@ void VolumeRendererData::invariant(){ } } void VolumeRendererData::OpacityChanged(vector greyvalues, vector values){ - invariant(); - if(VolRendData){ - VolRendData->setVolumeOpacity(greyvalues,values); + //invariant(); + + if(VolRendData==NULL) + { + VolRendData = new VolumeRendererManagerData(ImageData, true); + } + VolRendData->SetLookupTable(LookUpTable); + VolRendData->setVolumeOpacity(greyvalues,values); + } + void VolumeRendererData::BoundingBoxChanged(bool checked){ - invariant(); + // invariant(); + + if(VolRendData==NULL) + { + VolRendData = new VolumeRendererManagerData(ImageData, true); + VolRendData->SetLookupTable(LookUpTable); + } + + if(VolRendData && Interactor){ if(checked){ VolRendData->EnableBoundingBox(Interactor); diff --git a/lib/GUI/Base/VolumeRenderer/volumerendererdata.h b/lib/GUI/Base/VolumeRenderer/volumerendererdata.h index a6a76a7..f00d583 100644 --- a/lib/GUI/Base/VolumeRenderer/volumerendererdata.h +++ b/lib/GUI/Base/VolumeRenderer/volumerendererdata.h @@ -11,25 +11,32 @@ using namespace std; class VolumeRendererData : public vtkObject { public: - VolumeRendererData(); + static VolumeRendererData *New(); + vtkTypeRevisionMacro(VolumeRendererData,vtkObject); + // - vtkSetObjectMacro(VolRendData, VolumeRendererManagerData) vtkSetObjectMacro(ImageData, vtkImageData) vtkSetObjectMacro(Renderer, vtkRenderer) vtkSetObjectMacro(LookUpTable, vtkLookupTable) vtkSetObjectMacro(Interactor, vtkRenderWindowInteractor) + void BoundingBoxChanged(bool checked); + void ShowVolume(bool enable); + void OpacityChanged(vector greyvalues, vector values); + + void changeCompositeMIPFunction(int function); + protected: + VolumeRendererData(); VolumeRendererManagerData* VolRendData; vtkImageData* ImageData; vtkRenderer* Renderer; vtkLookupTable* LookUpTable; vtkRenderWindowInteractor* Interactor; - void ShowVolume(bool enable); - void OpacityChanged(vector greyvalues, vector values); - void BoundingBoxChanged(bool checked); - void changeCompositeMIPFunction(int function); + + + private: diff --git a/lib/GUI/Wx/VolumeRenderer/wxMaracasMultipleVolumeRendererPanel.cxx b/lib/GUI/Wx/VolumeRenderer/wxMaracasMultipleVolumeRendererPanel.cxx index 1d8bc3e..7c912b9 100644 --- a/lib/GUI/Wx/VolumeRenderer/wxMaracasMultipleVolumeRendererPanel.cxx +++ b/lib/GUI/Wx/VolumeRenderer/wxMaracasMultipleVolumeRendererPanel.cxx @@ -26,15 +26,15 @@ wxMaracasMultipleVolumeRendererPanel::wxMaracasMultipleVolumeRendererPanel(wxWin { _propid = propid; isComplexBox = _isComplexBox; - + createControls(img); } /** ** Class destructor **/ -wxMaracasMultipleVolumeRendererPanel::~wxMaracasMultipleVolumeRendererPanel(){ - +wxMaracasMultipleVolumeRendererPanel::~wxMaracasMultipleVolumeRendererPanel(){ + //if(isComplexBox) //((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->deleteVolume(_propid); //else @@ -48,16 +48,16 @@ wxMaracasMultipleVolumeRendererPanel::~wxMaracasMultipleVolumeRendererPanel(){ void wxMaracasMultipleVolumeRendererPanel::createControls(vtkImageData* img){ wxFlexGridSizer* sizerirmprop = new wxFlexGridSizer(3); - + if(!isComplexBox) { -// wxStaticText* label = new wxStaticText(this, -1, wxString(_T(""))); +// wxStaticText* label = new wxStaticText(this, -1, wxString(_T(""))); // wxStaticText* label2 = new wxStaticText(this, -1, wxString(_T(""))); checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor"))); - Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange); - checkbox->SetValue(true); + Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange); + checkbox->SetValue(true); wxString choices[] = {_T("Composite"), _T("MIP")}; _radiobox = new wxRadioBox(this, -1, wxString(_T("Function")), wxDefaultPosition, wxDefaultSize, 2, choices); @@ -69,33 +69,33 @@ void wxMaracasMultipleVolumeRendererPanel::createControls(vtkImageData* img){ //sizerirmprop->Add(label2,wxFIXED_MINSIZE); } //wxBitmap bitmap(Color_xpm); - //_colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30)); - //Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange); + //_colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30)); + //Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange); mwxwidget = new HistogramDialogComboBox(this); mwxwidget->setImageData(img); //mwxwidget->PushEventHandler(this); Connect(mwxwidget->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange); - sizerirmprop->Add(mwxwidget,wxFIXED_MINSIZE); + sizerirmprop->Add(mwxwidget,wxFIXED_MINSIZE); wxBitmap bitmap0(Add_xpm); - _viewimage = new wxBitmapButton(this, -1, bitmap0, wxDefaultPosition, wxSize(30,30)); - Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onViewImage); - sizerirmprop->Add(_viewimage,wxFIXED_MINSIZE); + _viewimage = new wxBitmapButton(this, -1, bitmap0, wxDefaultPosition, wxSize(30,30)); + Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onViewImage); + sizerirmprop->Add(_viewimage,wxFIXED_MINSIZE); //std::string iconsdir = wxMaracasMultipleVolumeRendererView::getInstance()->getPath(); //iconsdir+="/data/Icons/Add.xmp"; //wxBitmap* bitmap = new wxBitmap(wxString(iconsdir.c_str(),wxConvUTF8), wxBITMAP_TYPE_XPM); - this->SetSizer(sizerirmprop, true); + this->SetSizer(sizerirmprop, true); this->SetAutoLayout( true ); - - //_frame = new wxFrame(this, 10, _T("Configure Transfer Functions")); + + //_frame = new wxFrame(this, 10, _T("Configure Transfer Functions")); /*wxButton* button1 = new wxButton(_frame,20,_T("OK")); - Connect(button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onOK); + Connect(button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onOK); wxButton* button2 = new wxButton(_frame,30,_T("Cancel") ); - Connect(button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCancel); + Connect(button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCancel); wxButton* button3 = new wxButton(_frame,40,_T("Update")); Connect(button3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onUpdate); */ @@ -104,7 +104,7 @@ void wxMaracasMultipleVolumeRendererPanel::createControls(vtkImageData* img){ img->GetScalarRange(range); double max = range[1]; - + //X mwxwidget->addPointToTransferenceFunction(max * 0/2,0.0); mwxwidget->addPointToTransferenceFunction(max * 1/2,100.0); @@ -128,19 +128,19 @@ void wxMaracasMultipleVolumeRendererPanel::createControls(vtkImageData* img){ boxSizer->Add(button3, wxCENTER); wxBoxSizer* boxsizer2 = new wxBoxSizer(wxVERTICAL); - boxsizer2->Add(boxSizer0,1,wxEXPAND); - boxsizer2->Add(boxSizer,0,wxCENTER); - + boxsizer2->Add(boxSizer0,1,wxEXPAND); + boxsizer2->Add(boxSizer,0,wxCENTER); + _frame->SetAutoLayout(true); _frame->SetSizer(boxsizer2); _frame->Refresh(); - _frame->Update();*/ + _frame->Update();*/ //mwxwidget->SetFunctions(wxMaracasMultipleVolumeRendererView::getInstance()->GetTransferFunction(getPropId()), // wxMaracasMultipleVolumeRendererView::getInstance()->GetColorFunction(getPropId())); - mwxwidget->Refresh(); + mwxwidget->Refresh(); } /** @@ -162,7 +162,7 @@ void wxMaracasMultipleVolumeRendererPanel::onCancel(wxCommandEvent& event){ ** **/ void wxMaracasMultipleVolumeRendererPanel::onUpdate(wxCommandEvent& event){ - updateVolume(); + updateVolume(); } /** @@ -186,7 +186,7 @@ void wxMaracasMultipleVolumeRendererPanel::updateVolume(){ ( (wxMaracasRendererView::getInstance())->getTabbedPanel(this->_propid) )->SetValuesPointsFunction(this->_propid, greylevel, values); } else - { + { wxMaracasMultipleVolumeRendererView::getInstance()->SetValuesColorPointsFunction(this->_propid, greylevelcolors, red, green, blue); wxMaracasMultipleVolumeRendererView::getInstance()->SetValuesPointsFunction(this->_propid, greylevel, values); } @@ -195,19 +195,19 @@ void wxMaracasMultipleVolumeRendererPanel::updateVolume(){ /** ** Updates the volume visualization **/ -void wxMaracasMultipleVolumeRendererPanel::onColorChange(wxCommandEvent& event){ +void wxMaracasMultipleVolumeRendererPanel::onColorChange(wxCommandEvent& event){ //if(mwxwidget->ShowModal()==wxID_OK){ updateVolume(); // mwxwidget->Show(false); - //} + //} } /** ** **/ void wxMaracasMultipleVolumeRendererPanel::onViewImage(wxCommandEvent& event) -{ +{ vtkImageData* img; std::vector type; type.push_back(6); @@ -217,10 +217,10 @@ void wxMaracasMultipleVolumeRendererPanel::onViewImage(wxCommandEvent& event) if(this->isComplexBox) { - img = (wxMaracasRendererView::getInstance())->getTabbedPanel(_propid)->getVolImage(); + img = (wxMaracasRendererView::getInstance())->getTabbedPanel(_propid)->getVolImage(); } else - { + { img = wxMaracasMultipleVolumeRendererView::getInstance()->getVolumeRenderManager()->getImageData(); } @@ -232,11 +232,11 @@ void wxMaracasMultipleVolumeRendererPanel::onViewImage(wxCommandEvent& event) /** ** **/ -void wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange(wxCommandEvent& event){ +void wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange(wxCommandEvent& event){ if(this->isComplexBox) ( (wxMaracasRendererView::getInstance())->getTabbedPanel(this->_propid) )->addRemoveActorV(this->getPropId(), checkbox->GetValue()); else - wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue()); + wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue()); } /** @@ -246,9 +246,9 @@ int wxMaracasMultipleVolumeRendererPanel::getPropId(){ return _propid; } -void wxMaracasMultipleVolumeRendererPanel::onRadioBoxSelectFunction(wxCommandEvent& event){ - - wxMaracasMultipleVolumeRendererView::getInstance()->changeCompositeMIPFunction(this->getPropId(), _radiobox->GetSelection()); +void wxMaracasMultipleVolumeRendererPanel::onRadioBoxSelectFunction(wxCommandEvent& event){ + + wxMaracasMultipleVolumeRendererView::getInstance()->changeCompositeMIPFunction(this->getPropId(), _radiobox->GetSelection()); } /** diff --git a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx index d724718..0075422 100644 --- a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx +++ b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx @@ -27,12 +27,12 @@ VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, vtkRende } VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, bool usegpu, std::string dataname){ - Initialize(vol, dataname, usegpu); + Initialize(vol, dataname, usegpu); } void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string dataname, bool usegpu){ _vol = vol; - _dataname = dataname; + _dataname = dataname; _tfun = vtkPiecewiseFunction::New(); _ctfun = vtkColorTransferFunction::New(); @@ -56,9 +56,9 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana _MIPFunction = 0; _boxWidgetS1 = 0; - - -/* EED9Juin2011 + + +/* EED9Juin2011 if(usegpu && _vol->GetDataDimension() > 2){ _volumeMappergpu = vtkGPUVolumeRayCastMapper::New(); _volumeMappergpu->SetClippingPlanes( _volumePlanes ); @@ -87,7 +87,7 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana vtkVolumeMapper *volMapperTmp; if(usegpu && _vol->GetDataDimension() > 2){ #if (VTK_MAYOR_VERSION>=5 && VTK_MINOR_VERSION>=6) - _volumeMappergpu = vtkGPUVolumeRayCastMapper::New(); + _volumeMappergpu = vtkGPUVolumeRayCastMapper::New(); _volumeMappergpu->AutoAdjustSampleDistancesOn(); volMapperTmp = _volumeMappergpu; #else @@ -106,7 +106,7 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana _volumeMapper->AutoAdjustSampleDistancesOn(); volMapperTmp = _volumeMapper; } - + volMapperTmp->SetClippingPlanes( _volumePlanes ); _newvol->SetMapper(volMapperTmp ); volMapperTmp->SetInput( _vol ); @@ -151,13 +151,13 @@ void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* int _boxWidgetS1->PlaceWidget(); vtkBoxWidgetCallback *callback = vtkBoxWidgetCallback::New(); - + if (_volumeMapper!=0){ callback->SetMapper(_volumeMapper); } else { callback->SetMapper(_volumeMappergpu); - } - + } + _boxWidgetS1->AddObserver(vtkCommand::InteractionEvent, callback); callback->Delete(); _boxWidgetS1->EnabledOn(); @@ -288,8 +288,9 @@ void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable){ for(int i = 0; i < colort->GetSize(); i++){ double val[6]; colort->GetNodeValue(i, val); - //cout<< val[0]<<" "<< val[1]<<" "<AddRGBPoint(val[0], val[1], val[2], val[3]); } _newvol->Update(); + } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index 80a39b6..fb791dc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx @@ -16,6 +16,7 @@ vtkClipping3DDataViewer::vtkClipping3DDataViewer() _interpolation=false; _shade=false; + _volumerendererdata = VolumeRendererData::New(); _volumeMapper = vtkVolumeRayCastMapper::New(); _newvol = vtkVolume::New(); _volumeProperty = vtkVolumeProperty::New(); @@ -166,6 +167,19 @@ void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume) } + +bool vtkClipping3DDataViewer::GetVisibleVolumeBox() +{ + return _visibleVolumeBox; +} +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::SetVisibleVolumeBox(bool visibleBox) +{ + _visibleVolumeBox = visibleBox; +} + + + //------------------------------------------------------------------- void vtkClipping3DDataViewer::Configure_Tissue() { @@ -367,19 +381,69 @@ void vtkClipping3DDataViewer::Configure_Volume() _observerV->SetvtkVolumeRayCastMapper( _volumeMapper ); } + +void vtkClipping3DDataViewer::Configure_VolumeBox() +{ + cout<<"JPRG::vtkClipping3DDataViewer::Configure_VolumeBox()"<SetImageData(_vtkmprbasedata->GetImageData()); + + + vector *gv = this->GetGreyValuesTransferenceFVector(); + vector *op = this->GetIntensityValuesTransferenceFVector(); + + + _volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun)); + _volumerendererdata->OpacityChanged(*gv, *op); + + //_wxvtkclipping3Dview->VisibleVolumeActor( false ); + //_volumerendererdata->ShowVolume(event.IsChecked() ); + //_volumerendererdata->BoundingBoxChanged(event.IsChecked() ); +} + +void vtkClipping3DDataViewer::SetRenderer(vtkRenderer* renderer) +{ + _volumerendererdata->SetRenderer(renderer); + +} + +void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interactor) +{ + + _volumerendererdata->SetInteractor(interactor); +} + + +void vtkClipping3DDataViewer::BoxActorChanged(bool changed) +{ + vector *gv = this->GetGreyValuesTransferenceFVector(); + vector *op = this->GetIntensityValuesTransferenceFVector(); + + _volumerendererdata->ShowVolume(changed); + _volumerendererdata->OpacityChanged(*gv, *op); + _volumerendererdata->BoundingBoxChanged(changed); + +} + +void vtkClipping3DDataViewer::UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun) +{ + _volumerendererdata->SetLookUpTable((vtkLookupTable*)(ctfun)); + _volumerendererdata->OpacityChanged(gf, vf); +} + + void vtkClipping3DDataViewer::updateVolume() { if(_isRayCasting) { - cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<SetVolumeRayCastFunction(_compositeFunction); + _volumerendererdata->changeCompositeMIPFunction(0); } else if(_isMIP) { - cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<SetVolumeRayCastFunction(_compositeFunctionMIP); + _volumerendererdata->changeCompositeMIPFunction(1); } if(_interpolation) @@ -407,7 +471,7 @@ void vtkClipping3DDataViewer::Configure() { Configure_Tissue(); Configure_Volume(); - + Configure_VolumeBox(); // An outline provides context around the data. // _outlineData = vtkOutlineFilter::New(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.h index 3fa2c0d..21e5dbd 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.h @@ -17,9 +17,12 @@ #include "vtkVolume.h" #include "vtkActor.h" #include "vtkOutlineFilter.h" +#include "vtkRenderWindowInteractor.h" #include "vtkVolumeRayCastMIPFunction.h" +#include "volumerendererdata.h" + class vtkClipping3DDataViewer { public: //---------------------- @@ -62,6 +65,9 @@ public: bool GetVisibleVolume(); void SetVisibleVolume(bool visibleVolume); + bool GetVisibleVolumeBox(); + void SetVisibleVolumeBox(bool visibleBox); + void SetRepresentationType(int idTissue, bool representationType); bool GetRepresentationType(int idTissue); @@ -73,6 +79,10 @@ public: void ReadMeshVTK(char *namefile); + void Configure_VolumeBox(); + void SetInteractor(vtkRenderWindowInteractor* interactor); + void SetRenderer(vtkRenderer* renderer); + //------------------- //Getters Vectors //------------------- @@ -100,6 +110,10 @@ public: void updateVolume(); + void BoxActorChanged(bool changed); + void UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun); + + private: @@ -126,6 +140,10 @@ private: vtkMPRBaseData *_vtkmprbasedata; bool _visibleVolume; + + bool _visibleVolumeBox; + + bool _representationType[VTKMPRDATA_MAXTISSUE]; bool _visibleTissue[VTKMPRDATA_MAXTISSUE]; vtkActor *_tissue[VTKMPRDATA_MAXTISSUE]; @@ -146,6 +164,8 @@ private: bool _isMIP; bool _interpolation; bool _shade; + + VolumeRendererData* _volumerendererdata; }; #endif /*VTKCLIPPING3DDATAVIEWER_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h index 57b9ccf..04408f9 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h @@ -3,14 +3,14 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_ViewerWidget.h,v $ Language: C++ - Date: $Date: 2010/10/29 07:51:06 $ - Version: $Revision: 1.10 $ + Date: $Date: 2011/06/29 09:37:52 $ + Version: $Revision: 1.11 $ Copyright: (c) 2002, 2003 License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ @@ -49,7 +49,7 @@ class wxMaracas_ViewerWidget : public wxPanel { public: - + //------------------------------------------------------------------------------------------------------------ // Constructors & Destructors //------------------------------------------------------------------------------------------------------------ @@ -85,22 +85,23 @@ int mType; bool minternalVtkmprbasedata; - vtkMPRBaseData *mvtkmprbasedata; + vtkMPRBaseData *mvtkmprbasedata; + wxVtk2DBaseView *mvtk2Dbaseview; - wxVtkMPR2DView *mvtkmpr2Dview_X; - wxVtkMPR2DView *mvtkmpr2Dview_Y; - wxVtkMPR2DView *mvtkmpr2Dview_Z; + wxVtkMPR2DView *mvtkmpr2Dview_X; + wxVtkMPR2DView *mvtkmpr2Dview_Y; + wxVtkMPR2DView *mvtkmpr2Dview_Z; wxWidgetMesure2D_Plane_in_MPR *mwidgetMesure; vtkPlane2DView *mvtkplane2Dview; - wxSphereView *mwxsphereview; + wxSphereView *mwxsphereview; wxVtkClipping3DView *mwxvtkclipping3Dview; wxVtk3DBaseView *mwxvtk3Dbaseview_Clipping3D; wxVtkMPR3DView *mwxvtkmpr3Dview; - vtkMPR3DDataViewer *vtkmpr3Ddataviewer; + vtkMPR3DDataViewer *vtkmpr3Ddataviewer; }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index db0a469..c108524 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -5,6 +5,7 @@ wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview) { + _wxvtk3Dbaseview = wxvtk3Dbaseview; _vtkclipping3Ddataviewer = NULL; _wxvtkclipping3DviewCntrlPanel = NULL; @@ -30,14 +31,13 @@ void wxVtkClipping3DView::SetVisibleBoxSurface(bool visible) } } //------------------------------------------------------------------- -void wxVtkClipping3DView::SetVisibleBoxVolume(bool visible) +void wxVtkClipping3DView::VisibleVolumeBoxActor(bool visible) { - if (_boxWidgetVolume!=NULL){ - if (visible==true){ - _boxWidgetVolume->On(); - } else { - _boxWidgetVolume->Off(); - } + if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() ){ + VisibleVolumeActor(!visible); + _vtkclipping3Ddataviewer->BoxActorChanged(visible); + _vtkclipping3Ddataviewer->SetVisibleVolumeBox(visible); + _vtkclipping3Ddataviewer->SetVisibleVolume(!visible); } } //------------------------------------------------------------------- @@ -112,6 +112,12 @@ void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){ } _vtkclipping3Ddataviewer->SetVisibleVolume(visVolume); } + else if(visVolume==false && _vtkclipping3Ddataviewer->GetVisibleVolumeBox() == true) + { + _vtkclipping3Ddataviewer->BoxActorChanged(false); + _vtkclipping3Ddataviewer->SetVisibleVolumeBox(false); + } + } //------------------------------------------------------------------- wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*) @@ -144,7 +150,7 @@ void wxVtkClipping3DView::Configure(){ int i; for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) { - _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverS(i) ); + _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverS(i) ); } @@ -211,6 +217,16 @@ void wxVtkClipping3DView::Configure(){ // clips out objects behind the plane. This way only what is drawn // between the planes is actually rendered. _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange(); + + + + + //cout<<"JPRG::wxVtkClipping3DView::SetVtkClipping3DDataViewer::GetRenderer()::"<GetWxvtk3Dbaseview()->GetRenderer()<GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()<SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer()); + _vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()); + } //------------------------------------------------------------------- void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer) @@ -242,4 +258,10 @@ void wxVtkClipping3DView::SetShade(bool active) _vtkclipping3Ddataviewer->updateVolume(); } +void wxVtkClipping3DView::UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun) +{ + _vtkclipping3Ddataviewer->UpdateVolumeBox(gf, vf, ctfun); +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h index cdff5f4..7f03872 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h @@ -5,6 +5,7 @@ #include "wxVtk3DBaseView.h" #include "wx/wx.h" #include "vtkBoxWidget.h" + //#include "wxVtkClipping3DViewCntrlPanel.h" //class wxVtkClipping3DViewCntrlPanel; @@ -24,6 +25,9 @@ public: void VisibleActor(int idTissue, bool visTissue); void VisibleVolumeActor( bool visVolume ); + + void VisibleVolumeBoxActor(bool visible); + void SetVisibleBoxSurface(bool visible); void SetVisibleBoxVolume(bool visible); void SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation ); @@ -35,6 +39,8 @@ public: void SetInterpolation(bool active); void SetShade(bool active); + void UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun); + private: wxVtk3DBaseView *_wxvtk3Dbaseview; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx index 44753e2..442fa09 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx @@ -24,11 +24,11 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w _surfD = new wxRadioButton(panel,-1,_T("D")); - //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume //wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol")); wxCheckBox *ckBoxSurface = new wxCheckBox(panel,-1,_T("Surface Box")); - - //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume //wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box")); _color = new wxButton(panel,-1,_T("")); @@ -55,24 +55,24 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w _isoValueSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT ); _isoValueSpin->SetRange(1,8); _isoValueSpin->SetValue(5); - Connect(_isoValueSpin->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin ); + Connect(_isoValueSpin->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin ); wxButton *btnSTL = new wxButton(panel,-1,_T("Create STL File")); wxButton *btnSaveRaw = new wxButton(panel,-1,_T("Save Raw Volume")); - //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume //wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions")); - Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL ); - Connect(btnSaveRaw->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume ); - - //RaC 03-2010 Divides in two panels thje last tab Surface/Volume - //Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions ); + Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL ); + Connect(btnSaveRaw->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume ); + + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions ); wxButton *btnMeshVTKLoad = new wxButton(panel,-1,_T("Load Mesh")); - Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad ); + Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad ); /* @@ -89,8 +89,8 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w // ckVolum->Enable(false); ckBoxSurface->SetValue(false); - - + + //ckBoxVolume->SetValue(false); @@ -107,7 +107,7 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w // _positionY->SetSize(400,20); // _positionZ->SetSize(400,20); - //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume //Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleVolume ); //Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume ); @@ -146,7 +146,7 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w //wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10); // JPRx //wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10); // JPRx - //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume //sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0); //sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); //sizerH0->Add( ckBoxVolume , 1, wxALL|wxEXPAND, 0); @@ -177,12 +177,12 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w sizerH2->Add( _visible , 1, wxALL|wxEXPAND, 0); sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - + sizerH2->Add( _wireFrameRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0); sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); sizerH2->Add( _surfaceRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0); sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - + sizerH2->Add( _opacity , 1, wxALL|wxEXPAND, 0); @@ -298,8 +298,8 @@ void wxVtkClipping3DViewCntrlPanel::OnSurface(wxCommandEvent& event) _opacity->SetValue( (int)(tmpActor->GetProperty()->GetOpacity()*100) ); // Representation Type WireFrame / Surface - _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue)); - _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue)); + _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue)); + _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue)); // isoValue int isoValue= (int)(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(idTissue)); @@ -342,7 +342,8 @@ void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxSurface(wxCommandEvent& event) //------------------------------------------------------------------- void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event) { - _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() ); + //_wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() ); + this->BoundingBoxChanged(event.IsChecked()); _wxvtkclipping3Dview->Refresh(); } //------------------------------------------------------------------- @@ -354,7 +355,7 @@ void wxVtkClipping3DViewCntrlPanel::OnColor(wxCommandEvent& event) // EED 17 Janvier 2007 wxColourDialog dlgColour(this); // dlgColour.ShowModal(); - if( dlgColour.ShowModal( ) == wxID_OK ) + if( dlgColour.ShowModal( ) == wxID_OK ) { vtkActor *tmpActor; tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue); @@ -431,7 +432,7 @@ void wxVtkClipping3DViewCntrlPanel::OnIsoValue(wxScrollEvent& event) _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetIsovalue(idTissue,isoValue); // wxString tmpStr; // tmpStr.Printf("%d",isoValue); - + _wxvtkclipping3Dview->Refresh(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh @@ -453,10 +454,10 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL(wxCommandEvent& event) wxString dirSTL = wxGetHomeDir( ) ; wxFileDialog dialog( this, _T("Choose a directory..."), dirSTL , _T(""), _T("*.*"), wxSAVE ); - if( dialog.ShowModal( ) == wxID_OK ) + if( dialog.ShowModal( ) == wxID_OK ) { - - + + // ------------------------------------------------------------------------ // 1. GENERATE STL FILES // ------------------------------------------------------------------------ @@ -485,7 +486,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL(wxCommandEvent& event) writer->Write(); writer->Delete(); - + filtro->Delete(); cpd->Delete(); pdcf->Delete(); @@ -525,7 +526,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume(wxCommandEvent& event) //------------------------------------------------------------------- void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) { - + int /*i=0,*/ xi,yi,r,g,b; // JPRx vtkColorTransferFunction* ctfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetColorTransferenceFunction(); vtkPiecewiseFunction* tfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTransferencefunction(); @@ -544,18 +545,18 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) */ /* - MMLR BORRAME + MMLR BORRAME wxFileDialog dialog(this, _T("Choose a file"), _T("c:/Maracas_configuration"),_T(""), _T("*.MarVolConf"), wxOPEN); if (dialog.ShowModal() == wxID_OK) { _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions( (char *)dialog.GetPath().c_str() ); - - + + } */ HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata,1); - // + // // put in a method // int tfSize=gtf->size(); @@ -570,7 +571,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) hDlg->addPointToTransferenceFunction(g,in*100); i++; } - + } int ctfSize=rctf->size(); @@ -599,12 +600,12 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) // when the user had changed the transference Function // if(hDlg->ShowModal()== wxID_OK ) - { + { // -- vtkPiecewiseFunction -- tfun->RemoveAllPoints(); gtf->clear(); itf->clear(); - + int nTFPoints=hDlg->getSizeTransferenceFunction(); int i=0; while(ipush_back(xi); itf->push_back(yi/100.0); i++; - } + } // -- vtkColorTransferFunction -- ctfun->RemoveAllPoints (); //clean colors @@ -624,7 +625,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) greyctf->clear(); int nCTFpoints=hDlg->getSizeBarColor(); - i=0; + i=0; while(igetDataBarColorPoint(i,xi,r,g,b); @@ -642,7 +643,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) _wxvtkclipping3Dview->Refresh(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); - + /* volumeMapper->Update(); newvol->Update(); @@ -661,12 +662,12 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) double in2=(*itf)[i]; tfun->AddPoint( grey1 , in2 ); } - + // -- vtkColorTransferFunction -- ctfun->RemoveAllPoints (); - + i=0; - size=greyctf->size(); + size=greyctf->size(); for(i=0;iAddRGBPoint(grey2,red,green,blue); } - + //--------------------------------- // Refreshing and sending the event //--------------------------------- @@ -683,13 +684,13 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) _wxvtkclipping3Dview->Refresh(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); - + /* volumeMapper->Update(); newvol->Update(); */ } - + } //destroy the dialog hDlg->Destroy(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.h index fb00b2f..2c61983 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.h @@ -2,9 +2,10 @@ #define WXVTKCLIPPING3DVIEWCNTRLPANEL_H_ #include "wxVtkClipping3DView.h" +#include "volumerendererdata.h" #include "wx/wx.h" -class wxVtkClipping3DViewCntrlPanel: public wxPanel +class wxVtkClipping3DViewCntrlPanel: public wxPanel, VolumeRendererData { public: wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx index feafc6e..083b1da 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx @@ -18,8 +18,8 @@ wxVtkClipping3DViewVolCntrlPanel::wxVtkClipping3DViewVolCntrlPanel(wxWindow *par _wxvtkclipping3Dview = wxvtkclipping3Dview; - wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Volume")); - wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box")); + ckVolum = new wxCheckBox(panel,-1,_T("Volume")); + ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box")); ckBoxVolume->Disable(); @@ -84,6 +84,9 @@ wxVtkClipping3DViewVolCntrlPanel::wxVtkClipping3DViewVolCntrlPanel(wxWindow *par rbRayCasting->SetValue(true); +// _volumerendererdata = VolumeRendererData::New(); +// _volumerendererdata->SetImageData(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData()); + } //------------------------------------------------------------------- wxVtkClipping3DViewVolCntrlPanel::~wxVtkClipping3DViewVolCntrlPanel() @@ -97,24 +100,44 @@ void wxVtkClipping3DViewVolCntrlPanel::Refresh() //------------------------------------------------------------------- void wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume(wxCommandEvent& event) { - cout<<"JPRG::wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume::event_value::"<VisibleVolumeActor( event.IsChecked() ); - if(event.IsChecked()) - { - rbRayCasting->Enable(); - rbMIP->Enable(); - ckInterpolation->Enable(); - ckShade->Enable(); - } - else - { - rbRayCasting->Disable(); - rbMIP->Disable(); - ckInterpolation->Disable(); - ckShade->Disable(); - } + + + + if(event.IsChecked()) + { + ckBoxVolume->Enable(); + } + else{ + ckBoxVolume->Disable(); + } + + // _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetRenderer()->RemoveAllViewProps(); + + + + _wxvtkclipping3Dview->VisibleVolumeActor( event.IsChecked() ); + if(event.IsChecked()) + { + rbRayCasting->Enable(); + rbMIP->Enable(); + ckInterpolation->Enable(); + ckShade->Enable(); + } + else + { + rbRayCasting->Disable(); + rbMIP->Disable(); + ckInterpolation->Disable(); + ckShade->Disable(); + if(ckBoxVolume->IsChecked()) + { + ckBoxVolume->SetValue(false); + } + } + _wxvtkclipping3Dview->Refresh(); + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); } @@ -122,8 +145,32 @@ void wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume(wxCommandEvent& event) //------------------------------------------------------------------- void wxVtkClipping3DViewVolCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event) { - _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() ); - _wxvtkclipping3Dview->Refresh(); + + //cout<<"JPRG::wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume::event_value::"<Disable(); + // rbMIP->Disable(); + ckInterpolation->Disable(); + ckShade->Disable(); + } + else + { + //rbRayCasting->Enable(); + //rbMIP->Enable(); + ckInterpolation->Enable(); + ckShade->Enable(); + + } + + _wxvtkclipping3Dview->VisibleVolumeBoxActor(event.IsChecked()); + + _wxvtkclipping3Dview->Refresh(); + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); + } //EED 22 Fevrier 2007 @@ -244,6 +291,16 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even // Refreshing and sending the event //--------------------------------- //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions(); + + + //test + + + // _volumerendererdata->OpacityChanged(*gtf, *itf); + _wxvtkclipping3Dview->UpdateVolumeBox(*gtf, *itf, ctfun); + +//test end + _wxvtkclipping3Dview->Refresh(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); @@ -251,6 +308,8 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even /* volumeMapper->Update(); newvol->Update(); + + */ } else { if(hDlg->getRefreshed()) @@ -285,10 +344,14 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even // Refreshing and sending the event //--------------------------------- //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions(); - _wxvtkclipping3Dview->Refresh(); + + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); + + _wxvtkclipping3Dview->Refresh(); + /* volumeMapper->Update(); newvol->Update(); @@ -297,6 +360,8 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even } //destroy the dialog + + hDlg->Destroy(); } @@ -304,6 +369,10 @@ void wxVtkClipping3DViewVolCntrlPanel::OnRayCastingActive(wxCommandEvent& eve //If Ray Casting is active, others options are disabled. Only RayCasting is true _wxvtkclipping3Dview->SetRayCasting(true); _wxvtkclipping3Dview->SetMIPActive(false); + + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); _wxvtkclipping3Dview->Refresh(); } @@ -312,18 +381,31 @@ void wxVtkClipping3DViewVolCntrlPanel::OnMIPActive(wxCommandEvent& event){ _wxvtkclipping3Dview->SetMIPActive(true); _wxvtkclipping3Dview->SetRayCasting(false); + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); + _wxvtkclipping3Dview->Refresh(); } void wxVtkClipping3DViewVolCntrlPanel::OnInterpolationActive(wxCommandEvent& event){ + + _wxvtkclipping3Dview->SetInterpolation(event.IsChecked()); + + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); _wxvtkclipping3Dview->Refresh(); } void wxVtkClipping3DViewVolCntrlPanel::OnShadeActive(wxCommandEvent& event){ + + _wxvtkclipping3Dview->SetShade(event.IsChecked()); + + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); _wxvtkclipping3Dview->Refresh(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h index a0185b6..2a5ebbe 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h @@ -3,6 +3,7 @@ #include "wxVtkClipping3DView.h" #include "wx/wx.h" +#include "volumerendererdata.h" class wxVtkClipping3DViewVolCntrlPanel: public wxPanel { @@ -22,10 +23,14 @@ public: private: wxVtkClipping3DView *_wxvtkclipping3Dview; + wxRadioButton *rbRayCasting; wxRadioButton *rbMIP; wxCheckBox *ckInterpolation; wxCheckBox *ckShade; + wxCheckBox *ckVolum; + wxCheckBox *ckBoxVolume; + protected: