<div dir="ltr">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:<br>
<div><br></div><div><br></div><div><div> vtkSmartPointer<vtkSmartVolumeMapper> volumeMapper = </div><div> vtkSmartPointer<vtkSmartVolumeMapper>::New();</div><div> volumeMapper->SetBlendModeToComposite(); </div>
<div> volumeMapper->SetInputConnection(outputImageData->GetProducerPort());</div><div><br></div><div> vtkSmartPointer<vtkVolumeProperty> volumeProperty = </div><div> vtkSmartPointer<vtkVolumeProperty>::New();</div>
<div> volumeProperty->ShadeOff();</div><div> volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);</div><div> </div><div> vtkSmartPointer<vtkColorTransferFunction> color = </div><div> vtkSmartPointer<vtkColorTransferFunction>::New();</div>
<div> color->SetColorSpaceToRGB();</div><div> volumeProperty->SetColor(color);</div><div><br></div><div> vtkSmartPointer<vtkVolume> volume = </div><div> vtkSmartPointer<vtkVolume>::New();</div><div>
volume->SetMapper(volumeMapper);</div><div> volume->SetProperty(volumeProperty);</div></div></div>