Commit 074a051bf7be56fdea3e206d229c8a0ae59999a3

Authored by Thiago Franco de Moraes
1 parent 4678f3c8
Exists in master

It was not possible to interact with raycasting when using GPU in VTK > 8.2 (fix #192)

Showing 1 changed file with 10 additions and 8 deletions   Show diff stats
invesalius/data/volume.py
... ... @@ -612,6 +612,7 @@ class Volume():
612 612 volume_mapper.IntermixIntersectingGeometryOn()
613 613 else:
614 614 volume_mapper = vtk.vtkGPUVolumeRayCastMapper()
  615 + volume_mapper.UseJitteringOn()
615 616 self.volume_mapper = volume_mapper
616 617  
617 618 self.SetTypeRaycasting()
... ... @@ -636,14 +637,15 @@ class Volume():
636 637 except NameError:
637 638 pass
638 639  
639   - # Using these lines to improve the raycasting quality. These values
640   - # seems related to the distance from ray from raycasting.
641   - # TODO: Need to see values that improve the quality and don't decrease
642   - # the performance. 2.0 seems to be a good value to pix_diag
643   - pix_diag = 2.0
644   - volume_mapper.SetImageSampleDistance(0.25)
645   - volume_mapper.SetSampleDistance(pix_diag / 5.0)
646   - volume_properties.SetScalarOpacityUnitDistance(pix_diag)
  640 + if not self.volume_mapper.IsA("vtkGPUVolumeRayCastMapper"):
  641 + # Using these lines to improve the raycasting quality. These values
  642 + # seems related to the distance from ray from raycasting.
  643 + # TODO: Need to see values that improve the quality and don't decrease
  644 + # the performance. 2.0 seems to be a good value to pix_diag
  645 + pix_diag = 2.0
  646 + volume_mapper.SetImageSampleDistance(0.25)
  647 + volume_mapper.SetSampleDistance(pix_diag / 5.0)
  648 + volume_properties.SetScalarOpacityUnitDistance(pix_diag)
647 649  
648 650 self.volume_properties = volume_properties
649 651  
... ...