From de6cdeab6971b355b8c7a442f1bd7669f4b4d5e3 Mon Sep 17 00:00:00 2001 From: Yu-An Chen Date: Wed, 25 Sep 2019 09:26:02 -0400 Subject: [PATCH 1/2] Remove unused argument --- ashlar/reg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ashlar/reg.py b/ashlar/reg.py index 0fde4e34..8bfd3e9e 100644 --- a/ashlar/reg.py +++ b/ashlar/reg.py @@ -908,7 +908,7 @@ def _load_single_profile(self, path, num_channels, img_size, profile_type): return profile - def _load_correction_profiles(self, dfp_path, ffp_path, profile_tpye): + def _load_correction_profiles(self, dfp_path, ffp_path): if dfp_path is None and ffp_path is None: self.do_correction = False else: From eeb8c8cc542027f716f36fce059ba5a3492b1b33 Mon Sep 17 00:00:00 2001 From: Yu-An Chen Date: Wed, 15 Jun 2022 14:53:20 -0700 Subject: [PATCH 2/2] Allow fill mosaic canvas with custom value --- ashlar/reg.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ashlar/reg.py b/ashlar/reg.py index e289c42b..92b18a86 100644 --- a/ashlar/reg.py +++ b/ashlar/reg.py @@ -1065,10 +1065,12 @@ def _load_correction_profiles(self, dfp_path, ffp_path): self.dfp /= np.iinfo(self.dtype).max self.do_correction = True - def assemble_channel(self, channel, out=None): + def assemble_channel(self, channel, out=None, fill_blank_value=None): num_tiles = len(self.aligner.positions) if out is None: out = np.zeros(self.shape, self.dtype) + if fill_blank_value is not None: + mask = np.ones(self.shape, bool) else: if out.shape != self.shape: raise ValueError( @@ -1082,6 +1084,10 @@ def assemble_channel(self, channel, out=None): img = self.aligner.reader.read(c=channel, series=si) img = self.correct_illumination(img, channel) utils.paste(out, img, position, func=utils.pastefunc_blend) + if fill_blank_value is not None: + utils.paste(mask, np.zeros_like(img, bool), position) + if fill_blank_value is not None: + out[mask] = fill_blank_value # Memory-conserving axis flips. if self.flip_mosaic_x: for i in range(len(out)):