Skip to content

feat: add exposure time and objective info into ome metadata - #303

Merged
tlambert03 merged 2 commits into
tlambert03:mainfrom
omar-merhebi:ome-instrument-metadata
Jul 29, 2026
Merged

feat: add exposure time and objective info into ome metadata#303
tlambert03 merged 2 commits into
tlambert03:mainfrom
omar-merhebi:ome-instrument-metadata

Conversation

@omar-merhebi

Copy link
Copy Markdown
Contributor

Adds three fields that _ome.py already pulls values for:

  • Plane.exposure_time: dExposureTime from the raw metadata.
  • Objective.model: from Microscope.objectiveName.
  • ObjectiveSettings.refractive_index: from Microscope.immersionRefractiveIndex.

Notes

  • OME exposure time defaults to seconds so Plane.exposure_time_unit is set as milliseconds explicitly.
  • If several channels have one sSampleSetting entry, it gets propagated to every channel. This is to accommodate laser-scanning confocals which write one setting to all detectors. Cameras write one entry per channel so it's either SizeC or 1 on the sample files. Happy to make it strictly positional instead if that's preferred.
  • dExposureTime == 0.0 is treated as absent and written as None.
  • ObjectiveSettings as a whole is now written on every Image whenever an Objective exists, even if the refractive index is not present.

I left out Objective.immersion (see #294, 1.0 for refractive index is ambiguous) and Channel.detector_settings because ome_detectors collapses (model, serial) into a set so which channel a camera came from is lost.

Added tests in tests/test_ome.py

Two failures (may also fail in CI) are pre-existing and unrelated to these changes: _nd2file.py:1255 assigns frame.shape which is deprecated in numpy 2.5 and filterwarnings = ["error", ...] escalates it to an error. The failing test leaves the nd2 file open so this cascades into ~300 failures in the rest of the test suite. Also pre-existing: mypy is complaining about a redundant cast in _readers/_modern/modern_reader.py:275.

@codspeed-hq

codspeed-hq Bot commented Jul 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 13 untouched benchmarks


Comparing omar-merhebi:ome-instrument-metadata (9507b96) with main (8bb24d4)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (aaccfbd) during the generation of this report, so 8bb24d4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.65%. Comparing base (aaccfbd) to head (9507b96).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
+ Coverage   93.63%   93.65%   +0.02%     
==========================================
  Files          22       22              
  Lines        2607     2617      +10     
==========================================
+ Hits         2441     2451      +10     
  Misses        166      166              

☔ 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.

@tlambert03

Copy link
Copy Markdown
Owner

thanks @omar-merhebi!

@tlambert03
tlambert03 merged commit a5b3caf into tlambert03:main Jul 29, 2026
21 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.

2 participants