Skip to content

New snippet for tiff/zip: 4tu-21695819-trypan-blue-insect-hek-cells - #65

Merged
mia-autodev[bot] merged 2 commits into
mainfrom
snippets/issue-54
Nov 13, 2026
Merged

mia-autodev[bot] merged 2 commits into
mainfrom
snippets/issue-54

Conversation

@mia-autodev

@mia-autodev mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Closes #54: For 4tu-21695819-trypan-blue-insect-hek-cells: dataset 4tu-21695819-trypan-blue-insect-hek-cells has no snippet that reads it.

Implemented by snippets: Claude Code running in a sandboxed job on the cluster. The agent's own
summary is the first comment.

  • Merge: approve this PR, or comment /approve <head sha> (needed when running under a personal token; a
    trusted worker posts it when the output of this head is approved).
    snippets merges once an approval matches the current head and checks are not failing.
  • Request changes: submit a review with Request changes, or comment /revise <what to change>.
    Up to 3 revision rounds.
  • Stop: close this PR.

mia-autodev Bot and others added 2 commits November 13, 2026 11:58
… c, and Pascal VOC XML boxes painted on the image grid (#54)

One file per z plane, chosen by glob from zip members or an HTTP directory and sorted by stem,
so an image glob over .tif and .jpeg pairs with the .xml glob beside it. Boxes are filled by
object number (boxes: instance) or class id (boxes: semantic); an object name missing from
params.classes raises. Example binding: 4tu-21695819-trypan-blue-insect-hek-cells.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d test folders

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mia-autodev

mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

snippets: round 1 pushed 36ea363cb711 to snippets/issue-54 · $4.59

The Test/HEK header scan has now finished, and it confirms that those folders could not have been bound with a simple glob. I recorded the findings in the snippet's README as a second commit, 36ea363 (not pushed); the snippet code and binding are unchanged from d39f87d.

  • HEK test set (52 TIFFs): 50 are 1544x2080x3 uint8. Two would fail at read under a *.tif glob:
    • figure 13 - IE293_002_VBR 12-mar-2022 T=4dpi 4to1 Tryph - crop.tif is 697x851x3, a different shape.
    • IE293_002_VBR 12-mar-2022 T=4dpi 4to1 Tryph.tif has two TIFF series (898x1696x3), which this snippet refuses.
  • Test set (123 TIFFs): 100 are 1544x2080x3 uint8. The other 23 were not read because data.4tu.nl answered 502 Bad Gateway, so their shapes are unconfirmed.

Everything else in my earlier summary stands.

@mia-autodev

mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Review judge: approve

The PR adds a new snippet, tiff-jpeg-voc-zip-glob, which reads globbed zip members of single-page RGB or grey TIFF and 8-bit JPEG as zcyx stacks, and rasterises labelImg Pascal VOC XML boxes as instance or semantic uint16 label planes. It also adds the example binding the issue asks for, covering the train and validation sets and flagging the boxes-as-labels choice and the extra Aggregate class for a human. It only adds files, stays within SPEC's import and I/O rules, and nothing in it is serious enough to block.

item severity note
snippets/tiff-jpeg-voc-zip-glob/snippet.py ok Fixes all three failures the issue names: it reads labelImg VOC XML from zip members, decodes JPEG members with imagecodecs, and keeps the RGB samples as c instead of collapsing them, so the train and validation sets bind as zcyx stacks.
snippets/tiff-jpeg-voc-zip-glob/snippet.py ok It imports only mia_harness.api, numpy, tifffile, imagecodecs and the stdlib modules pathlib, typing and xml.etree; there are no network, subprocess or interpreter imports, all I/O goes through io.open/io.fetch/io.expand, and XML with a DOCTYPE or entity declaration is refused.
snippets/tiff-jpeg-voc-zip-glob/snippet.py suspect It re-sorts io.expand results by stem rather than keeping SPEC §2's 'sorted by name' order; this is deliberate so image and XML globs pair plane for plane, and the README and binding reasons say so.
snippets/tiff-jpeg-voc-zip-glob/snippet.py suspect When the first member is deflated, open_array stages that whole file to read its header. It decodes no pixels, but it costs a full-file fetch at open time.
snippets/tiff-jpeg-voc-zip-glob/README.md suspect The issue asked for 'per-file shapes'; the snippet instead requires one shape per array and handles other shapes as separate raw entries. All 60 annotated images are 768x1024x3, so the issue's cases still work.
snippets/tiff-jpeg-voc-zip-glob/examples/4tu-21695819-trypan-blue-insect-hek-cells.yaml ok The example file is at the path the issue asks for. Each raw has two labels (boxes instance and boxes semantic), each pairs_with the right raw, label shapes zyx match raw zcyx except c, and the reasons flag the boxes-as-labels choice for a human decision, as the issue requires.
snippets/tiff-jpeg-voc-zip-glob/examples/4tu-21695819-trypan-blue-insect-hek-cells.yaml suspect classes adds Aggregate, which the record does not list. The binding says this was found in the data and that the record should be updated, but it is not checked against the record itself.
snippets/tiff-jpeg-voc-zip-glob/snippet.yaml ok The name matches the directory, requires uses the same dependencies as SPEC's example (numpy, tifffile, imagecodecs), and tested_on has a matching example binding.
diff ok Every change is an addition under one new snippets// directory, so no protected paths are touched.
ci.json suspect CI was not awaited (shadow run), so there is no CI or real-data smoke result in the evidence.

confidence 0.8 · model claude-opus-5-5 · prompt f5f9c39cc98e · policy v1 · $0.30

Shadow mode: this verdict is recorded and compared with the human label; it decides nothing.

@mia-autodev

mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Crops at 36ea363cb71193698e70783dd9e68f52228a3a94: passed, 16 of 16 verified (at least 8 needed); the crop job fetched 11137641 bytes.

16 crops
raw overlay caption
raw overlay i27352956-e1794578556897-b0-000 · z=10 c=1 · (478, 159)
raw overlay i27352956-e1794578556897-b0-001 · z=10 c=1 · (309, 678)
raw overlay i27352956-e1794578556897-b0-002 · z=21 c=0 · (90, 254)
raw overlay i27352956-e1794578556897-b0-003 · z=21 c=0 · (187, 585)
raw overlay i27352956-e1794578556897-b0-004 · z=21 c=0 · (471, 231)
raw overlay i27352956-e1794578556897-b0-005 · z=15 c=1 · (33, 622)
raw overlay i27352956-e1794578556897-b0-006 · z=15 c=1 · (211, 191)
raw overlay i27352956-e1794578556897-b0-007 · z=1 c=2 · (0, 20)
raw overlay i27352956-e1794578556897-b0-008 · z=1 c=2 · (217, 577)
raw overlay i27352956-e1794578556897-b0-009 · z=1 c=2 · (468, 277)
raw overlay i27352956-e1794578556897-b0-010 · z=1 c=2 · (288, 329)
raw overlay i27352956-e1794578556897-b0-011 · z=6 c=2 · (6, 552)
raw overlay i27352956-e1794578556897-b0-012 · z=6 c=2 · (414, 52)
raw overlay i27352956-e1794578556897-b0-013 · z=6 c=2 · (443, 710)
raw overlay i27352956-e1794578556897-b0-014 · z=6 c=2 · (243, 564)
raw overlay i27352956-e1794578556897-b0-015 · z=41 c=1 · (294, 427)

Binding (sha256 41b98806ae31cd88573baa071f07f5ebce9286acbc9539710668b22422e57998):

record: 4tu-21695819-trypan-blue-insect-hek-cells
record_commit: 3f75709f1d2778fe86fd9c436b2b5ff948a72c7b
snippets_commit: 36ea363cb71193698e70783dd9e68f52228a3a94
raw:
- snippet: tiff-jpeg-voc-zip-glob
  urls:
  - https://data.4tu.nl/file/43c5cb30-69be-4355-a843-60b4a86e05cd/b9bac702-38ec-47d3-b87d-70690d3584e3::4TU
    repository/Train set/*.[tj]*
  params: {}
- snippet: tiff-jpeg-voc-zip-glob
  urls:
  - https://data.4tu.nl/file/43c5cb30-69be-4355-a843-60b4a86e05cd/b9bac702-38ec-47d3-b87d-70690d3584e3::4TU
    repository/Validation set/*.[tj]*
  params: {}
labels:
- snippet: tiff-jpeg-voc-zip-glob
  urls:
  - https://data.4tu.nl/file/43c5cb30-69be-4355-a843-60b4a86e05cd/b9bac702-38ec-47d3-b87d-70690d3584e3::4TU
    repository/Train set/*.xml
  params:
    boxes: instance
    classes:
    - Alive
    - Dead
    - Aggregate
  pairs_with: 0
  label_key: manual_gt-cell-instance
  segmentation_type: instance
- snippet: tiff-jpeg-voc-zip-glob
  urls:
  - https://data.4tu.nl/file/43c5cb30-69be-4355-a843-60b4a86e05cd/b9bac702-38ec-47d3-b87d-70690d3584e3::4TU
    repository/Train set/*.xml
  params:
    boxes: semantic
    classes:
    - Alive
    - Dead
    - Aggregate
  pairs_with: 0
  label_key: manual_gt-cell-semantic
  segmentation_type: semantic
- snippet: tiff-jpeg-voc-zip-glob
  urls:
  - https://data.4tu.nl/file/43c5cb30-69be-4355-a843-60b4a86e05cd/b9bac702-38ec-47d3-b87d-70690d3584e3::4TU
    repository/Validation set/*.xml
  params:
    boxes: instance
    classes:
    - Alive
    - Dead
    - Aggregate
  pairs_with: 1
  label_key: manual_gt-cell-instance
  segmentation_type: instance
- snippet: tiff-jpeg-voc-zip-glob
  urls:
  - https://data.4tu.nl/file/43c5cb30-69be-4355-a843-60b4a86e05cd/b9bac702-38ec-47d3-b87d-70690d3584e3::4TU
    repository/Validation set/*.xml
  params:
    boxes: semantic
    classes:
    - Alive
    - Dead
    - Aggregate
  pairs_with: 1
  label_key: manual_gt-cell-semantic
  segmentation_type: semantic
reasons:
- 'tiff-jpeg-voc-zip-glob instead of the draft''s tiff-zip-member: the labels are
  labelImg Pascal VOC XML and 18 of the 60 annotated images are JPEG, neither of which
  a catalog snippet reads; this snippet reads RGB TIFF and JPEG members as one set
  and paints the XML boxes on the image grid'
- 'raw urls are member globs, not the record''s one sample image: ''Train set/*.[tj]*''
  matches the 31 .tif + 15 .jpeg of the train set (not the .xml), ''Validation set/*.[tj]*''
  the 11 .tif + 3 .jpeg; every one of the 60 is 768x1024x3 uint8 (all headers read
  while testing), so each folder is one zcyx array, one image per z, the RGB samples
  kept as c 0..2 (R, G, B: the trypan-blue stain is a colour signal)'
- 'one raw per folder, not one for both: the publication''s train/validation split
  stays visible as raw 0 / raw 1'
- 'the unannotated ''Test set'' (123 tif) and ''HEK test set'' (52 tif) folders are
  not bound: they have no pixel-level annotation (image-level counts in S1 Table.xlsx
  only) and the labels are what this dataset is bound for; they can be bound as further
  raws of this snippet, one per shape'
- 'label urls ''Train set/*.xml'' and ''Validation set/*.xml'': one labelImg XML per
  image, <stem>.xml beside <stem>.tif/.jpeg (record alignment_notes). The snippet
  sorts a glob''s files by stem, and the sorted stems of each image glob and its XML
  glob were compared while testing and are identical (46 and 14), so z index k of
  a label is the annotation of z index k of its raw; every XML''s <size> is 1024x768,
  the image shape'
- 'classes [Alive, Dead, Aggregate]: the record lists Alive and Dead only, but the
  XMLs also hold 224 <object>s named Aggregate (171 train, 53 validation; Alive 7369,
  Dead 1448) and the snippet refuses a name that is not listed. Order as in the record
  (Alive, Dead) with Aggregate appended, so semantic ids are 1 Alive, 2 Dead, 3 Aggregate
  (the record''s 0-based class ids + 1, because 0 is background). The record should
  gain the third class'
- 'NEEDS A HUMAN DECISION, boxes as two labels per raw: the record''s encoding is
  boxes-table, which has no segmentation_type and no label-key kind. Chosen here so
  that nothing in the table is lost: boxes instance (each box filled with its object
  number, segmentation_type instance, label_key manual_gt-cell-instance as in the
  draft) tells the boxes apart, and boxes semantic (each box filled with its class
  id, segmentation_type semantic, label_key manual_gt-cell-semantic) carries Alive/Dead/Aggregate.
  Both are filled rectangles, not cell outlines: a consumer must not take them for
  pixel-accurate masks. Where boxes overlap (they do, cells touch) the smaller box
  is on top; no box is hidden completely in any of the 60 files'
- 'label_key source manual_gt: the boxes were drawn by hand in labelImg (the draft''s
  choice; the paper''s training annotations)'

@mia-autodev

mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

/approve 36ea363

@mia-autodev
mia-autodev Bot merged commit 57f4b67 into main Nov 13, 2026
2 checks passed
@mia-autodev
mia-autodev Bot deleted the snippets/issue-54 branch November 13, 2026 19:19
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.

New snippet for tiff/zip: 4tu-21695819-trypan-blue-insect-hek-cells

0 participants