[vtkusers] [nedunuri_rk at yahoo.com: Re: Help]
Robert Belleman
robbel at science.uva.nl
Mon Apr 29 09:36:50 EDT 2002
The following was sent to me; perhaps someone else on the list can
find the time to help this guy.
-- Rob
----- Forwarded message from nedunuri ramakrishna <nedunuri_rk at yahoo.com> -----
Date: Fri, 26 Apr 2002 23:12:30 -0700 (PDT)
From: nedunuri ramakrishna <nedunuri_rk at yahoo.com>
Subject: Re: Help
To: Robert Belleman <robbel at science.uva.nl>
In-Reply-To: <20020425121524.A19509 at carol.wins.uva.nl>
Dear Robert,
I am getting Image and rendering.I want clear image
means opacity and color effect where I have to
adjust.Because I am getting white image totally.Not
clear that much whcih is showing in volview.Please
help me what values I have to make changes.It should
display in grey color.
renderer =vtkRenderer::New();
renWin = vtkRenderWindow::New();
renWin->AddRenderer(renderer);
renWin->SetParentId(m_hWnd);
iren =vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkVolume16Reader *reader=vtkVolume16Reader::New();
reader->SetDataByteOrderToLittleEndian();
reader->SetFilePrefix("C:\\DicomFiles\\DownLoad\\xyz\\");
reader->SetFilePattern("%s%d.raw");
reader->SetImageRange(1,93);
reader->SetDataDimensions(128,128);
reader->SetDataSpacing(1,1,1);
reader->SetDataMask(0x7fff);
vtkImageGaussianSmooth
*gaussian=vtkImageGaussianSmooth::New();
gaussian->SetStandardDeviations(1.0,1.0,1.0);
gaussian->SetRadiusFactors(1.0,1.0,1.0);
gaussian->SetInput(reader->GetOutput());
// Create transfer mapping scalar value to opacity
vtkPiecewiseFunction
*opacityTransferFunction=vtkPiecewiseFunction::New();
opacityTransferFunction->AddPoint(0,0.259);
opacityTransferFunction->AddPoint(64,63535);
opacityTransferFunction->AddPoint(128,1.0);
//# Create transfer mapping scalar value to color
vtkColorTransferFunction
*colorTransferFunction=vtkColorTransferFunction::New();
colorTransferFunction->AddRGBPoint(0.0,0.0,0.0,0.0);
colorTransferFunction->AddRGBPoint(63.0,0.259,0.259,0.3);
colorTransferFunction->AddRGBPoint(127.0,1.0,1.0,0.3);
//# The property describes how the data will look
vtkVolumeProperty
*volumeProperty=vtkVolumeProperty::New();
volumeProperty->SetColor(colorTransferFunction);
volumeProperty->SetScalarOpacity(opacityTransferFunction);
volumeProperty->SetAmbient(0.01);
volumeProperty->SetDiffuse(0.50);
volumeProperty->SetSpecular(0.48);
volumeProperty->SetSpecularPower(100);
volumeProperty->ShadeOn();
vtkFiniteDifferenceGradientEstimator
*gst=vtkFiniteDifferenceGradientEstimator::New();
vtkVolumeRayCastCompositeFunction
*compositeFunction=vtkVolumeRayCastCompositeFunction::New();
vtkVolumeRayCastMapper
*volumeMapper=vtkVolumeRayCastMapper::New();
volumeMapper->SetGradientEstimator(gst);
volumeMapper->SetVolumeRayCastFunction(compositeFunction);
volumeMapper->SetInput(gaussian->GetOutput());
//# The volume holds the mapper and the property and
//# can be used to position/orient the volume
vtkVolume *volume=vtkVolume::New();
volume->SetMapper(volumeMapper);
volume->SetProperty(volumeProperty);
renderer->AddVolume(volume);
renWin->Render();
}
Regards,
Ramakrishna
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
----- End forwarded message -----
--
[] Robert Belleman X Section Computational Science []
[] robbel at science.uva.nl |X| University of Amsterdam, the Netherlands []
[] tel: (+31) 20 525 7510 X http://www.science.uva.nl/~robbel/ []
More information about the vtkusers
mailing list