<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:"Yu Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"\@Yu Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I am cutting a volume using vtkCutter and I want to remove everything that is black or close to black. Normally this would be done using a transfer function, but I can not seem to find where to put it.<o:p></o:p></p><p class=MsoNormal>This is the flow of my program(shortened):<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkPiecewiseFunction</span><span style='font-size:9.5pt;font-family:Consolas;color:black'> *opacityFun = </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkPiecewiseFunction</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkDataSet</span><span style='font-size:9.5pt;font-family:Consolas;color:black'> *dataSet;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkXMLImageDataReader</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>> reader =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkXMLImageDataReader</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>>::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> dataSet = </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkDataSet</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>::SafeDownCast(reader</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>GetOutput());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> reader</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>GetOutput()->GetBounds(bounds);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkPlane</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>> plane =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkPlane</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>>::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:green'>// Create cutter</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:blue'>double</span><span style='font-size:9.5pt;font-family:Consolas;color:black'> high = plane</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>EvaluateFunction((bounds[1] + bounds[0]) / 2.0,<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> (bounds[3] + bounds[2]) / 2.0,<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> bounds[5]);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkCutter</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>> cutter =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkCutter</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>>::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> cutter</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>SetInputConnection(reader</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>GetOutputPort());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> cutter</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>SetCutFunction(plane);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> cutter</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>GenerateValues(<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> numberOfCuts,<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> 0.9,<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> 0.9*high);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkPolyDataMapper</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>> cutterMapper =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkPolyDataMapper</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>>::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> cutterMapper</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>SetInputConnection(cutter</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>GetOutputPort());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:green'>// Create cut actor</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkActor</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>> cutterActor =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkActor</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>>::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> cutterActor</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>GetProperty()->SetLineWidth(2);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> cutterActor</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>SetMapper(cutterMapper);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:green'>// Create renderers and add actors of plane and model</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkRenderer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>> renderer =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkSmartPointer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'><</span><span style='font-size:9.5pt;font-family:Consolas;color:#2B91AF'>vtkRenderer</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>>::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> renderer</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>-></span><span style='font-size:9.5pt;font-family:Consolas;color:black'>AddActor(cutterActor);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:green'>//Code to render and interact with the cuts.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:green'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>Where in this code do I apply the transfer function? Do I use a lookup table? For now I want all colours to have opacity of 1 except for black that should have opacity = 0. How can this be done? I am using C++ and none of the examples seem to fit with the flow of my program. They either work only on volumes, which my poly data cut is not, or the function they use does not exist in any of the classes I am using. I tried setting a lookuptable with opacity ranges, I tried using a vtkPiecewiseFunction, but nothing seems to work. <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>Thank you for your help.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>Yours, <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>Magnus Elden</span><o:p></o:p></p></div></body></html>