diff --git a/larch/wxxrd/xrd1d_display.py b/larch/wxxrd/xrd1d_display.py index 0d2c533fc..6a8ef7acd 100644 --- a/larch/wxxrd/xrd1d_display.py +++ b/larch/wxxrd/xrd1d_display.py @@ -347,6 +347,11 @@ def createMenus(self): self.unset_mask_menu = m m.Enable(False) + m = MenuItem(self, cmenu, "Show Mask Image", + "Show image of mask", self.onShowMask) + self.show_mask_menu = m + m.Enable(False) + menubar = wx.MenuBar() menubar.Append(fmenu, "&File") menubar.Append(cmenu, "&Calibration and Mask") @@ -422,6 +427,7 @@ def onUnsetMask(self, event=None): if dlg.GetResponse(): self.mask = None self.unset_mask_menu.Enable(False) + self.show_mask_menu.Enable(False) def onReadMask(self, event=None): sfile = FileOpen(self, 'Read Mask Image File', @@ -439,11 +445,17 @@ def onReadMask(self, event=None): if valid_mask: self.mask = (1 - img[::-1, :]).astype(img.dtype) self.unset_mask_menu.Enable(True) + self.show_mask_menu.Enable(True) else: title = "Could not use mask file" message = [f"Could not use {sfile:s} as a mask file"] o = ExceptionPopup(self, title, message) + def onShowMask(self, event=None): + if self.mask is not None: + imd = self.get_imdisplay() + imd.display(self.mask, colomap='gray', auto_contrast=True) + def onReadTIFF(self, event=None): sfile = FileOpen(self, 'Read TIFF XRD Image', default_file='XRD.tiff',