Commit dd15128c authored by Thomas Dowrick's avatar Thomas Dowrick

Issue #90: Fix fixes after review by Steve

parent 21d89be1
Pipeline #3928 passed with stages
in 6 minutes and 13 seconds
......@@ -3,6 +3,9 @@
`python vtk_reslice.py` - loads Viewer with mouse wheel scrolling.
'python vtk_reslice.py tracked' - loads Viewer with ArUco tracker for
slice control.
NB: scikit-surgeryaruco is not installed by default with scikit-surgeryvtk
You should pip install it manually to run the tracked demo.
"""
import sys
......@@ -13,7 +16,7 @@ from sksurgeryarucotracker.arucotracker import ArUcoTracker
qApp = QtWidgets.QApplication([])
dicom_path = 'tests/data/dicom/LegoPhantom_3slices'
dicom_path = 'tests/data/dicom/LegoPhantom_10slices'
n_args = len(sys.argv)
if n_args > 1 and sys.argv[1] == "tracked":
......
......@@ -107,6 +107,18 @@ class VTKResliceWidget(QVTKRenderWindowInteractor):
""" Return the current slice position. """
return self.position
def reset_position(self):
""" Set slice position to the middle of the axis. """
if self.axis == 'x':
lower, upper = self.x_min, self.x_max
if self.axis == 'y':
lower, upper = self.y_min, self.y_max
if self.axis == 'z':
lower, upper = self.z_min, self.z_max
self.set_slice_position(lower + (upper - lower) // 2)
def on_mouse_wheel_forward(self, obj, event):
#pylint:disable=unused-argument
""" Callback to change slice position using mouse wheel. """
......@@ -183,10 +195,13 @@ class VTKSliceViewer(QtWidgets.QWidget):
self.z_view.set_slice_position(z_pos)
self.fourth_panel.GetRenderWindow().Render()
def reset_slice_positions(self):
""" Set slcie positions to some default values. """
self.update_slice_positions(0, 0, 0)
self.x_view.reset_position()
self.y_view.reset_position()
self.z_view.reset_position()
self.fourth_panel.GetRenderWindow().Render()
class MouseWheelSliceViewer(VTKSliceViewer):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment