From: Eduardo DAVILA Date: Mon, 9 Nov 2015 14:37:47 +0000 (+0100) Subject: #2748 creaMaracas Visu Feature New Normal - Viewer with baclground black X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cf42d2bd2f87434922bf9f6f3f520b3f8ad2ba64;p=creaMaracasVisu.git #2748 creaMaracas Visu Feature New Normal - Viewer with baclground black --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index 0e301e2..335af08 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx @@ -35,18 +35,18 @@ vtkClipping3DDataViewer::vtkClipping3DDataViewer() _visibleTissue[i] = false; _representationType[i] = true; } - _visibleVolume=false; - _isRayCasting=true; - _isMIP=false; - _interpolation=false; - _shade=false; + _visibleVolume = false; + _isRayCasting = true; + _isMIP = false; + _interpolation = false; + _shade = false; - _volumerendererdata = VolumeRendererData::New(); - _volumeMapper = vtkVolumeRayCastMapper::New(); - _newvol = vtkVolume::New(); - _volumeProperty = vtkVolumeProperty::New(); - _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); - _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New(); + _volumerendererdata = VolumeRendererData::New(); + _volumeMapper = vtkVolumeRayCastMapper::New(); + _newvol = vtkVolume::New(); + _volumeProperty = vtkVolumeProperty::New(); + _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); + _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New(); } //------------------------------------------------------------------- @@ -474,11 +474,14 @@ void vtkClipping3DDataViewer::Configure() Configure_VolumeBox(); // An outline provides context around the data. // - _outlineData = vtkOutlineFilter::New(); + _outlineData = vtkOutlineFilter::New(); _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); - _mapOutline = vtkPolyDataMapper::New(); - _mapOutline->SetInput(_outlineData->GetOutput()); - _outline = vtkActor::New(); + _mapOutline = vtkPolyDataMapper::New(); + +//EED 4 nov 2015 Estelle +// _mapOutline->SetInput(_outlineData->GetOutput()); + + _outline = vtkActor::New(); _outline->SetMapper(_mapOutline); _outline->GetProperty()->SetColor(0,0,0); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx index 013770a..75d6c1e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx @@ -157,6 +157,12 @@ void wxVtk3DBaseView::Configure() _aRenderer->GradientBackgroundOn(); _aRenderer->SetBackground( 0.33 , 0.33 , 0.33 ); _aRenderer->SetBackground2( 0.66 , 0.66 , 0.66 ); + + + +// _aRenderer->GradientBackgroundOff(); +// _aRenderer->SetBackground(0,0,0 ); + SetStereo(0); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index e67cc22..8776906 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -195,7 +195,10 @@ void wxVtkMPR3DView::Configure() // Actors are added to the renderer. vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); + + _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); + // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0) ); // _saggital // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1) ); // _axial // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2) ); // _coronal @@ -557,7 +560,8 @@ vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer() //------------------------------------------------------------------- wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*) { - if(_wxvtk3Dbaseview==NULL){ + if(_wxvtk3Dbaseview==NULL) + { throw "wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL"; } return _wxvtk3Dbaseview; @@ -585,12 +589,18 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){ // 4. Putting again the originals actors // 5. Refresh +//EED 4 nov 2015 (For Estelle) +// This works in ViewerNV with nTymeView=6 +// Because the others modules (5) generate also more actors with an OutLineFilter -> Actor +//showOutlineActor(false); + // step 1, step 2 vtkActorCollection *tmpCollection = vtkActorCollection::New(); vtkActorCollection *collectionActors = _wxvtk3Dbaseview->GetRenderer()->GetActors(); int i,size=collectionActors->GetNumberOfItems(); for (i=0; iAddItem ( (vtkActor*)collectionActors->GetItemAsObject(0) ); _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); } // for @@ -646,6 +656,7 @@ void wxVtkMPR3DView::VisiblePlaneWidget( bool visible ) //CPR: Method added 30 Nov 2009 void wxVtkMPR3DView::showOutlineActor(bool value) { + vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); if(value == true) { @@ -655,6 +666,7 @@ void wxVtkMPR3DView::showOutlineActor(bool value) { _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor ); } + } //------------------------------------------------------------------- @@ -812,7 +824,6 @@ void wxVtkMPR3DView::TestLoic2() vtkPlane *slicePlane = vtkPlane::New(); this->_planeWidget->GetPlane( slicePlane ); - vtkCutter* sliceCutter = vtkCutter::New(); vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); sliceCutter->SetInput( vtkimagedata ); @@ -821,7 +832,6 @@ void wxVtkMPR3DView::TestLoic2() //EED // vtkLookupTable *lut = BuildHueWeightBaseMap(); - vtkPolyDataMapper *slice = vtkPolyDataMapper::New(); slice->SetInput( sliceCutter->GetOutput() ); double range[2]; @@ -841,12 +851,9 @@ void wxVtkMPR3DView::TestLoic2() contourMapper->SetScalarRange( range ); // contourMapper->SetLookupTable( lut ); - vtkActor *contourActor = vtkActor::New(); contourActor->SetMapper( contourMapper ); - - // The usual rendering stuff. vtkCamera *camera = vtkCamera::New(); camera->SetPosition(1,1,1); @@ -872,5 +879,25 @@ void wxVtkMPR3DView::TestLoic2() iren->Start(); } +//------------------------------------------------------------------- +void wxVtkMPR3DView::SetBackGroundType(int type) +{ + if (_wxvtk3Dbaseview!=NULL) + { + if (type==0) + { + _wxvtk3Dbaseview->GetRenderer()->GradientBackgroundOff(); + _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0 , 0 , 0 ); + } // if type + if (type==1) + { + _wxvtk3Dbaseview->GetRenderer()->GradientBackgroundOn(); + _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 ); + _wxvtk3Dbaseview->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 ); + } // if type + _wxvtk3Dbaseview->Refresh(); + }// if _wxvtk3Dbaseview + +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h index 44cced6..f02d7d8 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h @@ -53,6 +53,7 @@ public: virtual void Refresh(); virtual void RefreshView(); virtual void Configure(); + void SetBackGroundType(int type); void SetVtkMPR3DDataViewer( vtkMPR3DDataViewer *vtkmpr3Ddataviewer ); wxPanel* CreateControlPanel(wxWindow *parent, bool align); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx index a09c659..47367ce 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx @@ -66,10 +66,10 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV 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"));; + _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(false); @@ -84,6 +84,13 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV ////EED 05Nov2012 _ckBox_BW_Color_Plane->SetValue(true); _ckBoxPlane->SetValue(false); + _ckBoxOutline= new wxCheckBox(panel,-1,_T("Outline")); + _ckBoxOutline->SetValue(true); + + + _ckBoxBackGroundBlack= new wxCheckBox(panel,-1,_T("Background Black"));; + _ckBoxBackGroundBlack->SetValue(false); + _positionX->SetSize(400,20); _positionY->SetSize(400,20); _positionZ->SetSize(400,20); @@ -104,25 +111,26 @@ 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(_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(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(_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 ); + Connect(_ckBoxOutline->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnOutline ); + Connect(_ckBoxBackGroundBlack->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack ); wxFlexGridSizer *sizer; @@ -173,8 +181,14 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); sizerH5->Add( _cbStereo, 1, wxALL|wxEXPAND, 0); + sizerH6 = new wxFlexGridSizer(1); + sizerH6->Add( _ckBoxOutline , 1, wxALL|wxEXPAND, 0); + sizerH6->Add( _ckBoxBackGroundBlack , 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); } else { @@ -662,3 +676,25 @@ void wxVtkMPR3DViewCntrlPanel::SetVisiblePlane(bool value) _ckBoxPlane->SetValue(value); _wxvtkmpr3Dview->VisiblePlaneWidget(value); } + + +//------------------------------------------------------------------- +void wxVtkMPR3DViewCntrlPanel::OnOutline(wxCommandEvent& event) +{ + _wxvtkmpr3Dview->showOutlineActor( _ckBoxOutline->GetValue() ); + _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->Refresh(); + +} + +//------------------------------------------------------------------- +void wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack(wxCommandEvent& event) +{ + if (_ckBoxBackGroundBlack->GetValue()==true) + { + _wxvtkmpr3Dview->SetBackGroundType(0); + } else { + _wxvtkmpr3Dview->SetBackGroundType(1); + } +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h index d70dc1c..809c9dd 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h @@ -54,6 +54,8 @@ public: void OnVisibleFreePlaneInteraction(wxCommandEvent& event); void OnSetStereo(wxCommandEvent& event); void OnFreePlanesOrtho(wxCommandEvent& event); + void OnOutline(wxCommandEvent& event); + void OnBackGroundBlack(wxCommandEvent& event); virtual void Refresh(); void UpdateControlPanel(); @@ -105,6 +107,9 @@ private: wxComboBox *_cbStereo; + wxCheckBox *_ckBoxOutline; + wxCheckBox *_ckBoxBackGroundBlack; + protected: