<div>Hello. I seem to have a small problem using the functions vtkPiecewiseFunction and vtkColorTransferFunction.</div>
<div> </div>
<div>I have a very simple mask consisting of values</div>
<div>background=-2949120<br>foreground= 2949030</div>
<div> </div>
<div>I just want to visualize this volume in vtk. I have defined the vtkPiecewiseFunction and vtkColorTransferFunction like this:</div>
<div> </div>
<div>
<div>unsigned short bg=-2949120;<br>unsigned short fg= 2949030;</div>
<div>
<p>//Create transfer mapping scalar value to color<br>vtkPiecewiseFunction *opacityTransferfunction=vtkPiecewiseFunction::New();<br>vtkColorTransferFunction *colorTransferFunction=vtkColorTransferFunction::New();</p>
<p>opacityTransferfunction->AddPoint(bg,0.0);<br>opacityTransferfunction->AddPoint(fg,1.0);</p>
<p>colorTransferFunction->AddRGBPoint(bg,0.0,0.0,0.0);<br>colorTransferFunction->AddRGBPoint(fg,1.,1.,1.);</p><font size="1"></font></div></div>
<div>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.</div>
<div>How do i do that? Am i missing something?</div>
<div>Many regards<font size="1"></font></div>