From f9191b324a5a2df396fdeb878932f1106ceb1d40 Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Tue, 28 Jul 2009 18:14:25 +0000 Subject: [PATCH] ENH: Improved the raycasting quality --- invesalius/data/volume.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/invesalius/data/volume.py b/invesalius/data/volume.py index 0078c15..8353878 100755 --- a/invesalius/data/volume.py +++ b/invesalius/data/volume.py @@ -343,7 +343,7 @@ class Volume(): image2 = convolve composite_function = vtk.vtkVolumeRayCastCompositeFunction() - composite_function.SetCompositeMethodToClassifyFirst() + composite_function.SetCompositeMethodToInterpolateFirst() gradientEstimator = vtk.vtkFiniteDifferenceGradientEstimator() gradientEstimator.SetGradientMagnitudeScale(1) @@ -352,9 +352,9 @@ class Volume(): #volume_mapper.AutoAdjustSampleDistancesOff() volume_mapper.SetInput(image2.GetOutput()) volume_mapper.SetVolumeRayCastFunction(composite_function) - volume_mapper.SetGradientEstimator(gradientEstimator) + #volume_mapper.SetGradientEstimator(gradientEstimator) volume_mapper.IntermixIntersectingGeometryOn() - + #Cut Plane CutPlane(image2.GetOutput(), volume_mapper) @@ -369,13 +369,21 @@ class Volume(): volume_properties.SetInterpolationTypeToLinear() volume_properties.SetColor(self.color_transfer) - self.volume_properties = volume_properties try: volume_properties.SetScalarOpacity(self.opacity_transfer_func) except NameError: pass + # Using these lines to improve the raycasting quality. These values + # seems related to the distance from ray from raycasting. + # TODO: Need to see values that improve the quality and don't decrease + # the performance. 2.0 seems to be a good value to pix_diag + pix_diag = 2.0 + volume_mapper.SetImageSampleDistance(0.25) + volume_mapper.SetSampleDistance(pix_diag / 5.0) + volume_properties.SetScalarOpacityUnitDistance(pix_diag) + self.volume_properties = volume_properties volume = vtk.vtkVolume() -- libgit2 0.21.2