plot_inset

deepinv.utils.plot_inset(img_list: List[Tensor], titles: List[str] | None = None, labels: List[str] = [], label_loc: Tuple | List = (0.03, 0.03), extract_loc: Tuple | List = (0.0, 0.0), extract_size: float = 0.2, inset_loc: Tuple | List = (0.0, 0.5), inset_size: float = 0.4, figsize: Tuple[int] | None = None, save_fn: str | None = None, dpi: int = 1200, show: bool = True, return_fig: bool = False, cmap: str = 'gray')[source]

Plots a list of images with zoomed-in insets extracted from the images.

The inset taken from extract_loc and shown at inset_loc. The coordinates extract_loc, inset_loc, and label_loc correspond to their top left corners taken at (horizontal, vertical) from the image’s top left.

Each loc can either be a tuple (float, float) which uses the same loc for all images across the batch dimension, or a list of these whose length must equal the batch dimension.

Coordinates are fractions from 0-1, (0, 0) is the top left corner and (1, 1) is the bottom right corner.

Parameters:
  • img_list (list[torch.Tensor], torch.Tensor) – list of images to plot or single image.

  • titles (list[str]) – list of titles for each image, has to be same length as img_list.

  • labels (list[str]) – list of overlaid labels for each image, has to be same length as img_list.

  • label_loc (list, tuple) – location or locations for label to be plotted on image, defaults to (.03, .03)

  • extract_loc (list, tuple) – image location or locations for extract to be taken from, defaults to (0., 0.)

  • extract_size (float) – size of extract to be taken from image, defaults to 0.2

  • inset_loc (list, tuple) – location or locations for inset to be plotted on image, defaults to (0., 0.5)

  • inset_size (float) – size of inset to be plotted on image, defaults to 0.4

  • figsize (tuple[int]) – size of the figure.

  • save_fn (str) – filename for plot to be saved, if None, don’t save, defaults to None

  • dpi (int) – DPI to save images.

  • show (bool) – show the image plot.

  • return_fig (bool) – return the figure object.

Examples using plot_inset:

Radio interferometric imaging with deepinverse

Radio interferometric imaging with deepinverse