Skip to content

Commit

Permalink
mask overlay in scribbler
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Nov 20, 2024
1 parent f731ab4 commit f7ba6da
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions autogalaxy/gui/scribbler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -16,6 +13,7 @@ def __init__(
cmap=None,
brush_width=0.05,
backend="TkAgg",
mask_overlay=None
):
"""
Expand All @@ -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:
Expand Down

0 comments on commit f7ba6da

Please sign in to comment.