Is it possible to implement an auto range function for vispy like we have for pyqtgraph? I have search but can't find any or an alternative way to implement it.
Here is the sample code
from itertools import cycle
import numpy as np
from vispy import app, scene, io
from vispy.color import get_colormaps, BaseColormap
# Read volume
vol2 = np.load(io.load_data_file('brain/mri.npz'))['data']
vol2 = np.flipud(np.rollaxis(vol2, 1))
# Prepare canvas
canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)
canvas.measure_fps()
# Set up a viewbox to display the image with interactive pan/zoom
view = canvas.central_widget.add_view()
# Set whether we are emulating a 3D texture
emulate_texture = False
# Create the volume visuals, only one is visible
volume1 = scene.visuals.Volume(vol2, parent=view.scene, threshold=0.225,
emulate_texture=emulate_texture)
# volume1.transform = scene.STTransform(translate=(64, 64, 0))
volume1.transform = scene.STTransform(scale=(3,3,3))
volume2 = scene.visuals.Volume(vol2, parent=view.scene, threshold=0.2,
emulate_texture=emulate_texture)
volume2.visible = False
print(volume1.bounds(0), volume1.bounds(1), volume1.bounds(2))
# Create two cameras (1 for firstperson, 3 for 3d person)
fov = 60.
cam1 = scene.cameras.FlyCamera(parent=view.scene, fov=fov)
cam2 = scene.cameras.TurntableCamera(parent=view.scene, fov=fov)
cam3 = scene.cameras.ArcballCamera(parent=view.scene, fov=fov)
view.camera = cam2 # Select turntable at first
if __name__ == '__main__':
print(__doc__)
app.run()