[vtkusers] Re: Using vtkPiecewiseFunction and vtkColorTransferFunction
Prename Surname
bsd.diverse at gmail.com
Mon Oct 16 04:33:18 EDT 2006
Hello...I really have problems visualizing this mask consisting of only 2
different values. Foreground and background. Is it even possible to show
this in VTK.
Does anyone have a moment to help me out.
Thank you
2006/10/14, Prename Surname <bsd.diverse at gmail.com>:
>
> Hello. I seem to have a small problem using the functions
> vtkPiecewiseFunction and vtkColorTransferFunction.
>
> I have a very simple mask consisting of values
> background=-2949120
> foreground= 2949030
>
> I just want to visualize this volume in vtk. I have defined the
> vtkPiecewiseFunction and vtkColorTransferFunction like this:
>
> unsigned short bg=-2949120;
> unsigned short fg= 2949030;
>
> //Create transfer mapping scalar value to color
> vtkPiecewiseFunction *opacityTransferfunction=vtkPiecewiseFunction::New();
> vtkColorTransferFunction
> *colorTransferFunction=vtkColorTransferFunction::New();
>
> opacityTransferfunction->AddPoint(bg,0.0);
> opacityTransferfunction->AddPoint(fg,1.0);
>
> colorTransferFunction->AddRGBPoint(bg,0.0,0.0,0.0);
> colorTransferFunction->AddRGBPoint(fg,1.,1.,1.);
> But when i then run the program, the volume is just rendered as one solid
> gray cube. All I want to is to visualize the foreground in a certain color,
> and not show the background.
> How do i do that? Am i missing something?
> Many regards
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061016/a06f73b1/attachment.htm>
More information about the vtkusers
mailing list