_volumeMapper = vtkVolumeRayCastMapper::New();
_newvol = vtkVolume::New();
_volumeProperty = vtkVolumeProperty::New();
+ _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
+ _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
+
}
//-------------------------------------------------------------------
vtkClipping3DDataViewer::~vtkClipping3DDataViewer()
// 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 );
_volumeProperty->DisableGradientOpacityOn();
-if(_interpolation)
-{
- _volumeProperty->SetInterpolationTypeToLinear();
-}
-else
-{
- _volumeProperty->SetInterpolationTypeToNearest();
-}
-if(_shade)
-{
- _volumeProperty->ShadeOn();
-}
-else
-{
- _volumeProperty->ShadeOff();
-}
// _
_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()
void SetMIPActive(bool active);
void SetInterpolation(bool active);
void SetShade(bool active);
+ void updateVolume();
/// Volume
vtkPiecewiseFunction *_tfun;
vtkColorTransferFunction *_ctfun;
- vtkVolumeRayCastCompositeFunction *_compositeFunction;
+// vtkVolumeRayCastCompositeFunction *_compositeFunction;
vtkPlanes *_volumePlanes;
vtkVolumeRayCastMapper *_volumeMapper;
vtkVolumeProperty *_volumeProperty;
std::vector<double> blueColorsOfColorTransferenceFVector;
std::vector<double> greyValueColorsOfColorTransferenceFVector;
+ vtkVolumeRayCastCompositeFunction *_compositeFunction;
+ vtkVolumeRayCastMIPFunction *_compositeFunctionMIP ;
+
bool _isRayCasting;
bool _isMIP;
bool _interpolation;
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();
}