Skip to content

Commit 946d5b3

Browse files
jkim810claude
andcommitted
Fix tifffile API compatibility for COMPRESSION enum lookup
tifffile >= 2025 moved TIFF.COMPRESSION to module-level tifffile.COMPRESSION, causing AttributeError in prepare step. Also unpin tifffile version to allow newer releases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3695ad8 commit 946d5b3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

imc/scripts/prepare.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ def main(cli: tp.Sequence[str] = None) -> int:
4141
if (args.sample_names is None) or (len(args.input_files) != len(args.sample_names)):
4242
args.sample_names = [None] * len(args.input_files)
4343

44-
args.compression = getattr(tifffile.TIFF.COMPRESSION, args.compression)
44+
# Handle tifffile API change: TIFF.COMPRESSION was moved to module-level in newer versions
45+
try:
46+
args.compression = getattr(tifffile.TIFF.COMPRESSION, args.compression)
47+
except AttributeError:
48+
args.compression = getattr(tifffile.COMPRESSION, args.compression)
4549

4650
mcds = [file for file in args.input_files if file.endswith(MCD_FILE_ENDINGS)]
4751
tiffs = [file for file in args.input_files if file.endswith(TIFF_FILE_ENDINGS)]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies = [
4141
"pandas>=1.0.1",
4242
"matplotlib>=3.5.0",
4343
"scikit-image==0.19.3",
44-
"tifffile==2021.11.2",
44+
"tifffile>=2021.11.2",
4545
"numpy<2.0",
4646
"seaborn",
4747
"fastcluster",

0 commit comments

Comments
 (0)