Skip to content

Commit 97b583e

Browse files
committed
Fixes stitcher update syntax and formatting
1 parent f29fe3d commit 97b583e

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/magnify/stitch.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,16 @@ def __init__(self, overlap: int = 102):
88
self.overlap = overlap
99

1010
def __call__(self, assay: xr.Dataset) -> xr.Dataset:
11-
# Only clip if overlap is non-zero
12-
if self.overlap > 0:
13-
clip = self.overlap//2
14-
# Account for odd overlaps
15-
remainder = self.overlap%2
16-
17-
# Adjust tiles
18-
tiles = assay.tile[
19-
...,
20-
clip:-clip+remainder,
21-
clip:-clip+remainder,
22-
]
23-
else:
24-
tiles = assay.tile
11+
# Take half of overlap from each edge
12+
clip = self.overlap // 2
13+
# Account for odd overlaps
14+
remainder = self.overlap % 2
15+
# Adjust tiles
16+
tiles = assay.tile[
17+
...,
18+
clip : assay.tile.shape[-2] - clip + remainder,
19+
clip : assay.tile.shape[-1] - clip + remainder,
20+
]
2521

2622
# Move the time and channel axes last so we can focus on joining images.
2723
tiles = tiles.transpose("tile_row", "tile_col", "tile_y", "tile_x", "channel", "time")

0 commit comments

Comments
 (0)