diff --git a/python/ouroboros/pipeline/backproject_pipeline.py b/python/ouroboros/pipeline/backproject_pipeline.py index 8201406..baab382 100644 --- a/python/ouroboros/pipeline/backproject_pipeline.py +++ b/python/ouroboros/pipeline/backproject_pipeline.py @@ -96,7 +96,18 @@ def _process(self, input_data: any) -> tuple[any, None] | tuple[None, any]: is_compressed = bool(tif.pages[0].compression) FPShape = FrontProjStack(D=len(tif.pages), V=tif.pages[0].shape[0], U=tif.pages[0].shape[1]) - if is_compressed: + cannot_memmap = False + try: + if Path(straightened_volume_path).is_dir(): + _ = tifffile.memmap(next(Path(straightened_volume_path).iterdir()), mode="r") + else: + _ = tifffile.memmap(straightened_volume_path, mode="r") + except: # noqa: E722 + # Check here is because memmap needs certain types of dataoffsets, which aren't always there + # separate to compression. + cannot_memmap = True + + if is_compressed or cannot_memmap: print("Input data compressed; Rewriting.") # Create a new path for the straightened volume