code: def vis_coordinates(
      image, coordinates=None, saving_name="image.png", dpi=50
  ):
      """
      Plot image, and on top of it, draw boxes with the window coordinates
      the figure is saved at `saving_name`
      """
      fig, ax = plt.subplots(1)
      ax.imshow(image, cmap="gray")
      all_patch = []
      if coordinates is not None:
          for win in coordinates[::-1]:
              patch = patches.Rectangle(
                  xy=(win[2], win[1]),
                  width=win[5] - win[2],
                  height=win[4] - win[1],
                  linewidth=1,
              )
              all_patch.append(patch)
      if all_patch:
          all_pc = PatchCollection(
              all_patch, alpha=0.6, edgecolor="r", facecolor="#f5e44c"
          )
          ax.add_collection(all_pc)
      #  plt.show()
      if saving_name:
          fig.savefig(
              saving_name, bbox_inches="tight", pad_inches=0, dpi=dpi
          )
          return
  
file_path: NiftyNet/demos/module_examples/visualise_coordinates.py
imports: import sys
  import matplotlib
  import numpy
  import tensorflow
  import matplotlib.pyplot
  import matplotlib.patches
  from matplotlib.collections import PatchCollection
  from niftynet.io.image_reader import ImageReader
  from niftynet.engine.image_window_dataset import ImageWindowDataset
  from niftynet.engine.sampler_uniform_v2 import UniformSampler
  from niftynet.engine.sampler_grid_v2 import GridSampler
  from niftynet.engine.windows_aggregator_base import ImageWindowsAggregator
  from niftynet.layer.pad import PadLayer
label_desc: Use image node_id 1 for calling a global function with example usage: vis_coordinates(image, coordinates, saving_name, dpi) without return types