Skip to content

Commit 3fa9810

Browse files
authored
Align X Y for Image Chip Generator (#418)
1 parent 4d93fc8 commit 3fa9810

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nucleus/chip_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ def write_chip(
116116

117117

118118
def generate_offsets(w: int, h: int, chip_size: int, stride_size: int):
119-
xs = np.arange(0, w - stride_size, chip_size - stride_size)
120-
ys = np.arange(0, h - stride_size, chip_size - stride_size)
119+
xs = np.arange(0, w - stride_size, stride_size)
120+
ys = np.arange(0, h - stride_size, stride_size)
121121
if len(xs) > 1:
122122
xs = np.round(xs * (w - chip_size) / xs[-1]).astype(int)
123123
if len(ys) > 1:
124124
ys = np.round(ys * (h - chip_size) / ys[-1]).astype(int)
125-
yield from product(ys, xs)
125+
yield from product(xs, ys)
126126

127127

128128
def chip_annotations(data, x0: int, y0: int, x1: int, y1: int):

0 commit comments

Comments
 (0)