Skip to content

Commit

Permalink
Issue #222: Fix use of VTK threshold API, deprecated in vtk 9.3+
Browse files Browse the repository at this point in the history
  • Loading branch information
MattClarkson committed Feb 12, 2024
1 parent 8635bbf commit e547350
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -3,7 +3,7 @@
# It is not to be confused with the software requirements,
# which are listed in requirements-dev.rst and requirements-docs.rst
numpy>=1.11
vtk==9.2.6
vtk>=9.2.6
PySide6>=6.5.1.1
opencv-contrib-python-headless>=4.2.0.32
scikit-surgerycore>=0.1.7
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -52,7 +52,7 @@

install_requires=[
'numpy>=1.11',
'vtk==9.2.6',
'vtk>=9.2.6',
'PySide6>=6.5.1.1',
'opencv-contrib-python-headless>=4.2.0.32',
'scikit-surgerycore>=0.1.7',
Expand Down
3 changes: 2 additions & 1 deletion sksurgeryvtk/models/voxelise.py
Expand Up @@ -606,7 +606,8 @@ def apply_displacement_to_mesh(mesh: Union[vtk.vtkDataObject, str],
0,
vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS,
"preoperativeSurface")
threshold.ThresholdByLower(0)
threshold.SetLowerThreshold(0)
threshold.SetThresholdFunction(threshold.THRESHOLD_LOWER)
threshold.SetInputData(field)
threshold.Update()
fieldInternal = threshold.GetOutput()
Expand Down
4 changes: 3 additions & 1 deletion sksurgeryvtk/models/vtk_grid_model.py
Expand Up @@ -125,5 +125,7 @@ def threshold_between(self, lower: float, upper: float):
:param upper: Upper limit
:type upper: float
"""
self.threshold.ThresholdBetween(lower, upper)
self.threshold.SetLowerThreshold(lower)
self.threshold.SetUpperThreshold(upper)
self.threshold.SetThresholdFunction(self.threshold.THRESHOLD_BETWEEN)
self.threshold.Update()

0 comments on commit e547350

Please sign in to comment.