[vtkusers] Displaying a 2D image as a volume

Mark Wyszomierski markww at gmail.com
Wed Feb 27 10:33:31 EST 2008


Jeroen, I got the same behavior. When you have a single image, can you
just pad it with an extra transparent image to get it rendering ok?

On Wed, Feb 27, 2008 at 3:31 AM,  <J.S.Wijnhout at lumc.nl> wrote:
>
>
>
> Hi,
>
>
>
> I'm trying to display a 2D image (that has a certain thickness) as a 3D
> volume, visualizing the thickness of the image as well. However I seem to be
> unable to get anything displayed. I've tried the following (note that this
> code does work with data sets that have image->GetDimensions()[2] > 1):
>
>
>
>     vtkImageData *image = ...;
>
>
>
>     vtkPiecewiseFunction *opacityTransferFunction =
> vtkPiecewiseFunction::New ();
>
>     opacityTransferFunction->AddPoint ( 0, 1.0 );
>
>     opacityTransferFunction->AddPoint ( 255, 1.0 );
>
>     vtkColorTransferFunction *colorTransferFunction =
> vtkColorTransferFunction::New ();
>
>     colorTransferFunction->AddRGBPoint ( 0, 0.0, 0.0, 0.0 );
>
>     colorTransferFunction->AddRGBPoint ( 255, 1.0, 1.0, 1.0 );
>
>
>
>     vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New ();
>
>     volumeProperty->SetColor ( colorTransferFunction );
>
>     volumeProperty->SetScalarOpacity ( opacityTransferFunction );
>
>
>
>     vtkVolumeRayCastCompositeFunction *rayCastFunction =
> vtkVolumeRayCastCompositeFunction::New ();
>
>
>
>     vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New ();
>
>     volumeMapper->SetInput ( image );
>
>     volumeMapper->SetVolumeRayCastFunction ( rayCastFunction );
>
>
>
>     vtkVolume *volume = vtkVolume::New ();
>
>     volume->SetProperty ( volumeProperty );
>
>     volume->SetMapper ( volumeMapper );
>
>
>
> It seems like a very basic problem, so hopefully someone can point out my
> error.
>
>
>
> best,
>
> Jeroen
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the 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