Robust Multi-Proxy EchoWave (RMEW) — An ECG-free method for detecting End-Diastolic (ED) and End-Systolic (ES) frames in echocardiography videos.
Nikhileswara Rao Sulake
RGUKT Nuzvid, India
This repository implements an automated method for cardiac timing detection in echocardiography without requiring ECG synchronization. The approach uses multiple image-based proxies (intensity, area, optical flow) combined with adaptive filtering to robustly identify ED and ES frames.
- ECG-free: No external synchronization required
- Multi-proxy fusion: Combines intensity, area, flow, and edge signals
- Adaptive processing: Automatically selects optimal strategy based on video characteristics
- Robust: Handles varying image quality and frame rates
| Dataset | N | ED Mean | ED Median | ES Mean | ES Median | ED (ms) | ES (ms) |
|---|---|---|---|---|---|---|---|
| EchoNet-Dynamic | — | — | — | — | — | — | — |
| CAMUS | — | — | — | — | — | — | — |
Results will be populated after running the evaluation pipeline on your local setup.
git clone https://github.com/yourusername/ecg-free-cardiac-timing.git
cd ecg-free-cardiac-timing
pip install -r requirements.txt- Python 3.8+
- NumPy, SciPy, OpenCV, Pandas, Matplotlib
- nibabel (for CAMUS dataset)
- tqdm (for progress bars)
- Request access and download from https://echonet.github.io/dynamic/
- Extract to get the following structure:
EchoNet-Dynamic/
├── FileList.csv # Video metadata (10,030 entries)
├── VolumeTracings.csv # Ground truth tracings
└── Videos/
├── 0X100009310A3BD7FC.avi
├── 0X1002E8FBACD08477.avi
└── ... (10,030 .avi files, 112x112 resolution)
- Move the folder to
data/:
ecg-free-cardiac-timing/
└── data/
└── EchoNet-Dynamic/
- Request access and download from https://www.creatis.insa-lyon.fr/Challenge/camus/
- Extract
database_nifti.zipto get:
CAMUS/
└── database_nifti/
├── patient0001/
│ ├── Info_2CH.cfg # Ground truth (ED, ES frames)
│ ├── Info_4CH.cfg
│ ├── patient0001_2CH_half_sequence.nii.gz
│ ├── patient0001_4CH_half_sequence.nii.gz
│ └── ...
├── patient0002/
└── ... (500 patients, 2 views each)
- Move the folder to
data/:
ecg-free-cardiac-timing/
└── data/
└── CAMUS/
# Run evaluation on all available datasets
python main.py
# Run on specific dataset
python main.py --dataset echonet
python main.py --dataset camus
# Limit number of samples (for quick testing)
python main.py --max-videos 100
# Custom data directory
python main.py --data-dir /path/to/datapython inference.py path/to/video.aviimport numpy as np
from rmew import CardiacTimingDetector
# Load your video as (T, H, W) grayscale array
frames = np.random.rand(100, 112, 112) * 255 # Example
# Detect ED/ES frames
detector = CardiacTimingDetector(fps=50.0)
ed_frame, es_frame, info = detector.detect(frames)
print(f"ED: frame {ed_frame}")
print(f"ES: frame {es_frame}")
print(f"Method used: {info['method']}")Results are saved to results/run_YYYYMMDD_HHMMSS/:
results/run_20250115_143022/
├── summary_table.csv # Combined metrics
├── echonet/
│ ├── echonet_results.csv # Per-video predictions
│ ├── echonet_summary.txt # Text summary
│ ├── scatter_comparison.png # Pred vs GT plots
│ ├── error_histograms.png # Error distributions
│ └── bland_altman.png # Agreement analysis
└── camus/
└── ... (same structure)
ecg-free-cardiac-timing/
├── README.md
├── requirements.txt
├── .gitignore
├── main.py # Full evaluation pipeline
├── inference.py # Single video inference
├── rmew/
│ ├── __init__.py
│ ├── detector.py # Core detection algorithm
│ ├── proxies.py # Image-based signal extraction
│ └── filters.py # Signal processing utilities
├── datasets/
│ ├── __init__.py
│ ├── echonet.py # EchoNet-Dynamic loader
│ └── camus.py # CAMUS loader
├── evaluation/
│ ├── __init__.py
│ ├── metrics.py # Error metrics computation
│ └── visualize.py # Plot generation
├── data/ # Place datasets here
│ └── README.md
└── results/ # Output directory
└── README.md
The RMEW algorithm:
- ROI Extraction: Defines a circular region-of-interest centered on the image
- Proxy Signals: Extracts multiple time-series from the video:
- Mean intensity (inverted for dark-blood imaging)
- Segmented area via Otsu thresholding
- Optical flow magnitude
- Edge energy
- Signal Fusion: Selects best proxy based on SNR or fuses if quality is similar
- Adaptive Smoothing: Median + Savitzky-Golay filtering
- Peak Detection:
- Short sequences: Global max (ED) / min after max (ES)
- Longer sequences: Scipy peak detection with prominence constraints
- Validation: Ensures physiologically plausible systolic duration
If you use this code in your research, please cite:
@article{sulake2025ecgfree,
title={ECG-Free Cardiac Timing Detection using Robust Multi-Proxy EchoWave},
author={Sulake, Nikhileswara Rao},
institution={RGUKT Nuzvid, India},
year={2025}
}MIT License
Copyright (c) 2025 Nikhileswara Rao Sulake
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.