Skip to content

Commit

Permalink
Use each tile for frame_shape
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleysamuel committed Sep 10, 2024
1 parent c548c23 commit 1c68ecf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 2 additions & 4 deletions zetastitcher/fuse/fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def squircle_alpha(height, width):
return squircle


def fuse_queue(q, dest, frame_shape, debug=False):
def fuse_queue(q, dest, debug=False):
"""Fuse a queue of images along Y, optionally applying padding.
Parameters
Expand All @@ -83,8 +83,6 @@ def fuse_queue(q, dest, frame_shape, debug=False):
stack, `top_left` is a list specifying the image position in the form
``[Z, Y, X]``, `overlaps` is a :class:`pandas.DataFrame` specifying
overlaps with adjacent tiles.
frame_shape : tuple
Shape of a stack plane (XY).
dest : :class:`numpy.ndarray`
Destination array.
debug: bool
Expand All @@ -97,7 +95,7 @@ def fuse_queue(q, dest, frame_shape, debug=False):
if got is None:
break

my_slice, index_dbg, zfrom_dbg, sl, pos, overlaps = got
my_slice, index_dbg, zfrom_dbg, sl, pos, overlaps, frame_shape = got

z_from = pos[0]
z_to = z_from + my_slice.shape[0]
Expand Down
8 changes: 5 additions & 3 deletions zetastitcher/fuse/virtual_fused_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def __init__(self, file_or_matrix):

infile = os.path.join(self.path, self.fm.data_frame.iloc[0].name)
with InputFile(infile) as f:
self.temp_shape = list(f.shape)
self.dtype = f.dtype
self.nchannels = f.nchannels

Expand Down Expand Up @@ -225,7 +224,7 @@ def __getitem__(self, item):

t = threading.Thread(
target=fuse_queue,
args=(q, fused, self.temp_shape[-2::]),
args=(q, fused),
kwargs={
'debug': self._debug,
}
Expand All @@ -235,6 +234,7 @@ def __getitem__(self, item):
for index, Xs, sl in self._my_gen(df, X_min, X_stop, steps, myitem[:]):
logger.info('loading {}\t{}'.format(index, sl))
with InputFile(os.path.join(self.path, index)) as f:
temp_shape = list(f.shape)
f.squeeze = False
sl_a = np.copy(f[tuple(sl)]).astype(dtype)

Expand All @@ -261,7 +261,9 @@ def __getitem__(self, item):

overlaps.loc[overlaps['Z_from'] < 0, 'Z_from'] = 0

q.put([sl_a, index, z_from, tuple(sl), top_left, overlaps])
frame_shape = temp_shape[-2::]

q.put([sl_a, index, z_from, tuple(sl), top_left, overlaps, frame_shape])

q.put(None) # close queue

Expand Down

0 comments on commit 1c68ecf

Please sign in to comment.