[vtkusers] volume rendering image decimation

Sergio Aguirre sergio.aguirre at gmail.com
Mon Oct 10 15:29:18 EDT 2011


Hi everyone

I am experiencing some unconventional results when doing volume rendering.

I need to adjust the pixel spacing of my image using
vtkImageChangeInformation to show real physical dimensions. When I apply
that filter only some parts of the volume rendered image are visible others
simply do not appear.

I updated the vtkGPUVolumeRayCastMapper SetSampleDistance to the same
spacing I use in vtkImageChangeInformation with no change in the output.

Can anyone suggest what I am missing?

Sergio

//// code

double opacityWindow = 2000.0;
double opacityLevel = 1.0;

vtkDICOMImageReader *dicomReader = vtkDICOMImageReader::New();
dicomReader->SetDirectoryName("C:/Users/echopixel-01/Desktop/images/t120");
dicomReader->Update();

vtkImageData *dcmImage = vtkImageData::New();
dcmImage = dicomReader->GetOutput();
dcmImage->Update();

vtkImageChangeInformation *iChange = vtkImageChangeInformation::New();
iChange->SetInput(dcmImage);
iChange->SetOutputSpacing(0.000125, 0.000125, 0.0002);
iChange->Update();

vtkColorTransferFunction *colorFun = vtkColorTransferFunction::New();
colorFun->AddRGBSegment(opacityLevel - 0.5*opacityWindow, 0.0, 0.0, 0.0,
opacityLevel + 0.5*opacityWindow, 1.0, 1.0, 1.0 );

vtkPiecewiseFunction *opacityFun = vtkPiecewiseFunction::New();
opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0, opacityLevel
+ 0.5*opacityWindow, 1.0 );

vtkVolumeProperty *property1 = vtkVolumeProperty::New();
property1->SetIndependentComponents(true);
property1->SetColor( colorFun );
property1->SetScalarOpacity( opacityFun );
property1->SetInterpolationTypeToLinear();

vtkVolume *volume = vtkVolume::New();
vtkGPUVolumeRayCastMapper *mapper = vtkGPUVolumeRayCastMapper::New();

        mapper->SetInputConnection(iChange->GetOutputPort());
mapper->SetBlendModeToComposite();
mapper->AutoAdjustSampleDistancesOff();
mapper->SetSampleDistance(0.000125);

volume->SetProperty( property1 );
volume->SetMapper( mapper );
volume->SetPosition(0.0, 0.0, 0.0);
volume->SetOrigin(0.0, 0.0, 0.0);
volume->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111010/1d1e7799/attachment.htm>


More information about the vtkusers mailing list