From f7ba6da25098025dfa68a81bae62fae68ba14620 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Wed, 20 Nov 2024 18:51:02 +0000 Subject: [PATCH] mask overlay in scribbler --- autogalaxy/gui/scribbler.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/autogalaxy/gui/scribbler.py b/autogalaxy/gui/scribbler.py index d8183f50..99bfdf1d 100644 --- a/autogalaxy/gui/scribbler.py +++ b/autogalaxy/gui/scribbler.py @@ -2,9 +2,6 @@ import numpy as np import matplotlib import matplotlib.pyplot as plt -import matplotlib.colors as colors - -from skimage.transform import rescale class Scribbler: @@ -16,6 +13,7 @@ def __init__( cmap=None, brush_width=0.05, backend="TkAgg", + mask_overlay=None ): """ @@ -33,11 +31,18 @@ def __init__( # create initial plot self.figure = plt.figure() self.ax = self.figure.add_subplot(111) + if cmap is None: plt.imshow(image, interpolation="none") else: norm = cmap.norm_from(array=image) plt.imshow(image, cmap=cmap.config_dict["cmap"], norm=norm) + + if mask_overlay is not None: + grid = mask_overlay.derive_grid.edge + grid = mask_overlay.geometry.grid_pixel_centres_2d_from(grid_scaled_2d=grid) + plt.scatter(y=grid[:, 0], x=grid[:, 1], c="k", marker="x", s=10) + plt.axis([0, image.shape[1], image.shape[0], 0]) plt.axis("off") # if title: