<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>Hi All,</FONT></P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4>I am new to vtk and I am trying to incorporate color transferfunction to the volume rendering .I have pasted the code snippet.Is it a proper method to incoporate color transfer function after the skin mapper.Can I pipeline color transfer funtion directly to the dicom image reader.Pl Help.Thanks in Advance.</FONT></P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkRenderer.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkRenderWindow.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkRenderWindowInteractor.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkDICOMImageReader.h"</P></FONT></FONT></FONT><FONT color=#008000><FONT color=#008000 size=4>
<P>//#include "vtkStructuredPointsReader.h"</P></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkColorTransferFunction..h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkVolumeProperty.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkPolyDataMapper.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkActor.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkProperty.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkOutlineFilter.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkCamera.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkPolyDataMapper.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkStripper.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkPolyDataNormals.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>#include</FONT></FONT></FONT><FONT size=4> <FONT color=#800000><FONT color=#800000>"vtkContourFilter.h"</P></FONT></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT size=4>int</FONT></FONT></FONT><FONT size=4> main (<FONT color=#0000ff><FONT color=#0000ff>int</FONT></FONT> argc, <FONT color=#0000ff><FONT color=#0000ff>char</FONT></FONT> **argv)</FONT></P>
<P><FONT size=4>{</FONT></P>
<P><FONT size=4><FONT color=#0000ff><FONT color=#0000ff>if</FONT></FONT> (argc < 2)</FONT></P>
<P><FONT size=4>{</FONT></P>
<P><FONT size=4>cout << <FONT color=#800000><FONT color=#800000>"Usage: "</FONT></FONT> << argv[0] << <FONT color=#800000><FONT color=#800000>" quad\renal"</FONT></FONT> << endl;</FONT></P>
<P><FONT size=4><FONT color=#0000ff><FONT color=#0000ff>return</FONT></FONT> 1;</FONT></P>
<P><FONT size=4>}</FONT></P>
<P><FONT size=4>vtkRenderer *aRenderer = vtkRenderer::New();</FONT></P>
<P><FONT size=4>vtkRenderWindow *renWin = vtkRenderWindow::New();</FONT></P>
<P><FONT size=4>renWin->AddRenderer(aRenderer);</FONT></P>
<P><FONT size=4>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</FONT></P>
<P><FONT size=4>iren->SetRenderWindow(renWin);</FONT></P>
<P><FONT size=4> </FONT></P>
<P><FONT size=4>vtkDICOMImageReader *v16 = vtkDICOMImageReader::New();</FONT></P>
<P><FONT size=4>v16->SetDirectoryName(argv[1]);</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>vtkContourFilter *skinExtractor = vtkContourFilter::New();</FONT></P>
<P><FONT size=4>skinExtractor->SetInputConnection(v16->GetOutputPort());</FONT></P>
<P><FONT size=4>skinExtractor->SetValue(0, 500);</FONT></P>
<P><FONT size=4>vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();</FONT></P>
<P><FONT size=4>skinNormals->SetInputConnection(skinExtractor->GetOutputPort());</FONT></P>
<P><FONT size=4>skinNormals->SetFeatureAngle(60.0);</FONT></P>
<P><FONT size=4>vtkStripper *skinStripper = vtkStripper::New();</FONT></P>
<P><FONT size=4>skinStripper->SetInputConnection(skinNormals->GetOutputPort());</FONT></P>
<P><FONT size=4>vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();</FONT></P>
<P><FONT size=4>skinMapper->SetInputConnection(skinStripper->GetOutputPort());</FONT></P>
<P><FONT size=4>skinMapper->ScalarVisibilityOff();</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>vtkColorTransferFunction* skinFunc =vtkColorTransferFunction::New();</FONT></P>
<P><FONT size=4>skinFunc->SetInputConnection(skinMapper->GetOutputPort());</FONT></P>
<P><FONT size=4>skinFunc->AddRGBPoint(110.0 .6 .6 .6);</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>vtkVolumeProperty * skinProp = vtkVolumeProperty::New();</FONT></P>
<P><FONT size=4>skinProp->SetInputConnection(skinFunc->GetOutputPort());</FONT></P>
<P><FONT size=4>skinProp->SetColor(ColorTransferFunction);</FONT></P>
<P><FONT size=4>skinProp->ShadeOn();</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>vtkActor *skin = vtkActor::New();</FONT></P>
<P><FONT size=4>skin->SetMapper(skinMapper);</FONT></P>
<P><FONT size=4>skin->GetProperty()->SetDiffuseColor(1, .49, .25);</FONT></P>
<P><FONT size=4>skin->GetProperty()->SetSpecular(.3);</FONT></P>
<P><FONT size=4>skin->GetProperty()->SetSpecularPower(20);</FONT></P>
<P><FONT size=4>skin->GetProperty()->SetOpacity(1.0);</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>vtkContourFilter *boneExtractor = vtkContourFilter::New();</FONT></P>
<P><FONT size=4>boneExtractor->SetInputConnection(v16->GetOutputPort());</FONT></P>
<P><FONT size=4>boneExtractor->SetValue(0, 1150);</FONT></P>
<P><FONT size=4>vtkPolyDataNormals *boneNormals = vtkPolyDataNormals::New();</FONT></P>
<P><FONT size=4>boneNormals->SetInputConnection(boneExtractor->GetOutputPort());</FONT></P>
<P><FONT size=4>boneNormals->SetFeatureAngle(60.0);</FONT></P>
<P><FONT size=4>vtkStripper *boneStripper = vtkStripper::New();</FONT></P>
<P><FONT size=4>boneStripper->SetInputConnection(boneNormals->GetOutputPort());</FONT></P>
<P><FONT size=4>vtkPolyDataMapper *boneMapper = vtkPolyDataMapper::New();</FONT></P>
<P><FONT size=4>boneMapper->SetInputConnection(boneStripper->GetOutputPort());</FONT></P>
<P><FONT size=4>boneMapper->ScalarVisibilityOff();</FONT></P>
<P><FONT size=4>vtkActor *bone = vtkActor::New();</FONT></P>
<P><FONT size=4>bone->SetMapper(boneMapper);</FONT></P>
<P><FONT size=4>bone->GetProperty()->SetDiffuseColor(1, 1, .9412);</FONT></P>
<P><FONT size=4>vtkOutlineFilter *outlineData = vtkOutlineFilter::New();</FONT></P>
<P><FONT size=4>outlineData->SetInputConnection(v16->GetOutputPort());</FONT></P>
<P><FONT size=4>vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();</FONT></P>
<P><FONT size=4>mapOutline->SetInputConnection(outlineData->GetOutputPort());</FONT></P>
<P><FONT size=4>vtkActor *outline = vtkActor::New();</FONT></P>
<P><FONT size=4>outline->SetMapper(mapOutline);</FONT></P>
<P><FONT size=4>outline->GetProperty()->SetColor(0,0,0);</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>vtkCamera *aCamera = vtkCamera::New();</FONT></P>
<P><FONT size=4>aCamera->SetViewUp (0, 0, -1);</FONT></P>
<P><FONT size=4>aCamera->SetPosition (0, 1, 0);</FONT></P>
<P><FONT size=4>aCamera->SetFocalPoint (0, 0, 0);</FONT></P>
<P><FONT size=4>aCamera->ComputeViewPlaneNormal();</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>aRenderer->AddActor(outline);</FONT></P>
<P><FONT size=4>aRenderer->AddActor(skin);</FONT></P>
<P><FONT size=4>aRenderer->AddActor(bone);</FONT></P>
<P><FONT size=4>aRenderer->SetActiveCamera(aCamera);</FONT></P>
<P><FONT size=4>aRenderer->ResetCamera ();</FONT></P>
<P><FONT size=4>aCamera->Dolly(1.5);</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>aRenderer->SetBackground(1,1,1);</FONT></P>
<P><FONT size=4>renWin->SetSize(640, 480);</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>aRenderer->ResetCameraClippingRange ();</FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>iren->Initialize();</FONT></P>
<P><FONT size=4>iren->Start(); </FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>v16->Delete();</FONT></P>
<P><FONT size=4>skinExtractor->Delete();</FONT></P>
<P><FONT size=4>skinNormals->Delete();</FONT></P>
<P><FONT size=4>skinStripper->Delete();</FONT></P>
<P><FONT size=4>skinMapper->Delete();</FONT></P>
<P><FONT size=4>skin->Delete();</FONT></P>
<P><FONT size=4>boneExtractor->Delete();</FONT></P>
<P><FONT size=4>boneNormals->Delete();</FONT></P>
<P><FONT size=4>boneStripper->Delete();</FONT></P>
<P><FONT size=4>boneMapper->Delete();</FONT></P>
<P><FONT size=4>bone->Delete();</FONT></P>
<P><FONT size=4>outlineData->Delete();</FONT></P>
<P><FONT size=4>mapOutline->Delete();</FONT></P>
<P><FONT size=4>outline->Delete();</FONT></P>
<P><FONT size=4>aCamera->Delete();</FONT></P>
<P><FONT size=4>aRenderer->Delete();</FONT></P>
<P><FONT size=4>renWin->Delete();</FONT></P>
<P><FONT size=4>iren->Delete();</FONT></P>
<P><FONT size=4><FONT color=#0000ff><FONT color=#0000ff>return</FONT></FONT> 0;</FONT></P>
<P><FONT size=4>}</FONT></P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4>>..\..\..\..\..\vtksrc\Examples\Medical\Cxx\Medical2.cxx(88) : error C2039: 'SetInputConnection' : is not a member of 'vtkColorTransferFunction'</FONT></P>
<P><FONT size=4>1> F:\OSP\VTK\vtksrc\Filtering\vtkColorTransferFunction.h(45) : see declaration of 'vtkColorTransferFunction'</FONT></P>
<P><FONT size=4>1>..\..\..\..\..\vtksrc\Examples\Medical\Cxx\Medical2.cxx(89) : error C2143: syntax error : missing ')' before 'constant'</FONT></P>
<P><FONT size=4>1>..\..\..\..\..\vtksrc\Examples\Medical\Cxx\Medical2.cxx(89) : error C2661: 'vtkColorTransferFunction::AddRGBPoint' : no overloaded function takes 1 arguments</FONT></P>
<P><FONT size=4>1>..\..\..\..\...\vtksrc\Examples\Medical\Cxx\Medical2.cxx(89) : error C2059: syntax error : ')'</FONT></P>
<P><FONT size=4>1>..\..\..\..\..\vtksrc\Examples\Medical\Cxx\Medical2.cxx(92) : error C2039: 'SetInputConnection' : is not a member of 'vtkVolumeProperty'</FONT></P>
<P><FONT size=4>1> F:\OSP\VTK\vtksrc\Rendering\vtkVolumeProperty.h(50) : see declaration of 'vtkVolumeProperty'</FONT></P>
<P><FONT size=4>1>..\..\..\..\..\vtksrc\Examples\Medical\Cxx\Medical2.cxx(92) : error C2039: 'GetOutputPort' : is not a member of 'vtkColorTransferFunction'</FONT></P>
<P><FONT size=4>1> F:\OSP\VTK\vtksrc\Filtering\vtkColorTransferFunction.h(45) : see declaration of 'vtkColorTransferFunction'</FONT></P>
<P><FONT size=4>1>..\..\..\...\..\vtksrc\Examples\Medical\Cxx\Medical2.cxx(93) : error C2065: 'ColorTransferFunction' : undeclared identifier</FONT></P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4>regards</FONT></P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4>Albert</FONT></P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P>
<P><FONT size=4></FONT> </P></DIV></div><br>
</body></html>