]> Creatis software - creaMaracasVisu.git/commitdiff
#2748 creaMaracas Visu Feature New Normal - Viewer with baclground black
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 9 Nov 2015 14:37:47 +0000 (15:37 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 9 Nov 2015 14:37:47 +0000 (15:37 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h

index 0e301e2d79a1cbfa8590a6bd525682c5cb480a42..335af08b1429898e41ed6ae1a151dc76840cee95 100644 (file)
@@ -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);
 }
index 013770adfd86282ccef0ebf10887ba9d1af7763f..75d6c1e7a346018d19f30492560f01ee9c6ff113 100644 (file)
@@ -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);
                
index e67cc22c0b5b7b4898c38685eaf9de4657c8f699..8776906760f76410b6d6a8cff3b1f8af020fa988 100644 (file)
@@ -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; i<size; i++)
                        {
+                               printf(" wxVtkMPR3DView::VisibleImageActor %d\n" , i);
                                tmpCollection->AddItem ( (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
+       
+}
 
 
index 44cced6445214d0c5494c361569fee4a33fde1c0..f02d7d89c8dec2ae57ce64dedc16d2d9765d12a5 100644 (file)
@@ -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);
 
index a09c6598606c1c1d0f2e1f16e35012af6428d3c6..47367ce30a939e03e524d35209012d508944409b 100644 (file)
@@ -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);
+       }
+}
+
+
index d70dc1c77411a2d90a7a93c0904e347ff6a9de08..809c9dd783a8620d9705404f1b7a4f5478dfccac 100644 (file)
@@ -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: