Graph_lib
- PlotShiftVectors(shift_vectors: ndarray, pxsize: float = 1, labels: bool = True, color: ndarray | None = None, cmap: str = 'summer_r', fig: Figure | None = None, ax: axis | None = None)[source]
It plots the shift vectors in a scatter plot. It returns the corresponding figure and axis.
- Parameters:
shift_vectors (np.ndarray) – Array of the coordinates of the shift vectors (Nch x 2).
pxsize (float, optional) – Pixel size in micrometers (um). The default is 1.
labels (bool, optional) – If true, the channel number is printed close to each point. The default is True.
color (np.ndarray, optional) – Array defining the color value (Nch). The default is None.
cmap (str, optional) – Colormap, to be chosen within the matplotlib list. The default is ‘summer_r’.
fig (plt.Figure, optional) – Figure where to display the plot. If None, a new figure is created. The default is None.
ax (plt.axis, optional) – Axis where to display the plot. If None, a new axis is created. The default is None.
- Returns:
fig (plt.Figure) – Matplotlib figure.
ax (plt.axis) – Matplotlib axis.
- ShowDataset(dset: ndarray, cmap: str = 'hot', pxsize: float | None = None, normalize: bool = False, colorbar: bool = False, xlims: list = [None, None], ylims: list = [None, None], extent=None, figsize: tuple = (6, 6), gridshape=None) Figure[source]
It displays all the images of the ISM dataset in a squared grid. It returns the corresponding figure.
- Parameters:
dset (np.ndarray) – ISM dataset (Nx x Ny x Nch).
cmap (str, optional) – Colormap, to be chosen within the matplotlib list. The default is ‘hot’.
pxsize (float, optional) – Pixel size in micrometers (um). The default is None.
normalize (bool, optional) – If True, each image is normalized with respect to the whole dataset. If False, each image is normalized to itself. The default is False.
colorbar (bool, optional) – If true, a colorbar is shown. The default is False.
xlims (list, optional) – If given, only the region with the x-range is displayed. The default is [None, None].
ylims (list, optional) – If given, only the region with the y-range is displayed. The default is [None, None].
figsize (tuple, optional) – Size of the figure. The default is (6, 6).
- Returns:
fig – Matplotlib figure.
- Return type:
plt.Figure
- ShowFingerprint(dset: ndarray, cmap: str = 'hot', colorbar: bool = False, clabel: str | None = None, normalize: bool = False, fig: Figure | None = None, ax: axis | None = None, hex_grid=False, name=None)[source]
It calculates and shows the fingerprint of an ISM dataset. It returns the corresponding figure and axis.
- Parameters:
dset (np.ndarray) – ISM dataset (Nx x Ny x Nch).
cmap (str, optional) – Colormap, to be chosen within the matplotlib list. The default is ‘hot’.
colorbar (bool, optional) – If true, a colorbar is shown. The default is False
clabel (str, optional) – Label of the colorbar. The default is None
normalize (bool, optional) – If true, the fingerprint values are normalized between 0 and 1. The default is False
fig (plt.Figure, optional) – Figure where to display the plot. If None, a new figure is created. The default is None.
ax (plt.axis, optional) – Axis where to display the plot. If None, a new axis is created. The default is None.
- Returns:
fig (plt.Figure) – Matplotlib figure.
ax (plt.axis) – Matplotlib axis.
- ShowImg(image: ndarray, pxsize_x: float, clabel: str | None = None, vmin: float | None = None, vmax: float | None = None, fig: Figure | None = None, ax: axis | None = None, colorbar: bool = True, cmap: str = 'hot', integer_values=True, log_scale: bool = False)[source]
It shows the input image with a scalebar and a colorbar. It returns the corresponding figure and axis.
- Parameters:
image (np.ndarray) – Image (Nx x Ny).
pxsize_x (float) – Pixel size in micrometers (um).
clabel (str) – Label of the colorbar.
vmin (float, optional) – Lower bound of the intensity axis. If None, is set to the minimum value of the image. The default is None.
vmax (float, optional) – Upper bound of the intensity axis. If None, is set to the maximum value of the image. The default is None.
fig (plt.Figure, optional) – Figure where to display the plot. If None, a new figure is created. The default is None.
ax (plt.axis, optional) – Axis where to display the plot. If None, a new axis is created. The default is None.
colormap (bool, optional) – If True, a colormap is shown. The default is True.
cmap (str, optional) – Colormap, to be chosen within the matplotlib list. The default is ‘hot’.
- Returns:
fig (plt.Figure) – Matplotlib figure.
ax (plt.axis) – Matplotlib axis.
- ShowStack(image: ndarray, pxsize_x: float, pxsize_z: float, clabel: str | None = None, planes: tuple | None = None, projection=None, vmin: float | None = None, vmax: float | None = None, cmap: str = 'hot', figsize: tuple = (10, 10))[source]
It shows the input image with a scalebar and a colorbar. It returns the corresponding figure and axis.
- Parameters:
image (np.ndarray) – Image (Nz x Ny x Nx).
pxsize_x (float) – Lateral ixel size in micrometers (um).
pxsize_z (float) – Axial pixel size in micrometers (um).
clabel (str) – Label of the colorbar.
planes (tuple) – Coordinates (z0, x0, y0) of the slices.
cmap (str, optional) – Colormap, to be chosen within the matplotlib list. The default is ‘hot’.
figsize (tuple) – Size of the figure. The default is (10, 10).
- Returns:
fig – Matplotlib figure.
- Return type:
plt.Figure
- StackSlider(image: ndarray, pxsize_x: float, pxsize_z: float, clabel: str | None = None, cmap: str = 'hot', figsize: tuple = (10, 10))[source]
- depth_stack(stack: ndarray, pxsize: list, pxdwelltime: float, axis: int = 0, colormap='rainbow', fig=None, ax=None)[source]
Display the maximum intensity projection of stack, where intensity and depth image are represented with a 2D colormap. Referring to the HSV color model: Intensity values are mapped in Value Depth values are mapped in Hue
- Parameters:
stack (np.ndarray) – 3D image (Nz x Ny x Nx).
pxsize (list) – List of pixel size of each dimension, in um [px_z, px_y, px_x].
pxdwelltime (float) – Pixel dwell time, in us.
axis (int, optional) – Projection axis. The default is 0 (zeta).
colormap (str, optional) – Matplotlib colormap used to represent lifetime values. The default is ‘rainbow’
fig (plt.Figure, optional) – Figure where to display the plot. If None, a new figure is created. The default is None.
ax (plt.axis, optional) – Axis where to display the plot. If None, a new axis is created. The default is None.
- Returns:
fig (plt.Figure) – Figure that contains the image and the colormap.
ax (plt.axis) – Axis array that contain the image and the colormap..
- show_flim(image: ndarray, lifetime: ndarray, pxsize: list, pxdwelltime: float, lifetime_bounds: list | None = None, intensity_bounds: list | None = None, colormap='gist_rainbow', fig=None, ax=None)[source]
Display the flim image, where intensity and lifetime image are represented with a 2D colormap. Referring to the HSV color model: Intensity values are mapped in Value Lifetime values are mapped in Hue
- Parameters:
image (np.ndarray) – 2D intensity image (Ny x Nx).
lifetime (np.ndarray) – 2D lifetime map (Ny x Nx).
pxsize (list) – Lateral pixel size, in um.
pxdwelltime (float) – Pixel dwell time, in us.
lifetime_bounds (list, optional) – Lifetime bounds of the colormap
intensity_bounds (list, optional) – Intensity bounds of the colormap
colormap (str, optional) – Matplotlib colormap used to represent lifetime values. The default is ‘rainbow’
fig (plt.Figure, optional) – Figure where to display the plot. If None, a new figure is created. The default is None.
ax (plt.axis, optional) – Axis where to display the plot. If None, a new axis is created. The default is None.
- Returns:
fig (plt.Figure) – Figure that contains the image and the colormap.
ax (plt.axis) – Axis array that contain the image and the colormap..