feat: add bioimage conversion benchmark#3
Open
ash-0x00 wants to merge 7 commits into
Open
Conversation
This reverts commit c8139c3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a reproducible
bioimage_convert_1000dataset built from public Broad Bioimage Benchmark Collection archives for evaluatingiscc-bioIMAGEWALK Data-Code matching under real, default format-conversion drift.Each selected source image becomes a same-source cluster:
0original*1variant_ome-tiff.ome.tiff2variant_tiff.tiff3variant_png.png4variant_jp2.jp25variant_dicom.dcm6variant_ics.icsThe benchmark intentionally uses Bio-Formats default conversion operators only. It does not include synthetic perturbations such as brightness shifts, blur, crop, or custom compression/quality flags.
This update also prepares TwinSpect for directory-backed microscopy outputs:
.zarr/OME-NGFF directories are treated as single benchmark media inputs instead of walking and hashing their internal chunk files.Tooling
8.5.0bftools.zipby SHA-256:07a3bb1d3de84da3a709655a1008cb2d9b19becc5bad4ae4112633aec9380478~/.cache/twinspect/bioformatsby defaultbfconvertlauncher, so the pinned converter path is cross-platform including Windows (bfconvert.bat)TWINSPECT_BIOIMAGE_CONVERT_TEMPLATETWINSPECT_BIOIMAGE_CONVERT_BINfor imgcnv-style commandsCorrected benchmark intent
The task is to find real bioimage format conversions that produce non-identical but matchable IMAGEWALK bitstreams, not to manipulate images manually or force codec settings.
I removed the custom JPEG-compression variants because they were too artificial for this benchmark. I then tried more default target formats, including more exotic/proprietary-ish Bio-Formats targets:
.jp2).dcm).ics).ids).avi).mov)Findings from default conversions:
iscc-biowrapper to tolerate Bio-FormatsLazyBioArrayplanes.bfconvert; it creates a sidecar pair, so I excluded it.35on a 64-bit IMAGEWALK Data-Code — non-identical, but not within the usual near-match threshold.So the current PR is honest: it includes default exotic conversion targets and records the preliminary finding that I have not yet found a default-only proprietary/exotic single-file conversion that is both non-identical and matchable under the current 64-bit IMAGEWALK behavior. The benchmark is now positioned to measure exactly that instead of baking in artificial JPEG-quality pressure.
A known real-world stress case to add next is Zeiss CZI with lossy JPEG-XR compression converted to OME-Zarr via
bioformats2raw. In prior investigation,WT A17 Myotype 2-003.czivsWT A17 Myotype 2-003.zarrshowed about 96% exact pixel agreement but different IMAGEWALK hashes: roughly 4% of uint16 pixels differed, with max difference 15789 and mean intensity CZI 576.62 vs Zarr 579.26. That is the right kind of natural decoder/conversion drift: BioIO/Bio-Formats direct CZI decode andbioformats2raw→OME-Zarr can both be technically valid decode paths for a lossy JPEG-XR source. The PR now handles.zarrdirectories correctly as one benchmark item so this case can be added once the source/converted sample is made reproducible for reviewers.Validation
Local checks:
uv run pytest tests/test_processing.py tests/test_bioimage_convert_dataset.py -q16 passeduv run pytest -q19 passeduv run ruff check twinspect/algos/processing.py tests/test_processing.py twinspect/datasets/bioimage_convert.py twinspect/algos/iscc_bio.py tests/test_bioimage_convert_dataset.py tests/test_iscc_bio_algo.pyAll checks passeduv run python -m twinspect datasetsbioimage_convert_1000End-to-end smoke conversion using pinned bftools
8.5.0:bbbc005,bbbc006_z00, andbbbc013_bmpsamplesbioimage_data_code_iw_64Preliminary Hamming distances, original vs converted variant:
bbbc005000000bbbc006_z00000000bbbc013_bmp0003500Caveats
bioformats2rawgeneration path.