Displaying scalar images

PyLorentz.visualize.show.show_im(image, title=None, scale=None, simple=False, save=None, cmap='gray', figax=None, roi=None, cbar_title=None, cbar=None, intensity_range='minmax', origin='upper', **kwargs)[source]

Display an image with optional features like colorbar, title, and scale.

Parameters:
  • image (np.ndarray) – 2D image to be displayed.

  • title (str, optional) – Title of the plot.

  • scale (float, optional) – Scale in nm/pixel for axis markers.

  • simple (bool) – Simplified display without colorbar and labels.

  • save (str, optional) – Path to save the figure.

  • cmap (str) – Colormap for displaying the image.

  • figax (tuple, optional) – Figure and axis to plot on.

  • roi (dict, optional) – Region of interest to highlight.

  • cbar_title (str, optional) – Title for the colorbar.

  • cbar (bool, optional) – Whether to display the colorbar.

  • intensity_range (str) – Method to set intensity range. ‘minmax’ or ‘ordered’.

  • origin (str) – Image origin (‘upper’ or ‘lower’).

  • **kwargs – Additional keyword arguments.

Return type:

None

Returns:

None

PyLorentz.visualize.show.show_stack(images, titles=None, scale_each=True, **kwargs)[source]

Display a stack of images interactively using a slider.

Parameters:
  • images (list) – List of 2D numpy arrays representing the images.

  • titles (list, optional) – List of titles for each image.

  • scale_each (bool) – Scale each image individually or use the same scale.

Return type:

None

Returns:

None

PyLorentz.visualize.show.show_sims(phi, im_un, im_in, im_ov, title=None, save=None)[source]

Plot phase, underfocus, infocus, and overfocus images in one plot.

Parameters:
  • phi (np.ndarray) – Image of phase shift.

  • im_un (np.ndarray) – Underfocus image.

  • im_in (np.ndarray) – Infocus image.

  • im_ov (np.ndarray) – Overfocus image.

  • title (str, optional) – Title for the plot.

  • save (str, optional) – Path to save the figure.

Return type:

None

Returns:

None

PyLorentz.visualize.show.show_im_peaks(im=None, peaks=None, peaks2=None, title=None, cbar=False, **kwargs)[source]

Show image with overlaid peaks.

Parameters:
  • im (np.ndarray, optional) – Image to display.

  • peaks (np.ndarray, optional) – Peaks to overlay on the image.

  • peaks2 (np.ndarray, optional) – Second set of peaks to overlay.

  • title (str, optional) – Title for the plot.

  • cbar (bool) – Whether to display a colorbar.

Return type:

None

Returns:

None

PyLorentz.visualize.show.tick_label_formatter(ticks, fov, scale, scale_unit=None)[source]

Format tick labels for display.

Parameters:
  • ticks (np.ndarray) – Tick positions.

  • fov (float) – Field of view.

  • scale (float) – Scale in nm/pixel.

  • scale_unit (str, optional) – Units for the scale.

Returns:

Formatted labels and unit.

Return type:

tuple[List[str], str]

PyLorentz.visualize.show.show_fft(im, window=True, log=False, alpha=1, gaussian_sigma1=0, gaussian_sigma2=0, **kwargs)[source]

Compute and display the FFT of an image with logarithmic scaling.

Parameters:
  • im (np.ndarray) – the image for which the FFT will be computed and displayed.

  • window (bool) – Whether or not to window the image before taking the fft. Default True.

  • **kwargs – Additional keyword arguments passed to show_im.

Return type:

None

Returns:

None

PyLorentz.visualize.show.lineplot_im(image, center=None, phi=0, linewidth=1, line_len=-1, show=False, **kwargs)[source]

Generate a line plot through an image.

Parameters:
  • image (np.ndarray) – Image to analyze.

  • center (tuple, optional) – Center point for the line plot (cy, cx).

  • phi (float) – Angle for the line plot in degrees.

  • linewidth (int) – Line width for the plot.

  • line_len (int) – Length of the line plot.

  • show (bool) – Whether to display the plot.

  • **kwargs – Additional keyword arguments passed to show_im()

Returns:

Line plot data.

Return type:

np.ndarray

PyLorentz.visualize.show.tukey2D(shape, alpha=0.5)[source]
Return type:

ndarray