| --- |
| pretty_name: SSL Ultrasound Representation (Stanford RF MultiFocal) |
| license: other |
| task_categories: |
| - feature-extraction |
| tags: |
| - ultrasound |
| - self-supervised |
| - rf-data |
| - mae |
| - jepa |
| size_categories: |
| - n<1K |
| --- |
| |
| # SSL Ultrasound Representation Dataset |
|
|
| IQ-demodulated multi-focal ultrasound channel data from the Stanford Ultrasound RF |
| Channel dataset, aggregated for self-supervised pre-training (MAE / JEPA / |
| contrastive). The signals are **not** beamformed — each frame retains its |
| per-transducer channel data after sub-aperture combination and IQ demodulation. |
|
|
| ## Files |
|
|
| | File | Description | |
| |------|-------------| |
| | `ultrasonic_dataset.zarr/` | 6D float32 zarr array, Blosc-LZ4 compressed, stored as an unzipped directory tree (one file per chunk, ~28.6 GB total). One chunk per frame on the leading axis → consumers can fetch just the first N frames. | |
| | `ultrasonic_dataset.metadata.json` | Per-frame provenance (subject, file, subfolder, indices). | |
| | `README.md` | This card (auto-generated by `push_to_hf.py`). | |
|
|
| ## Array layout |
|
|
| - **Name:** `rf_iq` |
| - **Shape:** `(168, 192, 192, 3, 2, 215)` |
| - **Axes:** `['frame', 'transducer', 'scanline', 'focal_zone', 'iq', 'sample']` |
| - **Chunks:** `(1, 192, 192, 3, 2, 215)` (one frame per chunk on the leading axis — aligned with DataLoader workers). |
| - **Dtype:** `float32` |
| - **IQ index:** `0` = in-phase, `1` = quadrature. |
|
|
| ## Processing pipeline |
|
|
| 1. Source: Verasonics Vantage `.mat` files with `MultiFocal` in the filename |
| (each file holds a 2-frame cine via `Resource.RcvBuffer.numFrames = 2`). |
| 2. Sub-aperture combination + IQ demodulation via `pymust.rf2iq`. |
| 3. Fast-time axis truncated at **860 samples** |
| (everything beyond is noise/zeros), then decimated by |
| **4×** → **215** output samples per signal. |
| 4. Stacked into a single 6D array with chunks optimised for 3D MAE patching. |
|
|
| See `scripts/dataset_scripts/build_mae_dataset.py` in the source repo for the |
| exact pipeline; `scripts/dataset_scripts/visualize_beamformed_pymust.py` beamforms |
| the same channel data for *visualisation only* (the stored array stays unbeamformed). |
|
|
| ## Frame counts |
|
|
| By subject: |
|
|
| | Subject | Frames | |
| |---------|--------| |
| | `Rat1` | 12 | |
| | `Rat10` | 6 | |
| | `Rat11` | 6 | |
| | `Rat12` | 6 | |
| | `Rat13` | 6 | |
| | `Rat14` | 6 | |
| | `Rat15` | 6 | |
| | `Rat16` | 6 | |
| | `Rat18` | 6 | |
| | `Rat19` | 6 | |
| | `Rat2` | 12 | |
| | `Rat20` | 6 | |
| | `Rat3` | 12 | |
| | `Rat4` | 12 | |
| | `Rat5` | 12 | |
| | `Rat6` | 12 | |
| | `Rat7` | 12 | |
| | `Rat8` | 12 | |
| | `Rat9` | 6 | |
| | `VerasonicsAcq` | 6 | |
|
|
| By subject × subfolder: |
|
|
| | Subject | Subfolder | Frames | |
| |---------|-----------|--------| |
| | `Rat1` | `—` | 6 | |
| | `Rat1` | `ExposedLiver` | 6 | |
| | `Rat10` | `—` | 6 | |
| | `Rat11` | `—` | 6 | |
| | `Rat12` | `—` | 6 | |
| | `Rat13` | `—` | 6 | |
| | `Rat14` | `—` | 6 | |
| | `Rat15` | `—` | 6 | |
| | `Rat16` | `—` | 6 | |
| | `Rat18` | `—` | 6 | |
| | `Rat19` | `—` | 6 | |
| | `Rat2` | `—` | 6 | |
| | `Rat2` | `ExposedLiver` | 6 | |
| | `Rat20` | `—` | 6 | |
| | `Rat3` | `—` | 6 | |
| | `Rat3` | `ExposedLiver` | 6 | |
| | `Rat4` | `—` | 6 | |
| | `Rat4` | `ExposedLiver` | 6 | |
| | `Rat5` | `—` | 6 | |
| | `Rat5` | `ExposedLiver` | 6 | |
| | `Rat6` | `—` | 6 | |
| | `Rat6` | `ExposedLiver` | 6 | |
| | `Rat7` | `—` | 6 | |
| | `Rat7` | `ExposedLiver` | 6 | |
| | `Rat8` | `—` | 6 | |
| | `Rat8` | `ExposedLiver` | 6 | |
| | `Rat9` | `—` | 6 | |
| | `VerasonicsAcq` | `Rat1` | 6 | |
|
|
| ## Loading |
|
|
| ```python |
| from src.dataset import build_split_datasets |
| |
| splits, meta = build_split_datasets( |
| "benbarkow/us-ssl-mf", |
| split_strategy="file", # or "subject" |
| cache_dir="/tmp/hf_cache", |
| max_frames=16, # optional: fetch only the first 16 frames' chunks |
| ) |
| train_ds = splits["train"] |
| ``` |
|
|
| `max_frames` exploits the per-frame chunking: only the chunks for the first N |
| frames are downloaded, so you can iterate on a small box without pulling the whole |
| array. Omit it to fetch everything. |
|
|
| The split helpers (`split_by_subject`, `split_by_file`) avoid cross-split leakage: |
| both frames of the same 2-frame cine always end up in the same split, and (for |
| `split_by_subject`) no subject appears in two splits. |
|
|