Skip to content

Hide _IR TIFF sidecars from the contact sheet - #668

Merged
marcinz606 merged 1 commit into
mainfrom
fix/hide-ir-sidecars
Jul 29, 2026
Merged

Hide _IR TIFF sidecars from the contact sheet#668
marcinz606 merged 1 commit into
mainfrom
fix/hide-ir-sidecars

Conversation

@marcinz606

Copy link
Copy Markdown
Owner

Problem

Loading a folder of scanner TIFFs showed each frame two or three times in the contact sheet: frame001.tif, frame001_IR.tif and frame001_IR_VALID.tif all matched the supported-extension filter and were hashed and imported as standalone assets. TiffLoader already reads the IR companion off the main file, so those files should never be assets of their own.

Change

  • is_ir_sidecar_path() in negpy/infrastructure/loaders/constants.py is the single source of truth for the _IR / _IR_VALID convention: TIFF extension, stem ending in an IR token, and a main TIFF present in the same directory (case-insensitive name compare, matching the loader's own lookup).
  • Both discovery scanners use it: AssetDiscoveryWorker.process (covers Add Files / Add Folder / drag-drop / session restore / capture imports) and FolderWatchService.scan_for_new_files (hot folder, which would otherwise re-add them seconds later).
  • _read_sidecar_ir builds its suffix tuples from the same constant so read and hide can't drift.

An orphan _IR.tif with no main TIFF beside it stays visible — nothing else would ever open it. Sidecars imported by earlier sessions drop out on next launch, since restore feeds their paths back through the same filter.

Verification

  • make all green (2681 passed, 1 skipped).
  • New tests/test_ir_sidecar_discovery.py covers the predicate (incl. lowercase _ir, mixed-case main, orphan, non-TIFF) and the watcher.
  • Drove the real AssetDiscoveryWorker on a frame1.tif + frame1_IR.tif + frame1_IR_VALID.tif + orphan_IR.tif folder: assets = ['frame1.tif', 'orphan_IR.tif'], and TiffLoader().load("frame1.tif") still returns both ir and ir_valid_mask.

Asset discovery matched any .tif in a folder, so a scanner's frame001.tif +
frame001_IR.tif (+ _IR_VALID) pair imported as two or three separate assets.
The IR planes are already read off the main file by TiffLoader, so they are
never assets of their own.

is_ir_sidecar_path() in loaders/constants.py is now the single source for the
convention, shared by the loader's read side and both discovery scanners
(AssetDiscoveryWorker and the hot-folder watcher). An orphan _IR.tif with no
main TIFF beside it stays visible — nothing else would open it.
@github-actions

Copy link
Copy Markdown

Preview load metrics (github-linux-x64)

format cold load throughput
CR2 0.777 s 28.85 MPx/s
NEF 0.627 s 39.22 MPx/s
ARW 0.223 s 90.69 MPx/s
RAF 0.657 s 24.77 MPx/s
DNG 0.661 s 36.23 MPx/s

fixtures: rawsamples.ch · sha: cc3ea3b · full JSON

@marcinz606
marcinz606 merged commit 717db98 into main Jul 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant