]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorreyes <reyes>
Fri, 18 Mar 2011 17:20:23 +0000 (17:20 +0000)
committerreyes <reyes>
Fri, 18 Mar 2011 17:20:23 +0000 (17:20 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx

index 800f8be546d499af73ae2bef0223cb0deb87a55e..80a39b6301a652edb860a44d3f34b61af4c30341 100644 (file)
@@ -19,6 +19,9 @@ vtkClipping3DDataViewer::vtkClipping3DDataViewer()
     _volumeMapper = vtkVolumeRayCastMapper::New();
     _newvol = vtkVolume::New();
     _volumeProperty = vtkVolumeProperty::New();
+    _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
+        _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
+
 }
 //-------------------------------------------------------------------
 vtkClipping3DDataViewer::~vtkClipping3DDataViewer()
@@ -313,30 +316,24 @@ void vtkClipping3DDataViewer::Configure_Volume()
 
        // EED 13/03/2011
 
-  _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
-       vtkVolumeRayCastMIPFunction* _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
 
 
  // _volumeMapper = vtkVolumeRayCastMapper::New();
        _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
 
-if(_isRayCasting)
-{
-    cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<<endl;
+
+
     _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
 
-}
-else if(_isMIP)
-{
-    cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<<endl;
-    _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
-}
+
+   // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
 
 //
 
        _volumeMapper->SetClippingPlanes( _volumePlanes );
        _volumeMapper->AutoAdjustSampleDistancesOn();
 
+    _volumeProperty->SetInterpolationTypeToNearest();
     //_volumeProperty = vtkVolumeProperty::New();
        _volumeProperty->SetColor(_ctfun);
        _volumeProperty->SetScalarOpacity( _tfun );
@@ -345,23 +342,7 @@ else if(_isMIP)
 
        _volumeProperty->DisableGradientOpacityOn();
 
-if(_interpolation)
-{
-    _volumeProperty->SetInterpolationTypeToLinear();
-}
-else
-{
-    _volumeProperty->SetInterpolationTypeToNearest();
-}
 
-if(_shade)
-{
-    _volumeProperty->ShadeOn();
-}
-else
-{
-    _volumeProperty->ShadeOff();
-}
 
 //     _
 
@@ -386,6 +367,40 @@ else
        _observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
 }
 
+void vtkClipping3DDataViewer::updateVolume()
+{
+
+    if(_isRayCasting)
+    {
+        cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<<endl;
+        _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+    }
+    else if(_isMIP)
+    {
+        cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<<endl;
+
+        _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
+    }
+
+    if(_interpolation)
+    {
+        _volumeProperty->SetInterpolationTypeToLinear();
+    }
+    else
+    {
+        _volumeProperty->SetInterpolationTypeToNearest();
+    }
+
+    if(_shade)
+    {
+        _volumeProperty->ShadeOn();
+    }
+    else
+    {
+        _volumeProperty->ShadeOff();
+    }
+
+}
 
 //-------------------------------------------------------------------
 void vtkClipping3DDataViewer::Configure()
index 444b972091e5f472eb11161b92e048927706b27a..3fa2c0dddf544114fd9b6bf2242588346f6a88d4 100644 (file)
@@ -97,6 +97,7 @@ public:
        void                        SetMIPActive(bool active);
     void                        SetInterpolation(bool active);
     void                        SetShade(bool active);
+    void                        updateVolume();
 
 
 
@@ -116,7 +117,7 @@ private:
        /// Volume
        vtkPiecewiseFunction                            *_tfun;
        vtkColorTransferFunction                        *_ctfun;
-       vtkVolumeRayCastCompositeFunction       *_compositeFunction;
+//     vtkVolumeRayCastCompositeFunction       *_compositeFunction;
        vtkPlanes                                                       *_volumePlanes;
        vtkVolumeRayCastMapper                          *_volumeMapper;
        vtkVolumeProperty                                       *_volumeProperty;
@@ -138,6 +139,9 @@ private:
        std::vector<double>                                     blueColorsOfColorTransferenceFVector;
        std::vector<double>                                     greyValueColorsOfColorTransferenceFVector;
 
+       vtkVolumeRayCastCompositeFunction   *_compositeFunction;
+       vtkVolumeRayCastMIPFunction         *_compositeFunctionMIP ;
+
        bool _isRayCasting;
     bool _isMIP;
        bool _interpolation;
index 9a984c58bf26306e8fd105ccdbdd195024581c6d..db0a4698da361ab97bd7273ca366d691418df3aa 100644 (file)
@@ -221,25 +221,25 @@ void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vt
 void wxVtkClipping3DView::SetRayCasting(bool active)
 {
     _vtkclipping3Ddataviewer->SetRayCasting(active);
-    _vtkclipping3Ddataviewer->Configure();
+    _vtkclipping3Ddataviewer->updateVolume();
 }
 
 void wxVtkClipping3DView::SetMIPActive(bool active)
 {
     _vtkclipping3Ddataviewer->SetMIPActive(active);
-    _vtkclipping3Ddataviewer->Configure();
+    _vtkclipping3Ddataviewer->updateVolume();
 }
 
 void wxVtkClipping3DView::SetInterpolation(bool active)
 {
     _vtkclipping3Ddataviewer->SetInterpolation(active);
-    _vtkclipping3Ddataviewer->Configure();
+    _vtkclipping3Ddataviewer->updateVolume();
 }
 
 void wxVtkClipping3DView::SetShade(bool active)
 {
     _vtkclipping3Ddataviewer->SetShade(active);
-    _vtkclipping3Ddataviewer->Configure();
+    _vtkclipping3Ddataviewer->updateVolume();
 }