<div dir="ltr"><div><div><div><div>Hello Cory,<br><br></div>In the volume property you'll need to indicate that you don't have independent components. That is, by default this is set to true and therefore VTK assumes you are representing separate properties which each of the scalar components (for example pressure and density). In that case, each scalar is passed through its own lookup tables for color and opacity and the resulting values are merged based on the weightings of the components.<br>
<br></div>VTK also supports IA (intensity / alpha) and RGBA data. This must be 2 or 4 component unsigned char data. Once you set it so that your components are not independent, the last component will be considered a scalar lookup into your opacity transfer function, and the first one or three components will be used to represent your color. In the case of 2 component data (IA), that first component will be passed through the color transfer function. In the case of 4 component data (RGBA) those first three components will be directly considered the RGB color of that voxel. <br>
<br></div>Note that if you have 3 component RGB data you'll need to do something to create a 4th component (otherwise you have no concept of alpha and you just have a solid block of color). Typical methods of generating that fourth component include assigning it to be the hue or intensity of the RGB value. For example, with the visible human data we usually assign the fourth component to be hue since the body was encased in a blue gel (we can then set the opacity of the blue hue to be zero, thereby seeing the human inside the cube). <br>
<br></div>Hope this helps.<br><br>Lisa<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 25, 2014 at 1:49 PM, Cory Jones <span dir="ltr"><<a href="mailto:cjayjones@gmail.com" target="_blank">cjayjones@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>