Skip to content

Let an imaging lab name its files, and stop merging two animals into one - #20

Merged
Elnazkarami merged 2 commits into
mainfrom
ndos-core
Sep 30, 2026
Merged

Elnazkarami merged 2 commits into
mainfrom
ndos-core

Conversation

@Elnazkarami

Copy link
Copy Markdown
Owner

Three defects, found while working out what it would take to export into another standard's layout. All three are in a tool whose pitch is data integrity.

A two-photon lab had no way to name its files

SPECIFICATION.md §4 listed eight file types. Every one was electrophysiology or behaviour.

But session_type allows calcium imaging and histology, the scanner recognises .isxd, .czi, .nd2, .sbx, .lif, and the README Scope claims both modalities. So a lab could scan its data, declare a calcium-imaging session, and then find no conforming way to name the files in it — and ndos convert bids dropped them.

Adds imaging and histology, plus timestamps, which the code has always assigned and the spec never listed. The test that documents types against the spec had an exemption for timestamps; that exemption is gone, which is what would have caught this.

Only extensions that name one acquisition system are matched. A .tif is either an imaging stack or a slide, and nothing in the file says which, so an ambiguous one keeps a word of its own rather than being assigned one of the two at random. §4 forbids a label that misdescribes — that rule is the reason the list stays short.

Histology maps to BIDS micr. imaging is deliberately left unmapped: functional two-photon has no settled BIDS datatype while BEP032 is in review, so those files keep falling through the existing warning, which is true, rather than claiming a datatype no validator would accept.

sub-M77/ses-20250401/micr/sub-M77_ses-20250401_histology.czi
LEFT OUT (1)
  M77_20250401_imaging.isxd: no BIDS datatype maps to 'imaging'; left out of the export

Two animals were being merged into one

ndos_init.SUBJECT admits - and _, so M-123 and M_123 are two subjects. BIDS labels admit alphanumerics only, so both become M123.

The export merged them into one subject directory and kept whichever metadata arrived first. Invisible afterwards — the result is indistinguishable from a correct export of a single animal. Detected in the plan now, and refused before anything is written.

Conformance rule 3 was never enforced

"Every SessionID is unique within its subject." The checker collected session names into a dict and never read it back.

It compares on a normalised form, because a literal comparison can never fire — the filesystem already forbids two identical sibling names. What actually happens is one recording written two ways, 2025-03-14 beside 20250314, or a case-only difference that survives here and collapses on the next copy.

A project may now fail this check having passed before. The standard did not change; the checker caught up with it. Noted in the spec's versioning section.

Also

Restores the scope sentence dropped in c156ba9. "Not replacing BIDS for human MRI/MEG/EEG, replacing NWB as a container" is a boundary worth keeping — losing it widened the implied claim.

No version bump: §4 is a SHOULD and the additions are optional, so a project that conformed before still conforms. The spec's own rule only requires a new number when a conforming project would stop conforming.

364 → 380 tests.

Three defects, found while checking what it would take to export into
another standard's layout.

SPECIFICATION.md §4 listed eight file types and every one was
electrophysiology or behaviour. But the session vocabulary allows
"calcium imaging" and "histology", the scanner recognises .isxd, .czi,
.nd2, .sbx and .lif, and the README Scope claims both modalities. So a
two-photon lab could scan its data and declare the session, and then
have no conforming way to name the files in it -- and the BIDS export
dropped them. Adds `imaging` and `histology`, and `timestamps`, which the
code has always assigned and the specification never listed.

Only the extensions that name one acquisition system are matched. A .tif
is either an imaging stack or a slide and nothing in the file says
which, so an ambiguous one keeps a word of its own rather than being
assigned one of the two at random. §4 forbids a label that misdescribes,
and that is the whole reason the list is short.

Histology maps to BIDS `micr`, which is published. `imaging` is
deliberately left unmapped: functional two-photon has no settled BIDS
datatype while BEP032 is in review, so those files keep falling through
the "no BIDS datatype maps to" warning, which is true, rather than
claiming one no validator would accept.

Second: `M-123` and `M_123` are two subjects to NDOS -- ndos_init.SUBJECT
admits `-` and `_` -- and one label to BIDS, which admits alphanumerics
only. The export merged them into a single subject directory and kept
whichever metadata arrived first. Invisible afterwards, because the
result looks exactly like a correct export of one animal. Now detected
in the plan and refused before anything is written.

Third: conformance rule 3 says every SessionID is unique within its
subject. The checker collected session names into a dict and never read
it, so the rule was never tested. It compares on a normalised form,
because the filesystem already forbids two identical sibling names --
what actually happens is one recording written two ways, `2025-03-14`
beside `20250314`, or a case-only difference that survives here and
collapses on the next copy.

A project may now fail that check having passed before. The standard did
not change; the checker caught up with it.

Also restores the scope sentence dropped in c156ba9. "Not replacing BIDS
or NWB" is a boundary worth keeping, and losing it widened the implied
claim at exactly the wrong moment.

364 -> 380 tests.
The README opened by describing a folder standard. That is the weakest
thing here and the most crowded: NeuroBlueprint occupies the same ground
with an institution behind it, and BEP032 is in formal review to put
animal electrophysiology into BIDS proper. A lab choosing between them
has no reason to pick this one, and a reviewer has no reason to call it
novel.

What is actually unusual is the part none of them attempt. The nearest
competitor's own documentation tells labs not to retrofit existing data
-- "rather than trying to re-organise existing folders and analysis
code, which is always tricky" -- which leaves every drive that already
exists unserved. That is the drive this was written for.

So the README now opens on recovery, discovery and traceability, and
the specification is introduced as one component, separable from the
rest, for labs that want it. Same for the package description and the
citation abstract, which both led with "a BIDS-inspired standard".

The status note now says plainly that no external lab has completed a
pilot. That was true before and unstated, which is the kind of omission
that costs more than it saves.

No code change.
@Elnazkarami
Elnazkarami merged commit c0a5407 into main Sep 30, 2026
20 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