[vtkusers] volume rendering image decimation
Karthik Krishnan
karthik.krishnan at kitware.com
Tue Oct 11 00:02:58 EDT 2011
On Tue, Oct 11, 2011 at 12:59 AM, Sergio Aguirre
<sergio.aguirre at gmail.com>wrote:
> 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.
>
Sergio:
As a rule of thumb the sample distance should be half the minimum spacing of
the dataset. It is likely that this has nothing to do with the change
information filter. You may have setup an inappropriate transfer function.
Did you try to use the vtkFixedPointVolumeRayCastMapper first ? What GPU do
you have ? I'd recommend using VolView or 3DSlicer to load the dataset, use
the UI to get a reasonable visualization and then translate the result
(transfer function parameters) into code.
--
karthik
Did you load the dataset in VolView or 3D slicer and see if the dataset
>
> 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();
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111011/e08edd02/attachment.htm>
More information about the vtkusers
mailing list