Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions processor/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
)
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down