]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx
no message
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkClipping3DDataViewer.cxx
index 80a39b6301a652edb860a44d3f34b61af4c30341..e5b8804e0550d26b847db84dc98c057a63ad86ec 100644 (file)
@@ -16,6 +16,7 @@ vtkClipping3DDataViewer::vtkClipping3DDataViewer()
        _interpolation=false;
        _shade=false;
 
+    _volumerendererdata = VolumeRendererData::New();
     _volumeMapper = vtkVolumeRayCastMapper::New();
     _newvol = vtkVolume::New();
     _volumeProperty = vtkVolumeProperty::New();
@@ -165,6 +166,15 @@ void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume)
        _visibleVolume = visiblevolume;
 }
 
+bool vtkClipping3DDataViewer::GetVisibleVolumeBox()
+{
+       return _visibleVolumeBox;
+}
+//-------------------------------------------------------------------
+void vtkClipping3DDataViewer::SetVisibleVolumeBox(bool visibleBox)
+{
+       _visibleVolumeBox = visibleBox;
+}
 
 //-------------------------------------------------------------------
 void vtkClipping3DDataViewer::Configure_Tissue()
@@ -255,6 +265,8 @@ void vtkClipping3DDataViewer::Configure_Volume()
        double range[2];
        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
@@ -367,19 +379,73 @@ void vtkClipping3DDataViewer::Configure_Volume()
        _observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
 }
 
+
+void vtkClipping3DDataViewer::Configure_VolumeBox()
+{
+    cout<<"EED::JPRG::vtkClipping3DDataViewer::Configure_VolumeBox() start"<<endl;
+
+       _volumerendererdata->SetImageData(_vtkmprbasedata->GetImageData());
+
+
+    vector<double> *gv = this->GetGreyValuesTransferenceFVector();
+    vector<double> *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"<<endl;
+}
+
+void vtkClipping3DDataViewer::SetRenderer(vtkRenderer* renderer)
+{
+    _volumerendererdata->SetRenderer(renderer);
+
+}
+
+void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interactor)
+{
+
+    _volumerendererdata->SetInteractor(interactor);
+}
+
+
+void vtkClipping3DDataViewer::BoxActorChanged(bool changed)
+{
+    vector<double> *gv = this->GetGreyValuesTransferenceFVector();
+    vector<double> *op = this->GetIntensityValuesTransferenceFVector();
+
+   _volumerendererdata->ShowVolume(changed);
+    _volumerendererdata->OpacityChanged(*gv, *op);
+    _volumerendererdata->BoundingBoxChanged(changed);
+
+}
+
+void vtkClipping3DDataViewer::UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun)
+{
+        _volumerendererdata->SetLookUpTable((vtkLookupTable*)(ctfun));
+        _volumerendererdata->OpacityChanged(gf, vf);
+}
+
+
 void vtkClipping3DDataViewer::updateVolume()
 {
 
     if(_isRayCasting)
     {
-        cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<<endl;
         _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+        _volumerendererdata->changeCompositeMIPFunction(0);
     }
     else if(_isMIP)
     {
-        cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<<endl;
-
         _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
+        _volumerendererdata->changeCompositeMIPFunction(1);
     }
 
     if(_interpolation)
@@ -407,7 +473,7 @@ void vtkClipping3DDataViewer::Configure()
 {
        Configure_Tissue();
        Configure_Volume();
-
+    Configure_VolumeBox();
   // An outline provides context around the data.
   //
        _outlineData = vtkOutlineFilter::New();