Skip to content

SmartSPIM 6.0: map unnumbered channel folders by IMS_Notes.txt or metadata.json - #152

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/smartspim-short-slice-names
Nov 12, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/smartspim-short-slice-names

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Follow-up to #150. SmartSPIM software 6.0 names channel folders Ex_<laser>_Em_<filter>, with no _Ch<n>, and its _MIP_stitched files carry no _ch suffix. #150 refused a multi-channel acquisition in this layout because nothing in the folder names said which All_Channels _Ch<k> belongs to which channel. Two of Audrey's acquisitions (…AJ013_16x_561_640g_Destripe_DONE, …AJ010_16x_561_640_Destripe_DONE) are like this.

Both acquisitions record the answer in two places:

  • IMS_Notes.txt, which SmartSPIM writes beside Convert2IMS.bat: "The folder Ex_561_Em_561F_stitched is represented as Ch0 … Ex_640_Em_640F_stitched is represented as Ch1".
  • metadata.json, whose tiles give each laser/filter its FilterChannel (561F → 2, 640F → 3). Ranking those numbers gives the same mapping. This is the rule ferret-lightsheet/formats/SmartSPIM.md documents from AJ007, where _MIP_stitched showed ch<k> follows filter-channel order and not acquisition order.

Changes

A channel's _Ch<k> now comes from, in order:

  1. the _ch<k> suffix of its _MIP_stitched files (unchanged);
  2. IMS_Notes.txt, read by the new ndr.format.smartspim.readImsNotes. A missing or unreadable file gives an empty result and never errors;
  3. the rank of its filter-channel number (unchanged). A folder without _Ch<n> gets that number from metadata.json's tiles for its laser and filter, when they all give one number (listChannels).

Still refused, because the mapping would be a guess:

  • several channel folders where one has no number from metadata.json and isn't named in IMS_Notes.txt (listChannels:UnnumberedChannels);
  • unnumbered folders mapped by rank whose filter-channel order disagrees with the order the channels first appear in metadata.json (readAllChannelsInfo:ChannelOrderDisagrees). Which order the stitcher follows for this layout is not yet known; the first such acquisition will tell us.

Unchanged: a single channel folder without _Ch<n> still takes whichever one _Ch<k> its slices carry. Numbered folders keep their existing behaviour.

Tests (TestSmartSPIMAllChannels)

  • testSeveralChannelsNumberedByMetadata: two unnumbered folders, and one numbered plus one unnumbered, read with 640 as _ch1.
  • testFilterOrderAndMetadataOrderMustAgree: with metadata.json reordered so 640 comes first, the read is refused; adding IMS_Notes.txt settles it.
  • testSeveralUnnumberedChannelsWithoutEvidenceAreRefused: with no metadata.json, the read is refused, including when IMS_Notes.txt names only one channel.
  • testImsNotesNameEachChannelsSlices: IMS_Notes.txt decides, even against the rank.
  • testReadImsNotesWithoutAFile.
  • testSingleChannelWithoutChNumber now expects filterChannel 2, from metadata.json.

The MATLAB tests weren't run here. The Python port (VH-Lab/NDR-python, same branch name) has the same tests, and they pass.


Generated by Claude Code

…adata.json

SmartSPIM 6.0 names channel folders Ex_<laser>_Em_<filter> (no _Ch<n>) and
writes no _ch suffix in _MIP_stitched, so a two-channel acquisition in this
layout was refused (UnnumberedChannels). A channel's All_Channels _Ch<k> is
now taken from, in order:
1. the _ch<k> suffix of its _MIP_stitched files (as before);
2. IMS_Notes.txt, which SmartSPIM writes beside Convert2IMS.bat ("The folder
   <channel>_stitched is represented as Ch<k>"), read by the new
   readImsNotes;
3. the rank of its filter-channel number (as before). A folder without _Ch<n>
   gets that number from metadata.json's tiles with its laser and filter.

Where it is still unknown, it refuses:
- several folders where one has no number from metadata.json and is not in
  IMS_Notes.txt (UnnumberedChannels);
- unnumbered folders mapped by rank, when the rank disagrees with the order
  the channels first appear in metadata.json (ChannelOrderDisagrees). Which
  order the stitcher follows there is not yet known.

A single channel folder without _Ch<n> still takes whichever one _Ch<k> its
slices carry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E59gJ2kMfx16TfRmzo2SnL
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

403 tests  +4   400 ✅ +4   22s ⏱️ -12s
 41 suites ±0     3 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit a77f2d6. ± Comparison against base commit 6c20e3c.

This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
ndr.unittest.format.smartspim.TestSmartSPIMAllChannels ‑ testSeveralChannelsWithoutChNumberAreRefused
ndr.unittest.format.smartspim.TestSmartSPIMAllChannels ‑ testFilterOrderAndMetadataOrderMustAgree
ndr.unittest.format.smartspim.TestSmartSPIMAllChannels ‑ testImsNotesNameEachChannelsSlices
ndr.unittest.format.smartspim.TestSmartSPIMAllChannels ‑ testReadImsNotesWithoutAFile
ndr.unittest.format.smartspim.TestSmartSPIMAllChannels ‑ testSeveralChannelsNumberedByMetadata
ndr.unittest.format.smartspim.TestSmartSPIMAllChannels ‑ testSeveralUnnumberedChannelsWithoutEvidenceAreRefused

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.24324% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.34%. Comparing base (6c20e3c) to head (a77f2d6).

Files with missing lines Patch % Lines
+ndr/+format/+smartspim/readImsNotes.m 83.33% 3 Missing ⚠️
+ndr/+format/+smartspim/readAllChannelsInfo.m 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #152      +/-   ##
==========================================
+ Coverage   55.09%   55.34%   +0.25%     
==========================================
  Files         164      165       +1     
  Lines        9647     9708      +61     
==========================================
+ Hits         5315     5373      +58     
- Misses       4332     4335       +3     
Flag Coverage Δ
symmetry 18.84% <0.00%> (-0.12%) ⬇️
unittests 52.64% <93.24%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stevevanhooser
stevevanhooser merged commit 00960f6 into main Nov 12, 2026
8 checks passed
@stevevanhooser
stevevanhooser deleted the claude/smartspim-short-slice-names branch November 12, 2026 18:46
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.

2 participants