Utilities for viewing images
Includes version of OrthoSlicer3D code originally written by our own Paul Ivanov.
OrthoSlicer3D(data[, affine, axes, title]) | Orthogonal-plane slice viewer. |
Bases: object
Orthogonal-plane slice viewer.
OrthoSlicer3d expects 3- or 4-dimensional array data. It treats 4D data as a sequence of 3D spatial volumes, where a slice over the final array axis gives a single 3D spatial volume.
For 3D data, the default behavior is to create a figure with 3 axes, one for each slice orientation of the spatial volume.
Clicking and dragging the mouse in any one axis will select out the corresponding slices in the other two. Scrolling up and down moves the slice up and down in the current axis.
For 4D data, the fourth figure axis can be used to control which 3D volume is displayed. Alternatively, the - key can be used to decrement the displayed volume and the + or = keys can be used to increment it.
Examples
>>> import numpy as np
>>> a = np.sin(np.linspace(0, np.pi, 20))
>>> b = np.sin(np.linspace(0, np.pi*5, 20))
>>> data = np.outer(a, b)[..., np.newaxis] * a
>>> OrthoSlicer3D(data).show()
Parameters: | data : array-like
affine : array-like or None, optional
axes : tuple of mpl.Axes or None, optional
title : str or None, optional
|
---|
Parameters: | data : array-like
affine : array-like or None, optional
axes : tuple of mpl.Axes or None, optional
title : str or None, optional
|
---|
The current color limits
Close the viewer figures
The current colormap
Redraw the current image
A tuple of the figure(s) containing the axes
Link positional changes between two canvases
Parameters: | other : instance of OrthoSlicer3D
|
---|
Number of volumes in the data
The current coordinates
Set current displayed slice indices
Parameters: | x : float | None
y : float | None
z : float | None
|
---|
Set current displayed volume index
Parameters: | v : int
|
---|
Show the slicer in blocking mode; convenience for plt.show()