<font size="2"><font face="verdana,sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">volumeproperty.SetSpecularPower(70.0); //WTF? Specular power 70? </span></font></font><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">Try removing this line (meaning you will use the default). I suspect this is the reason.</span><div>
<div><font size="2"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></font></div><div><font size="2"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">HTH<br>
</span></font></font><br><div class="gmail_quote">2011/3/14 Sarah Saeed <span dir="ltr"><<a href="mailto:sosca7@hotmail.com">sosca7@hotmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<br><font color="#2b91af" size="2"><font color="#2b91af" size="2">
<font color="#000000"><strong>hello everyone, please i need help in adjusting the transferfunctions , i got a dark volume and i googled for a suitable transferfunstions but i could find any,so please can anyone help me?</strong></font><br>
<font color="#000000"><strong>here's the code i wrote:</strong></font><br>
<br>
vtkDICOMImageReader</font></font><font size="2"> Reader = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkDICOMImageReader</font></font><font size="2">();<br>
Reader.SetDirectoryName(FolderName);<br>
Reader.Update();<br>
</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">double</font></font><font size="2">[] ImageRange = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">double</font></font><font size="2">[2];<br>
ImageRange = Reader.GetOutput().GetScalarRange();<br>
<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkImageShiftScale</font></font><font size="2"> ScaleFunc = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkImageShiftScale</font></font><font size="2">();<br>
ScaleFunc.SetInputConnection(Reader.GetOutputPort());<br>
ScaleFunc.SetShift(-1.0 * ImageRange[0]);<br>
ScaleFunc.SetScale(255.0 / (ImageRange[1] - ImageRange[0]));<br>
ScaleFunc.SetOutputScalarTypeToUnsignedChar();<br>
ScaleFunc.Update();<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkImageData</font></font><font size="2"> ImageData = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkImageData</font></font><font size="2">();<br>
ImageData = ScaleFunc.GetOutput();<br>
</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2">[] Dimension = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2">[3];<br>
Dimension = ImageData.GetDimensions();<br>
</font><font color="#008000" size="2"><font color="#008000" size="2">/////<br></font></font><font size="2">
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkImageGaussianSmooth</font></font><font size="2"> smooth = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkImageGaussianSmooth</font></font><font size="2">();<br>
smooth.SetDimensionality(3);</font><font color="#008000" size="2"><font color="#008000" size="2">//three dimensional gaussian is performed. <br></font></font><font size="2">
smooth.SetRadiusFactors(1, 1, 1);<br>
smooth.SetStandardDeviation(3, 3, 3);</font><font color="#008000" size="2"><font color="#008000" size="2">//Sets the Standard deviation of the gaussian in pixel units.<br></font></font><font size="2">
smooth.SetInput(ImageData);<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkPiecewiseFunction</font></font><font size="2"> opacitytransfer = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkPiecewiseFunction</font></font><font size="2">();</font><font color="#008000" size="2"><font color="#008000" size="2">//control the opacity of voxels<br>
</font></font><font size="2">
opacitytransfer.ClampingOff();<br></font><font size="2">
opacitytransfer.AddPoint(84, 0);<br>
opacitytransfer.AddPoint(151, .3);<br>
opacitytransfer.AddPoint(255, 1);<br>
<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkPiecewiseFunction</font></font><font size="2"> Gradienttransfer = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkPiecewiseFunction</font></font><font size="2">();<br>
Gradienttransfer.AddPoint(0, .2);<br>
Gradienttransfer.AddPoint(10, .2);<br>
Gradienttransfer.AddPoint(25, 1);<br>
<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkColorTransferFunction</font></font><font size="2"> colorTransferFunction = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkColorTransferFunction</font></font><font size="2">();</font><font color="#008000" size="2"><font color="#008000" size="2">//control colors of voxels.<br>
</font></font><font size="2">
colorTransferFunction.AddHSVPoint(0, .67, .07, 1);<br>
colorTransferFunction.AddHSVPoint(94, .67, .07, 1);<br>
colorTransferFunction.AddHSVPoint(139, 0, 0, 0);<br>
colorTransferFunction.AddHSVPoint(160, .28, .047, 1);<br>
colorTransferFunction.AddHSVPoint(254, .38, .013, 1);<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolumeProperty</font></font><font size="2"> volumeproperty = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolumeProperty</font></font><font size="2">();<br>
volumeproperty.SetColor(colorTransferFunction);<br>
volumeproperty.SetScalarOpacity(opacitytransfer);<br>
volumeproperty.SetGradientOpacity(Gradienttransfer);<br>
volumeproperty.ShadeOn();<br>
volumeproperty.SetDiffuse(2.0);<br>
volumeproperty.SetAmbient(0.1);<br>
volumeproperty.SetShade(1);<br>
volumeproperty.SetSpecular(1.0);<br>
volumeproperty.SetSpecularPower(70.0);<br>
volumeproperty.SetInterpolationTypeToLinear();<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolumeRayCastMapper</font></font><font size="2"> volumemapper = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolumeRayCastMapper</font></font><font size="2">();<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolumeRayCastCompositeFunction</font></font><font size="2"> vray = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolumeRayCastCompositeFunction</font></font><font size="2">();<br>
</font><font size="2">
volumemapper.SetVolumeRayCastFunction(vray);<br>
volumemapper.SetInputConnection(smooth.GetOutputPort());<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolume</font></font><font size="2"> volume = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkVolume</font></font><font size="2">();<br>
volume.SetProperty(volumeproperty);<br>
volume.SetMapper(volumemapper);<br>
volumeproperty.SetInterpolationTypeToLinear();<br>
</font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkCamera</font></font><font size="2"> acamera = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">vtkCamera</font></font><font size="2">();<br>
acamera.SetViewUp(0, 0, -1);<br>
acamera.SetPosition(0, 1, 0);<br>
acamera.SetFocalPoint(0, 0, 0);<br>
acamera.ComputeViewPlaneNormal();<br>
acamera.UpdateViewport(Renderer);<br>
Renderer.AddActor(volume);<br>
Renderer.SetActiveCamera(acamera);<br>
Renderer.ResetCamera();<br>
Renderer.SetBackground(0, 0, 0);<br>
renderWindowControl1.Refresh();<br></font>                                            </div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div></div>