Skip to content

Commit 6398786

Browse files
committed
Add check for straightened volume / slice options file size mismatch
1 parent 26f6213 commit 6398786

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/ouroboros/pipeline/backproject_pipeline.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ def _process(self,
8989
FPShape = FrontProjStack(D=len(tif.pages), V=tif.pages[0].shape[0], U=tif.pages[0].shape[1])
9090
channels = 1 if len(tif.pages[0].shape) < 3 else tif.pages[0].shape[-1]
9191

92+
# Make sure the config dimensions match the straightened volume dimensions.
93+
ESShape = FrontProjStack(D=len(slice_rects), U=np.round(np.linalg.norm(slice_rects[0][1]-slice_rects[0][0])),
94+
V=np.round(np.linalg.norm(slice_rects[0][3]-slice_rects[0][0])))
95+
96+
if ESShape != FPShape:
97+
raise ValueError("Straightened volume file does not match sliced shape:\n"
98+
f" ({FPShape} vs {ESShape}, respectively).")
99+
92100
cannot_memmap = False
93101
try:
94102
if Path(straightened_volume_path).is_dir():

0 commit comments

Comments
 (0)