[vtkusers] Volume Rendering with Voxel Specific Color
Aashish Chaudhary
aashish.chaudhary at kitware.com
Wed Jun 25 17:07:59 EDT 2014
So you want first channel to be rendered as R, second as B, and third as G?
I am not sure what you mean by you were able to set scalar components in my
ImageData to 3? So you have multi-component data that you are trying to
render?
If you can send us a sample dataset, I can have a look at it.
- Aashish
On Wed, Jun 25, 2014 at 1:49 PM, Cory Jones <cjayjones at gmail.com> wrote:
> I am trying to render a volume from 3D ImageData and I want to be able to
> control the color of each voxel independently using the color channels. I
> am able to set the number of scalar components in my ImageData to 3 and set
> each channel separately. I am rendering using vtkSmartVolumeMapper. Is
> there a way to set the vtkVolumeProperty so that the image renders the 3
> channels as RGB? I have tried using the vtkColorTransferFunction
> SetColorSpaceToRGB(), but this does not work. Again, I don't want to do
> scalar color mapping. My current code is:
>
>
> vtkSmartPointer<vtkSmartVolumeMapper> volumeMapper =
> vtkSmartPointer<vtkSmartVolumeMapper>::New();
> volumeMapper->SetBlendModeToComposite();
> volumeMapper->SetInputConnection(outputImageData->GetProducerPort());
>
> vtkSmartPointer<vtkVolumeProperty> volumeProperty =
> vtkSmartPointer<vtkVolumeProperty>::New();
> volumeProperty->ShadeOff();
> volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);
>
> vtkSmartPointer<vtkColorTransferFunction> color =
> vtkSmartPointer<vtkColorTransferFunction>::New();
> color->SetColorSpaceToRGB();
> volumeProperty->SetColor(color);
>
> vtkSmartPointer<vtkVolume> volume =
> vtkSmartPointer<vtkVolume>::New();
> volume->SetMapper(volumeMapper);
> volume->SetProperty(volumeProperty);
>
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/vtkusers
>
>
--
*| Aashish Chaudhary | Technical Leader | Kitware Inc. *
*| http://www.kitware.com/company/team/chaudhary.html
<http://www.kitware.com/company/team/chaudhary.html>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140625/9669b430/attachment.html>
More information about the vtkusers
mailing list