Skip to content

Add OpenH-RF (zea) to UFF converter with ULMShare example - #81

Merged
olemarius90 merged 2 commits into
masterfrom
feature/openhrf_to_uff
Oct 11, 2026
Merged

olemarius90 merged 2 commits into
masterfrom
feature/openhrf_to_uff

Conversation

@olemarius90

@olemarius90 olemarius90 commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds the reverse direction of the existing USTB → OpenH-RF converter in sandbox/OpenHRF/: reading OpenH-RF (zea HDF5) plane-wave data into uff.channel_data. Tested on the ULMShare dataset (mouse 10, acquisition 1).

  • openhrf_to_uff.m: zea HDF5 → uff.channel_data (probe, plane-wave sequence, IQ data, metadata). Optional 'frames' and 'uff_file' arguments. Supports plane waves only for now and stops with an error on focused or diverging transmits.
  • openhrf_download_subset.py: streams a frame range from the Hugging Face Hub into a small local HDF5 file. The ULMShare files are 60–370 GB each and Blosc-compressed, which MATLAB can't read without a plugin, so the subset is rewritten with gzip. One 400-frame buffer is 473 MB.
  • ULMShare_openhrf_to_uff_example.m: DAS on the ULMShare reference grid (25 µm, F#1.4), B-mode and SVD-filtered power Doppler.
  • README.md: new "Reading OpenH-RF data into USTB" section.

Timing convention

zea stores per-element t0_delays (min 0) and initial_times; USTB references plane-wave delays to the wavefront crossing the origin. The converter uses wave.delay = initial_times - t_origin, the same convention as @verasonics/create_cpw_channeldata.m.

Validation

  • Against zea's own DAS on the same frame: envelope correlation 0.91 (0.43 with the delay sign flipped).
  • .uff write and read-back: data identical; delays differ by ~7 fs (single-precision storage).
  • Power Doppler on frames 20000–20399 shows cortical, penetrating and deep vessels. Early buffers (e.g. frames 8000–8399) are recorded before the microbubble bolus and show only tissue and noise, so the example uses buffer 50.

ULM example (second commit)

  • ULMShare_ULM_example.m: full ULM on ULMShare mouse 16, acquisition 1 (Grade A, Fig. 5 of the ULMShare paper). Per 400-frame buffer: USTB DAS on the GPU, SVD clutter filter, lag-1 autocorrelation, ulm.ULM radial-symmetry localization and tracking. Tracks are saved per buffer (resumable) and rendered into a density map and an up/down flow map. A 100-buffer run (40,000 frames, 92,559 tracks) reproduces the vascular layout of ULMShare's reference map.
  • openhrf_download_subset.py: --n-files downloads consecutive buffers with the source opened once, and remote reads use an LRU block cache (the default read-ahead cache refetched a 64 MB block on every chunk-index lookup). A buffer now streams in ~20 s instead of several minutes. Outputs go to a .partial file and are renamed when complete.

Notes

  • zea files don't store element width; the pitch is used instead.
  • The downloader needs h5py hdf5plugin huggingface_hub numpy.

🤖 Generated with Claude Code

olemarius90 and others added 2 commits October 10, 2026 22:10
- openhrf_to_uff.m: reads zea HDF5 plane-wave acquisitions into
  uff.channel_data. Maps zea t0_delays/initial_times to the USTB
  origin-referenced plane-wave model (wave.delay = initial_times - t_origin).
- openhrf_download_subset.py: streams a frame range of an OpenH-RF file from
  the Hugging Face Hub (Blosc) into a small gzip HDF5 that MATLAB can read.
- ULMShare_openhrf_to_uff_example.m: mouse 10 / acquisition 1, buffer 50,
  DAS B-mode and SVD-filtered power Doppler on the ULMShare grid.

Validated against zea's own DAS on the same frame (envelope correlation 0.91;
0.43 with the delay sign flipped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ULMShare_ULM_example.m: per 400-frame buffer, USTB DAS on the GPU, SVD
  clutter filter, lag-1 autocorrelation and ulm.ULM radial-symmetry
  localization + tracking; tracks are saved per buffer (resumable) and
  rendered into a density map and an up/down flow map. Defaults to mouse 16,
  acquisition 1 (Grade A, ULMShare paper Fig. 5), buffers 50-149.
- openhrf_download_subset.py: --n-files downloads consecutive buffers with the
  source opened once, and remote reads use an LRU block cache. The default
  read-ahead cache refetched a 64 MB block on every chunk-index lookup; a
  buffer now streams in ~20 s instead of several minutes. Outputs are written
  to a .partial file and renamed when complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@olemarius90
olemarius90 merged commit 7b89460 into master Oct 11, 2026
4 checks passed
@olemarius90
olemarius90 deleted the feature/openhrf_to_uff branch October 11, 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.

1 participant