<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=5>This is the code in c++ : (when i use
vtkStructuredPointsReder it's all ok but, when i use vtkVolume16Reder to convert
dicom image ,the result is Bad ). I try to use<FONT size=2>
vtkImageCast *cast = vtkImageCast::New(); </FONT><FONT
size=2>cast->SetInput(reder->GetOutput()); </FONT><FONT
size=2>cast->SetOutputScalarTypeToUnsignedChar(); </FONT><FONT size=5>for
very bed result . </FONT></FONT></DIV>
<DIV><FONT face=Arial size=5></FONT> </DIV>
<DIV><FONT face=Arial size=5>CODE:</FONT></DIV>
<DIV><FONT face=Arial size=2> <FONT size=3>vtkRenderWindow *renWin =
vtkRenderWindow::New();</FONT>
<P><FONT size=3>vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::New();</FONT></P>
<P><FONT size=3>iren->SetRenderWindow(renWin);</FONT></P>
<P><FONT size=3>vtkRenderer *ren = vtkRenderer::New();</FONT></P>
<P><FONT size=3>renWin->AddRenderer(ren);</FONT></P>
<P><FONT size=3></FONT></P><FONT color=#008000>
<P><FONT size=3>// Read the data from a vtk file</FONT></P>
<P><FONT size=3>// vtkStructuredPointsReader *reader =
vtkStructuredPointsReader::New();</FONT></P></FONT>
<P><FONT color=#008000><FONT
size=3>//reader->SetFileName("C:/ironProt.vtk");</FONT></P></FONT>
<P><FONT color=#008000><FONT size=3>//reader->Update();</FONT></P></FONT>
<P><FONT size=3>vtkVolume16Reader *reader = vtkVolume16Reader::New();</FONT></P>
<P><FONT size=3>reader->SetDataByteOrderToLittleEndian();</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT color=#008000><FONT
size=3>//reader->SetFilePattern("dcm");</FONT></P></FONT>
<P><FONT size=3>reader->SetDataDimensions (512,512);</FONT></P>
<P><FONT size=3>reader->SetImageRange (1,20);</FONT></P>
<P><FONT size=3>reader->SetFilePrefix("C:/TAC_BODY_MOD/0001000");</FONT></P>
<P><FONT size=3>reader->SetDataSpacing (2, 2, 1.5);</FONT></P>
<P><FONT size=3></FONT> </P>
<P><FONT color=#008000><FONT size=3>// Create a transfer function mapping scalar
value to opacity</FONT></P></FONT>
<P><FONT size=3>vtkPiecewiseFunction *oTFun =
vtkPiecewiseFunction::New();</FONT></P>
<P><FONT size=3>oTFun->AddSegment(10, 0.0, 255, 0.3);</FONT></P>
<P><FONT size=3>vtkPiecewiseFunction *oTFun2 =
vtkPiecewiseFunction::New();</FONT></P>
<P><FONT size=3>oTFun2->AddSegment( 0, 0.0, 128, 1.0);</FONT></P>
<P><FONT size=3>oTFun2->AddSegment(128, 1.0, 255, 0.0);</FONT></P>
<P><FONT color=#008000><FONT size=3>// Create a transfer function mapping scalar
value to color (grey)</FONT></P></FONT>
<P><FONT size=3>vtkPiecewiseFunction *gTFun =
vtkPiecewiseFunction::New();</FONT></P>
<P><FONT size=3>gTFun->AddSegment(0, 1.0, 255, 1.0);</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT color=#008000><FONT size=3>// Create a transfer function mapping scalar
value to color (color)</FONT></P></FONT>
<P><FONT size=3>vtkColorTransferFunction *cTFun =
vtkColorTransferFunction::New();</FONT></P>
<P><FONT size=3>cTFun->AddRGBPoint( 0, 1.0, 0.0, 0.0 );</FONT></P>
<P><FONT size=3>cTFun->AddRGBPoint( 64, 1.0, 1.0, 0.0 );</FONT></P>
<P><FONT size=3>cTFun->AddRGBPoint( 128, 0.0, 1.0, 0.0 );</FONT></P>
<P><FONT size=3>cTFun->AddRGBPoint( 192, 0.0, 1.0, 1.0 );</FONT></P>
<P><FONT size=3>cTFun->AddRGBPoint( 255, 0.0, 0.0, 1.0 );</FONT></P>
<P><FONT color=#008000><FONT size=3>// Create a transfer function mapping
magnitude of gradient to opacity</FONT></P></FONT>
<P><FONT size=3>vtkPiecewiseFunction *goTFun =
vtkPiecewiseFunction::New();</FONT></P>
<P><FONT size=3>goTFun->AddPoint( 0, 0.0 );</FONT></P>
<P><FONT size=3>goTFun->AddPoint( 30, 0.0 );</FONT></P>
<P><FONT size=3>goTFun->AddPoint( 40, 1.0 );</FONT></P>
<P><FONT size=3>goTFun->AddPoint( 255, 1.0 );</FONT></P>
<P><FONT color=#008000><FONT size=3>// Create a set of properties with varying
options</FONT></P></FONT>
<P><FONT size=3>vtkVolumeProperty *prop = vtkVolumeProperty::New();</FONT></P>
<P><FONT size=3>prop->SetShade(1);</FONT></P>
<P><FONT size=3>prop->SetAmbient(0.3);</FONT></P>
<P><FONT size=3>prop->SetDiffuse(1.0);</FONT></P>
<P><FONT size=3>prop->SetSpecular(0.2);</FONT></P>
<P><FONT size=3>prop->SetSpecularPower(50.0);</FONT></P>
<P><FONT size=3>prop->SetScalarOpacity(oTFun);</FONT></P>
<P><FONT size=3>prop->SetGradientOpacity( goTFun );</FONT></P>
<P><FONT size=3>prop->SetColor( gTFun );</FONT></P>
<P><FONT size=3>prop->SetInterpolationTypeToNearest();</FONT></P>
<P><FONT color=#008000 size=3>//
prop->SetInterpolationTypeToLinear();</FONT><FONT color=#008000></P></FONT>
<P><FONT color=#008000><FONT size=3>// Create mip ray
functions</FONT></P></FONT>
<P><FONT size=3>vtkVolumeRayCastMIPFunction *MIPFunction1 = </FONT></P>
<P><FONT size=3>vtkVolumeRayCastMIPFunction::New();</FONT></P>
<P><FONT size=3>MIPFunction1->SetMaximizeMethodToScalarValue();</FONT></P>
<P><FONT size=3>vtkFiniteDifferenceGradientEstimator *gradest = </FONT></P>
<P><FONT size=3>vtkFiniteDifferenceGradientEstimator::New();</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3>vtkVolume *volume = vtkVolume::New();</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3>ren->AddViewProp(volume);</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3>vtkVolumeRayCastMapper *raycastMapper =
vtkVolumeRayCastMapper::New();</FONT></P>
<P><FONT
size=3>raycastMapper->SetInputConnection(reader->GetOutputPort());</FONT></P>
<P><FONT size=3>raycastMapper->SetGradientEstimator(gradest);</FONT></P>
<P><FONT size=3>volume->SetMapper( raycastMapper );</FONT></P>
<P><FONT size=3>volume->SetProperty( prop );</FONT></P>
<P><FONT size=3>raycastMapper->SetVolumeRayCastFunction(MIPFunction1
);</FONT></P>
<P><FONT size=3>renWin->SetSize(400,350);</FONT></P>
<P><FONT size=3>ren->ResetCamera();</FONT></P>
<P><FONT size=3>ren->GetActiveCamera()->Zoom(1.5);</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3>renWin->Render();</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT color=#008000><FONT size=3>// Interact with the data at 3 frames per
second</FONT></P></FONT>
<P><FONT size=3>iren->SetDesiredUpdateRate(3.0);</FONT></P>
<P><FONT size=3>iren->SetStillUpdateRate(0.001);</FONT></P>
<P><FONT size=3>iren->Start();</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT color=#008000><FONT size=3>// Clean up</FONT></P></FONT>
<P><FONT size=3>reader->Delete();</FONT></P>
<P><FONT size=3>oTFun->Delete();</FONT></P>
<P><FONT size=3>oTFun2->Delete();</FONT></P>
<P><FONT size=3>gTFun->Delete();</FONT></P>
<P><FONT size=3>cTFun->Delete();</FONT></P>
<P><FONT size=3>goTFun->Delete();</FONT></P>
<P><FONT size=3>prop->Delete();</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3>MIPFunction1->Delete();</FONT></P>
<P><FONT size=3>volume->Delete();</FONT></P>
<P><FONT size=3></FONT></P>
<P><FONT size=3>gradest->Delete();</FONT></P>
<P><FONT size=3>raycastMapper->Delete();</FONT></P>
<P><FONT size=3>ren->Delete();</FONT></P>
<P><FONT size=3>iren->Delete();</FONT></P>
<P><FONT size=3>renWin->Delete();</FONT></P>
<P><FONT size=5>Thanks to help me .... Bets reguards Michele
</FONT></P></FONT></DIV></BODY></HTML>