Skip to content

ulmshare: per-buffer processing with checkpoints, axial IQ upsampling - #45

Merged
tristan-deep merged 1 commit into
mainfrom
ulmshare-buffered-ulm
Sep 29, 2026
Merged

tristan-deep merged 1 commit into
mainfrom
ulmshare-buffered-ulm

Conversation

@tristan-deep

Copy link
Copy Markdown
Owner

Makes reconstruct.py run on a whole ulmshare acquisition (76000 frames). Before, it held every frame in memory (~80 GB of IQ) and was killed.

  • Per-buffer processing: each 400-frame buffer is streamed, beamformed, SVD-filtered, localized and tracked, then dropped. Power Doppler, movie and ULM tracks are accumulated as it goes. The next buffer is read on a background thread. Peak memory stays flat at ~6 GB whatever N_FRAMES is. A full acquisition takes ~40 min.
  • Stage checkpoints: each buffer's beamformed IQ, Power-Doppler stats, localizations and tracks are saved under zea's cache directory (CHECKPOINT_DIR). Each key covers the file, the buffer, every relevant setting and the source code of the functions that compute the stage. An interrupted run resumes, and a changed ULM parameter recomputes only the stages it affects. The beamformed stage takes ~1 MB per frame; CHECKPOINT = False turns checkpoints off.
  • Axial upsampling: the IQ data is sampled at 5.2 MHz (148 µm per sample, ~6 grid pixels), and linear interpolation in delay-and-sum made the envelope dip between samples. That locked ULM localizations into rows and smeared the B-mode. The channel data is now upsampled 4× along depth by FFT zero-padding before beamforming (AXIAL_UPSAMPLING).
  • ulm.py: localization is vectorised over the whole buffer, with results identical to the per-frame loop.

Output changes: the B-mode now shows the skull and brain speckle instead of streaks. Power Doppler loses its faint horizontal banding. ULM uses a per-buffer detection threshold and no longer links tracks across buffer boundaries, as the MATLAB reference does. The full-acquisition ULM map still shows an angled hatching pattern; that isn't fixed here.

Tested with zea 0.1.6.

Files changed: 2.

~ datasets/ulmshare/reconstruct.py
~ datasets/ulmshare/ulm.py

@tristan-deep
tristan-deep merged commit d87c7aa into main Sep 29, 2026
1 check 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