[vtkusers] Updating color transfer function for GPU volume
Eric Foo
foo at iastate.edu
Tue Dec 21 21:24:13 EST 2010
Hi Jim,
Thanks for your response. Calling Modified() in the color transfer function object did the trick.
eric
On Dec 21, 2010, at 6:02 AM, Jim Peterson wrote:
> Eric and Shashwath,
>
> I believe you will find the vtk pipeline is optimized to only process "new" data in the pipeline. Unfortunately there is no mechanism that automatically sets the last change time with a call that changes the content. What is required is a call to ->Modified() for any object with changed content. this includes changes to points, cells, scalars, transformations and maps.
>
> I suggest you add a ->Modified() call to the affected pipeline objects to cause the ->Update() to recognize the need to re-evaluate the pipeline.
>
> Hope that helps,
> Jim
>
> Shashwath T.R. wrote:
>> 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 <mailto: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 <http://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
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
>>
>
More information about the vtkusers
mailing list