[vtkusers] 3 Component RGB Data Volume Visualization

Lisa Avila lisa.avila at kitware.com
Thu Jul 1 10:05:22 EDT 2004


Hi Brian,

VTK cannot volume render RGB volume data. You can run an averaging or 
luminance filter on the data to bring it down to a single unsigned short 
component, then you can volume render it.

To see your data as RGB you may wish to look at VolView (you can get it 
from the Kitware web site). VolView has an extensible plugin API so you can 
actually implement your ITK filtering as a VolView plugin.

Lisa



At 09:32 AM 7/1/2004, Brian Rowe wrote:
>Hello,
>I have a set of data that is composed of 24bit RGB images.  I am trying to 
>load them in as a volume and process them with ITK, then visualize them in 
>VTK.
>
>I can load them in ITK and pass them to vtk fine,  I verified this by 
>loading a single image and passing it to vtkImageMapper (etc.).
>
>The problem comes when I try to pass the volume to the vtkVolume classes 
>(Mapper, Property, etc.)  When I visualize this, I see nothing.  I am not 
>sure what the problem is.  It could be as simple as having inappropriate 
>ColorTransferFunctions, but at this point I'd like to ask one of the 
>experts if they see something.
>
>I thank you for your time.
>
>the relevant source code follows:
>         append = vtkImageAppendComponents::New();
>
>         //////////////////////////////////
>         /// This code ties ITK to VTK
>         //////////////////////////////////
>         append->AddInput(RedConnector->GetOutput());
>         append->AddInput(GreenConnector->GetOutput());
>         append->AddInput(BlueConnector->GetOutput());
>         //append->AddInput(AlphaConnector->GetOutput());
>
>         /////////////////////////////////
>         /// 2D Image Stuff
>//      vtkImageMapper *imapper = vtkImageMapper::New();
>//
>//      imapper->SetInput(append->GetOutput());
>//
>//      vtkActor2D *actor = vtkActor2D::New();
>//      actor->SetMapper(imapper);
>//      ren->AddActor(actor);
>    ///////////////////////////////////
>
>
>         func = vtkVolumeRayCastCompositeFunction::New();
>
>         mapper = vtkVolumeRayCastMapper::New();
>         mapper->SetInput(append->GetOutput());
>         mapper->IndependentComponentsOn();
>         mapper->SetComponentBlendModeToAdd();
>         mapper->SetVolumeRayCastFunction(func);
>
>         opacity = vtkPiecewiseFunction::New();
>//      opacity->AddPoint(0.0, 0);
>//      opacity->AddPoint(5.0, 1);
>
>         red = vtkColorTransferFunction::New();
>         red->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
>         red->AddRGBPoint(255.0, 1.0, 0.0, 0.0);
>         green = vtkColorTransferFunction::New();
>         green->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
>         green->AddRGBPoint(255.0, 0.0, 1.0, 0.0);
>         blue = vtkColorTransferFunction::New();
>         blue->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
>         blue->AddRGBPoint(255.0, 0.0, 0.0, 1.0);
>
>         prop = vtkVolumeProperty::New();
>         prop->SetInterpolationTypeToLinear();
>//      prop->SetScalarOpacity(0, opacity);
>         prop->SetColor(0, red);
>         prop->SetColor(1, green);
>         prop->SetColor(2, blue);
>         prop->ShadeOn();
>
>         vol = vtkVolume::New();
>         vol->SetProperty(prop);
>         vol->SetMapper(mapper);
>
>         ren->AddVolume(vol);
>         ren->ResetCamera();
>
>---
>1.79 x 10^12 furlongs per fortnight -- it's not just a good idea, it's the 
>law!
><br>
><div>_______________________________________________</div>
><div>This is the private VTK discussion list. </div>
><div>Please keep messages on-topic. Check the FAQ at: &lt;<a 
>href="http://public.kitware.com/cgi-bin/vtkfaq" 
>EUDORA=AUTOURL>http://public.kitware.com/cgi-bin/vtkfaq</a>&gt;</div>
><div>Follow this link to subscribe/unsubscribe:</div>
><div><a href="http://www.vtk.org/mailman/listinfo/vtkusers" 
>EUDORA=AUTOURL>http://www.vtk.org/mailman/listinfo/vtkusers</a></div>
></blockquote></x-html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040701/e8e4b099/attachment.htm>


More information about the vtkusers mailing list