[vtkusers] Updating color transfer function for GPU volume

Shashwath T.R. trshash at gmail.com
Tue Dec 21 01:19:37 EST 2010


Hi Eric,

Try removing all points and modifying the same color transfer function,
instead of creating a new one... It seems to work for us.

Shash

On Tue, Dec 21, 2010 at 6:33 AM, Eric Foo <foo at iastate.edu> wrote:

> Hi all,
>
> Does anyone know how I can update the color transfer function for a
> vtkOpenGLGPUVolumeRayCastMapper type volume?
>
> The volume is constructed like so:
>
> _volumeProperty = vtkVolumeProperty::New();
> _volumeProperty->SetColor(_color);
> _volumeProperty->SetScalarOpacity(_opacity);
> _volumeProperty->SetInterpolationTypeToLinear();
> _volumeProperty->ShadeOff();
>
> _gpuVolumeMapper = vtkOpenGLGPUVolumeRayCastMapper::New();
> _gpuVolumeMapper->SetImageSampleDistance(_imageSampleDistance);
> _gpuVolumeMapper->SetSampleDistance(_sampleDistance);
> _gpuVolumeMapper->AutoAdjustSampleDistancesOff();
> _gpuVolumeMapper->SetInput(_voxels);
>
> _volume = vtkVolume::New();
> _volume->SetProperty(_volumeProperty);
> _volume->SetMapper(_gpuVolumeMapper);
>
> To swap between different predefined color transfer functions, I call:
>
> _volumeProperty->SetColor(someNewColor);
>
> This is where the problem starts. The only way the volume will update to
> the new color is if I delete the current volume mapper and then recreate it
> with the new color transfer function, which is bad for performance. I've
> tried calling _volume->Update() and _gpuVolumeMapper->Update(), which
> doesn't seem to work.
>
> Any help or ideas would be appreciated. Thanks in advance!
>
> eric
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101221/4afcd593/attachment.htm>


More information about the vtkusers mailing list