Skip to content

Commit 42a0228

Browse files
authored
Check if the sliding window size is valid (#229)
1 parent e1c1bda commit 42a0228

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

viscy/data/hcs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ def _get_windows(self) -> None:
141141
img_arr: ImageArray = fov["0"]
142142
ts = img_arr.frames
143143
zs = img_arr.slices - self.z_window_size + 1
144+
if zs < 1:
145+
raise IndexError(
146+
f"Z window size {self.z_window_size} "
147+
f"is larger than the number of Z slices ({img_arr.slices}) "
148+
f"for FOV {fov.name}."
149+
)
144150
w += ts * zs
145151
self.window_keys.append(w)
146152
self.window_arrays.append(img_arr)

0 commit comments

Comments
 (0)