Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion python/ouroboros/pipeline/backproject_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down