diff --git a/processor/flow.py b/processor/flow.py index 7deb932..0a417c1 100644 --- a/processor/flow.py +++ b/processor/flow.py @@ -107,11 +107,11 @@ def __init__(self, config: Config, input_volinfo_or_ts_spec=None): self._config = config assert config.patch_size % config.stride == 0 - if config.mask_configs is not None: + if config.mask_configs: if isinstance(config.mask_configs, str): config.mask_configs = self._get_mask_configs(config.mask_configs) - if config.selection_mask_configs is not None: + if config.selection_mask_configs: if isinstance(config.selection_mask_configs, str): config.selection_mask_configs = self._get_mask_configs( config.selection_mask_configs @@ -169,10 +169,10 @@ def process(self, subvol: Subvolume) -> SubvolumeOrMany: sel_mask = mask = None with beam_utils.timer_counter(self.namespace, 'build-mask'): - if self._config.mask_configs is not None: + if self._config.mask_configs: mask = self._build_mask(self._config.mask_configs, box) - if self._config.selection_mask_configs is not None: + if self._config.selection_mask_configs: sel_box = box.scale( [1.0 / self._config.stride, 1.0 / self._config.stride, 1] ) @@ -374,7 +374,7 @@ def __init__( assert a.pixel_size.x / b.pixel_size.x == a.pixel_size.y / b.pixel_size.y assert a.pixel_size.z == b.pixel_size.z - if config.mask_configs is not None: + if config.mask_configs: if isinstance(config.mask_configs, str): config.mask_configs = self._get_mask_configs(config.mask_configs) @@ -384,7 +384,7 @@ def num_channels(self, input_channels=0): def process(self, subvol: Subvolume) -> SubvolumeOrMany: box = subvol.bbox - if self._config.mask_configs is not None: + if self._config.mask_configs: mask = self._build_mask(self._config.mask_configs, box) else: mask = None @@ -582,10 +582,10 @@ def __init__( f' stride {config.stride}' ) - if config.mask_configs is not None: + if config.mask_configs: config.mask_configs = self._get_mask_configs(config.mask_configs) - if config.selection_mask_configs is not None: + if config.selection_mask_configs: config.selection_mask_configs = self._get_mask_configs( config.selection_mask_configs ) @@ -680,7 +680,7 @@ def process(self, subvol: Subvolume) -> SubvolumeOrMany: ret[2, ...] = self._config.delta_z sel_mask = None - if self._config.selection_mask_configs is not None: + if self._config.selection_mask_configs: sel_mask = self._build_mask(self._config.selection_mask_configs, out_box) mfc = flow_field.JAXMaskedXCorrWithStatsCalculator() @@ -695,7 +695,7 @@ def process(self, subvol: Subvolume) -> SubvolumeOrMany: image_box = curr_image_box.translate([0, 0, z]) curr_mask = None - if self._config.mask_configs is not None: + if self._config.mask_configs: curr_mask = self._build_mask( self._config.mask_configs, image_box ).squeeze() @@ -732,7 +732,7 @@ def process(self, subvol: Subvolume) -> SubvolumeOrMany: logging.info('.. image loaded.') t1 = time.time() - if self._config.mask_configs is not None: + if self._config.mask_configs: prev_mask = self._build_mask( self._config.mask_configs, prev_box ).squeeze()