Datasets:
Correct eta TIFF SampleFormat so Pillow consumers can open it
In one sentence: Correcting three SampleFormat bytes in the distributed eta TIFF restores compatibility with the tested Pillow and tifffile readers while preserving all pixel data.
Motivation: The public eta brightfield image does not decode correctly in the tested Python readers. Correcting the distributed asset would spare users of these readers from finding and applying a workaround individually.
One real example: The source TIFF, data/pherc0500p2/η_stack.tif, contains a 5369 × 3617, 8-bit RGB image but declares SampleFormat=(3, 3, 3) (floating point).
Before: In the fresh September 30 validation, Pillow 12.3.0 raised UnidentifiedImageError; tifffile 2026.9.9 returned an unusable empty boolean array.
After the correction: Changing SampleFormat to (1, 1, 1) (unsigned integer) let both readers decode the corrected copy. Pillow, using both a file path and a file-like object, and tifffile returned exactly the RGB bytes independently extracted from the original TIFF strips. Only byte offsets 58260392, 58260394 and 58260396 changed, each 03 → 01; every other byte and all other TIFF tags remained unchanged.
Proof: Fresh September 30 validation of the current recipe passed on Python 3.12.14 with Pillow 12.3.0, tifffile 2026.9.9 and NumPy 2.3.5. It verified the expected file and pixel hashes, preservation of all other bytes and tags, and seven checks that invalid inputs or existing destinations are refused. A separate same-day check of the public source confirmed the same SHA-256, file size of 58,260,398 bytes, and incorrect tag at revision a806bead2f3b9100c20e19de37814fb285cfeefd. The image validation used a cached copy verified against that identity. Earlier September 13 records also cover Python 3.14.7; that runtime was not rerun for this revision.
Why / where this is useful: This is a small compatibility correction to a distributed data file. ImageJ 1.54t already opened the original in the recorded September 10 check. Calling the existing overwrite((1, 1, 1)) method on the copy's SampleFormat tag with tifffile produced the identical corrected file in the September 30 validation; no new TIFF algorithm is claimed.
Details
The optional standard-library recipe checks complete source and output hashes and creates a separate corrected copy without replacing an existing file, including one created concurrently. Twenty-five software tests passed on each of Python 3.12 and 3.13, using synthetic bytes and real filesystem operations, including four processes competing to create the same output. A separate 13-test fault-injection run using the real source also passed. The fresh image validation covers this version of the recipe.
Hard-link support and a stable destination directory are required; Windows NTFS was tested. Forced termination may leave a temporary file. Neither directory durability after power loss nor preservation of filesystem permissions/timestamps is promised.
Eta and epsilon had separate file-opening errors in the recorded viewer checks. This eta-only correction has not been applied to the hosted dataset or tested end to end in its viewer.
Source SHA-256: 6f3b05d2e6ab8ea1e8055d35dc5b8fa7e0c7385dffc010b4d3df319548622247
Corrected SHA-256: 5c6b9d2b4ac69b812e53f2220da4e6f8cd123ec0432c98f161fb04e285ad3d90
Would you consider correcting this tag in the distributed eta asset? An equivalent tag edit is sufficient; adopting a new utility is unnecessary. The source's attribution and license remain unchanged.
I have personally reviewed the code and the evidence. AI tools assisted with diagnosis, implementation, testing and this description.
Optional source-specific recipe: repair_eta.py
"""Correct SampleFormat in the exact public eta TIFF, preserving all other bytes.
This source-specific recipe uses an existing TIFF tag correction. It requires
a filesystem supporting hard links so publication cannot replace another file.
"""
import argparse
import hashlib
import json
import os
from pathlib import Path
import sys
import tempfile
SOURCE_SHA256 = "6f3b05d2e6ab8ea1e8055d35dc5b8fa7e0c7385dffc010b4d3df319548622247"
OUTPUT_SHA256 = "5c6b9d2b4ac69b812e53f2220da4e6f8cd123ec0432c98f161fb04e285ad3d90"
SOURCE_BYTES = 58_260_398
OFFSETS = (58_260_392, 58_260_394, 58_260_396)
def _publish_copy(data, output):
"""Make the complete file visible at output, without replacing a destination."""
temporary = None
try:
with tempfile.NamedTemporaryFile(
mode="wb", prefix=".eta-repair-", suffix=".tmp",
dir=output.parent, delete=False,
) as stream:
temporary = Path(stream.name)
if stream.write(data) != len(data):
raise OSError("Incomplete write; corrected output was not published")
stream.flush()
os.fsync(stream.fileno())
# Unlike replace/rename on some platforms, link refuses a racing destination.
# The temporary file is already closed and complete before it becomes visible.
os.link(temporary, output)
finally:
if temporary is not None:
try:
temporary.unlink(missing_ok=True)
except OSError as error:
# Preserve the original error or completed output if cleanup is denied.
try:
print(f"Could not remove temporary file {temporary}: {error}", file=sys.stderr)
except (OSError, ValueError):
# A broken/closed stderr must not mask the result of publication.
pass
def repair(source, output):
"""Write a corrected copy; reject a changed source or an existing output."""
source, output = Path(source), Path(output)
if source.resolve() == output.resolve():
raise ValueError("Source and output must differ; original is never overwritten")
if output.exists() or output.is_symlink():
raise FileExistsError("Output already exists; refusing to replace it")
if source.stat().st_size != SOURCE_BYTES:
raise ValueError("Not the exact supported source size")
data = bytearray(source.read_bytes())
if hashlib.sha256(data).hexdigest() != SOURCE_SHA256:
raise ValueError("Not the exact supported source hash")
# Each little-endian SHORT changes from floating point (3) to unsigned (1).
for offset in OFFSETS:
if data[offset:offset + 2] != b"\x03\x00":
raise ValueError("Unexpected SampleFormat bytes")
data[offset] = 1
if hashlib.sha256(data).hexdigest() != OUTPUT_SHA256:
raise ValueError("Correction does not match the independently checked artifact")
_publish_copy(data, output)
return {
"source_sha256": SOURCE_SHA256,
"output_sha256": OUTPUT_SHA256,
"bytes": SOURCE_BYTES,
"changed_byte_offsets": list(OFFSETS),
"source_overwritten": False,
}
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("source", type=Path)
parser.add_argument("output", type=Path)
args = parser.parse_args()
print(json.dumps(repair(args.source, args.output), indent=2))
if __name__ == "__main__":
main()
Fresh image validation receipt (September 30)
{
"checked_utc": "2026-09-30T12:22:54.144011+00:00",
"status": "PASS",
"python": "3.12.14 (main, Aug 25 2026, 14:01:42) [MSC v.1944 64 bit (AMD64)]",
"pillow": "12.3.0",
"tifffile": "2026.9.9",
"numpy": "2.3.5",
"candidate_sha256": "50246d166372036a1000de00b7bc4158d99fd675515e16ac8d106bb4231ef37d",
"historical_candidate_sha256": "e04df008d2d95b7919a2408b78c1704d0c06a2968bb26b38852847c803bf6299",
"source_sha256": "6f3b05d2e6ab8ea1e8055d35dc5b8fa7e0c7385dffc010b4d3df319548622247",
"output_sha256": "5c6b9d2b4ac69b812e53f2220da4e6f8cd123ec0432c98f161fb04e285ad3d90",
"raw_rgb_sha256": "8b8f724b080256e956aa69576ae2c1d3b3194f79347bbe901f1cfcba55741db3",
"source_bytes": 58260398,
"original_pillow_result": "UnidentifiedImageError",
"original_tifffile_result": {
"shape": [
0,
3617,
5369,
3
],
"dtype": "bool",
"elements": 0
},
"changed_offsets": [
58260392,
58260394,
58260396
],
"other_tags_unchanged": true,
"corrected_pillow_path_and_file_like_match_raw_strips": true,
"corrected_tifffile_matches_raw_strips": true,
"existing_tifffile_tag_overwrite_identical_output": true,
"historical_and_atomic_candidate_identical_output": true,
"source_preserved": true,
"refusal_controls": [
{
"case": "same size wrong hash",
"refused": true,
"destination_preserved": true
},
{
"case": "truncated input",
"refused": true,
"destination_preserved": true
},
{
"case": "already corrected input",
"refused": true,
"destination_preserved": true
},
{
"case": "existing output",
"refused": true,
"destination_preserved": true
},
{
"case": "same source and output",
"refused": true,
"destination_preserved": true
},
{
"case": "hard-linked output",
"refused": true,
"destination_preserved": true
},
{
"case": "missing source",
"refused": true,
"destination_preserved": true
}
],
"limitations": "Fresh local Pillow, tifffile and byte/structure tests on NTFS. ImageJ result remains historical September 10 evidence. No remote viewer update or end-to-end refresh performed. Directory durability after power loss and forced-termination temporary cleanup are not promised."
}