xopto.util.sliceview module¶
- class DualSliceView(data: numpy.ndarray, axis1: int = 0, slices1: Optional[numpy.ndarray] = None, slice1_label: Optional[str] = None, slice1_valfmt: Optional[str] = None, axis2: int = 0, slices2: Optional[numpy.ndarray] = None, slice2_label: Optional[str] = None, slice2_valfmt: Optional[str] = None, logscale: bool = False, autoscale: bool = False, xlabel: Optional[str] = None, ylabel: Optional[str] = None, title: Optional[str] = None, **kwargs)[source]¶
Bases:
object
Creates a matplotlib-based slice viewer of 3D data cubes along one axis.
- Parameters
data (np.ndarray) – A 3D Data array.
axis1 (int) –
The first axis along which to slice the data. Assuming that the dimensions of the data are (z, y, x, t), the produced slices are as follows:
along = 0; slicing along the z axis, slice dimensions (y, x)
along = 1; slicing along the y axis, slice dimensions (z, x)
along = 2; slicing along the x axis, slice dimensions (z, y)
along = 3; slicing along the x axis, slice dimensions (z, y)
along = 4; slicing along the t axis, slice dimensions (z, y)
Note that the first dimension of the slice will be shown along the vertical/y axis of the slice image and the second dimension of the slice along the horizontal/x axis of the slice image.
slices1 (np.ndarray) – A vector that defines the positions of slices. If None, a default sequence of positions from 0 to num_slices - 1 is created.
slice1_label (str) – Label of the slider along the axis1 axis.
slice1_valfmt (str) – Slice along axis1 - value format string.
axis2 (int) –
The first axis along which to slice the data. Assuming that the dimensions of the data are (z, y, x, t), the produced slices are as follows:
along = 0; slicing along the z axis, slice dimensions (y, x)
along = 1; slicing along the y axis, slice dimensions (z, x)
along = 2; slicing along the x axis, slice dimensions (z, y)
along = 3; slicing along the x axis, slice dimensions (z, y)
along = 4; slicing along the t axis, slice dimensions (z, y)
Note that the first dimension of the slice will be shown along the vertical/y axis of the slice image and the second dimension of the slice along the horizontal/x axis of the slice image.
slices2 (np.ndarray) – A vector that defines the positions of slices. If None, a default sequence of positions from 0 to num_slices - 1 is created.
slice2_label (str) – Label of the slider along the axis2 axis.
slice2_valfmt (str) – Slice along axis2 - value format string.
logscale (bool or Callable[[np.ndarray], np.ndarray]) –
A bool value enables or disables the logarithmic scaling of the data that is computed as:
np.log10(slice_data + 1)
if data are strictly positivenp.log10(slice_dat - data.min() + 1)
if data include negative values
If a callable, all data are scaled with this function.
autoscale (bool) – Automatically adjust the intensity range of the image to the current slice minimum and maximum intensity.
title (str) – Slice title. This can be a format string with placeholders for the slice number “{slice1}” or “{slice2}”, total number of slices “{num_slices1}” od “{num_slices2}” and position of the slice “{pos1}” or “{pos2}”.
xlabel (str) – Label of the x axis.
ylabel (str) – Label of the y axis.
kwargs (dict) – Additional keyword arguments that are passed to pyplot.imshow.
- property axis¶
Image axis.
- property fig¶
Figure instance.
- class DualSliceViewCyl(data: numpy.ndarray, axis1: int = 0, slices1: Optional[numpy.ndarray] = None, slice1_label: Optional[str] = None, slice1_valfmt: Optional[str] = None, axis2: int = 0, slices2: Optional[numpy.ndarray] = None, slice2_label: Optional[str] = None, slice2_valfmt: Optional[str] = None, polar: bool = False, logscale: bool = False, autoscale: bool = False, xlabel: Optional[str] = None, ylabel: Optional[str] = None, title: Optional[str] = None, **kwargs)[source]¶
Bases:
object
Creates a matplotlib-based slice viewer of 3D data cubes along one axis.
- Parameters
data (np.ndarray) – A 3D Data array.
axis1 (int) –
The axis along which to slice the data. Assuming that the dimensions of the data are (z, fi, r), the produced slices are as follows:
along = 0; slicing along the z axis, slice dimensions (fi, r)
along = 1; slicing along the fi axis, slice dimensions (z, r)
along = 2; slicing along the z axis, slice dimensions (z, fi)
slices1 (np.ndarray) – A vector that defines the positions of slices along axis1. If None, a default sequence of positions from 0 to num_slices - 1 is created.
slice1_label (str) – Label of the slider along the axis1 axis.
slice1_valfmt (str) – Slice along axis1 - value format string.
axis2 (int) –
The axis along which to slice the data. Assuming that the dimensions of the data are (z, fi, r), the produced slices are as follows:
along = 0; slicing along the z axis, slice dimensions (fi, r)
along = 1; slicing along the fi axis, slice dimensions (z, r)
along = 2; slicing along the z axis, slice dimensions (z, fi)
slices2 (np.ndarray) – A vector that defines the positions of slices along axis2. If None, a default sequence of positions from 0 to num_slices - 1 is created.
slice2_label (str) – Label of the slider along the axis2 axis.
slice2_valfmt (str) – Slice along axis1 - value format string.
polar (bool) – Set to True if the slice is ‘r-fi’. Note that the slice data is expected in order (…, r, fi, …).
logscale (bool or Callable[[np.ndarray], np.ndarray]) –
A bool value enables or disables the logarithmic scaling of the data that is computed as:
np.log10(slice_data + 1)
if data are strictly positivenp.log10(slice_dat - data.min() + 1)
if data include negative values
If a callable, all data are scaled with this function.
autoscale (bool) – Automatically adjust the intensity range of the image to the current slice minimum and maximum intensity.
title (str) – Slice title. This can be a format string with placeholders for the slice number “{slice}”, total number of slices “{num_slices}” and position of the slice “{pos}”.
xlabel (str) – Label of the x axis.
ylabel (str) – Label of the y axis.
kwargs (dict) – Additional keyword arguments that are passed to pyplot.imshow or pyplot.pcolormesh.
- property axis¶
Image axis.
- property fig¶
Figure instance.
- class SliceView(data: numpy.ndarray, axis: int = 0, slices: Optional[numpy.ndarray] = None, slice_valfmt: Optional[str] = None, slice_label: Optional[str] = None, logscale: bool = False, autoscale: bool = False, xlabel: Optional[str] = None, ylabel: Optional[str] = None, title: Optional[str] = None, **kwargs)[source]¶
Bases:
object
Creates a matplotlib-based slice viewer of 3D data cubes along one axis.
- Parameters
data (np.ndarray) – A 3D Data array.
axis (int) –
The axis along which to slice the data. Assuming that the dimensions of the data are (z, y, x), the produced slices are as follows:
along = 0; slicing along the z axis, slice dimensions (y, x)
along = 1; slicing along the y axis, slice dimensions (z, x)
along = 2; slicing along the x axis, slice dimensions (z, y)
Note that the first dimension of the slice will be shown along the vertical/y axis of the slice image and the second dimension of the slice along the horizontal/x axis of the slice image.
slices (np.ndarray) – A vector that defines the positions of slices. If None, a default sequence of positions from 0 to num_slices - 1 is created.
slice_valfmt (str) – Slice along axis1 - value format string.
slice_label (str) – Label of the slider along the axis1 axis.
logscale (bool or Callable[[np.ndarray], np.ndarray]) –
A bool value enables or disables the logarithmic scaling of the data that is computed as:
np.log10(slice_data + 1)
if data are strictly positivenp.log10(slice_dat - data.min() + 1)
if data include negative values
If a callable, all data are scaled with this function.
autoscale (bool) – Automatically adjust the intensity range of the image to the current slice minimum and maximum intensity.
title (str) – Slice title. This can be a format string with placeholders for the slice number “{slice}”, total number of slices “{num_slices}” and position of the slice “{pos}”.
xlabel (str) – Label of the x axis.
ylabel (str) – Label of the y axis.
kwargs (dict) – Additional keyword arguments that are passed to pyplot.imshow.
- property axis¶
Image axis.
- property fig¶
Figure instance.
- class SliceViewCyl(data: numpy.ndarray, axis: int = 0, slices: Optional[numpy.ndarray] = None, polar=False, logscale: bool = False, autoscale: bool = False, xlabel: Optional[str] = None, ylabel: Optional[str] = None, title: Optional[str] = None, **kwargs)[source]¶
Bases:
object
Creates a matplotlib-based slice viewer of 3D data cubes along one axis.
- Parameters
data (np.ndarray) – A 3D Data array.
axis (int) –
The axis along which to slice the data. Assuming that the dimensions of the data are (z, fi, r), the produced slices are as follows:
along = 0; slicing along the z axis, slice dimensions (fi, r)
along = 1; slicing along the fi axis, slice dimensions (z, r)
along = 2; slicing along the z axis, slice dimensions (z, fi)
polar (bool) – Set to True if the slice is ‘r-fi’. Note that the slice data is expected in order (…, r, fi, …).
slices (np.ndarray) – A vector that defines the positions of slices. If None, a default sequence of positions from 0 to num_slices - 1 is created.
logscale (bool or Callable[[np.ndarray], np.ndarray]) –
A bool value enables or disables the logarithmic scaling of the data that is computed as:
np.log10(slice_data + 1)
if data are strictly positivenp.log10(slice_dat - data.min() + 1)
if data include negative values
If a callable, all data are scaled with this function.
autoscale (bool) – Automatically adjust the intensity range of the image to the current slice minimum and maximum intensity.
title (str) – Slice title. This can be a format string with placeholders for the slice number “{slice}”, total number of slices “{num_slices}” and position of the slice “{pos}”.
xlabel (str) – Label of the x axis.
ylabel (str) – Label of the y axis.
kwargs (dict) – Additional keyword arguments that are passed to pyplot.imshow or pyplot.pcolormesh.
- property axis¶
Image axis.
- property fig¶
Figure instance.