实验室版 API
实验室版提供ECGFounder、文本生成单导联、单导联生成十二导联、三导联生成十二导联、PPG信号生成单导联以及单导联生成心脏超声的核心能力。
注意事项
🔬 欢迎使用实验室 API!
目前所有接口均处于公测阶段,功能可能会不定期调整。
为确保正常访问和数据安全,请进入 科研合作页面 联系工作人员获取专属访问密钥。
💡 温馨提示:请妥善保管您的密钥,避免泄露或滥用 。
适用场景
- 医学研究
- 心电模型验证
MCMA接口
POST /api/v1/experimental/mcma
通过输入单导联信号可以生成十二导联信号。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| ecgData | array | ✅ | ECG信号数据数组(ADC值) |
| ecgSamplerate | number | ✅ | 采样率,单位Hz(推荐250-500) |
| original | boolean | ❌ | 是否输出原始波形,默认true |
请求示例
curl -X POST "https://api.heartvoice.com.cn/api/v1/experimental/mcma" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ecgData": [512, 515, 520, 518, 525, ...],
"ecgSampleRate": 500
}'
响应示例
{
"errorCode": "0",
"msg": "成功",
"data": [
[
-0.0005600000149570405,
0.05680999904870987,
-0.002580000087618828,
0.02824000082910061,
...
]
]
}
可视化展示
import ecg_plot
ecg_plot.plot(gen_ecg12, sample_rate=fs, title='ECG 12')
ecg_plot.show()

文献
@article{chen2024multi,
title={Multi-channel masked autoencoder and comprehensive evaluations for reconstructing 12-lead ECG from arbitrary single-lead ECG},
author={Chen, Jiarong and Wu, Wanqing and Liu, Tong and Hong, Shenda},
journal={npj Cardiovascular Health},
volume={1},
number={1},
pages={34},
year={2024},
publisher={Nature Publishing Group UK London}
}
Chen, J., Wu, W., Liu, T., & Hong, S. (2024). Multi-channel masked autoencoder and comprehensive evaluations for reconstructing 12-lead ECG from arbitrary single-lead ECG. npj Cardiovascular Health, 1(1), 34.
DiffuSETS接口
POST /api/v1/experimental/diffuSets
通过输入单导联信号可以生成十二导联信号。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| text | str | ✅ | 临床诊断文本,多个诊断需要用'|'分隔开 |
| age | int | ✅ | 年龄 |
| sex | str | ✅ | 性别 |
| hr | int | ✅ | 心率 |
| batch | int | ❌ | 选择生成ECG的数量 |
请求示例
curl -X POST "https://api.heartvoice.com.cn/api/v1/experimental/diffuSets" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": 'Sinus rhythm|Normal ECG.', # Clinical text report, multi-reports should be split by '|'
"age": 50, # Age of patient
"sex": 'M',
"hr": 80,
'batch': 1
}'
响应示例
{
"errorCode": "0",
"msg": "成功",
"data": {
"textImg": "[\"iVBORw0KGgoAAAANSUhI=...\"]"
}
}
可视化展示
import time
import requests
import json
import base64
import io
from PIL import Image
def base64_to_image(base64_str):
# 解码Base64字符串
image_data = base64.b64decode(base64_str)
# 使用io.BytesIO将解码后的数据转换为文件对象
image_file = io.BytesIO(image_data)
# 使用PIL打开图片
image = Image.open(image_file)
return image
ecg_img = base64_to_image(ecg_data)
ecg_img.show()

文献
@article{lai2025diffusets,
title={DiffuSETS: 12-Lead ECG generation conditioned on clinical text reports and patient-specific information},
author={Lai, Yongfan and Chen, Jiabo and Zhao, Qinghao and Zhang, Deyun and Wang, Yue and Geng, Shijia and Li, Hongyan and Hong, Shenda},
journal={Patterns},
year={2025},
publisher={Elsevier}
}
Lai, Y., Chen, J., Zhao, Q., Zhang, D., Wang, Y., Geng, S., ... & Hong, S. (2025). DiffuSETS: 12-Lead ECG generation conditioned on clinical text reports and patient-specific information. Patterns.
WearECG接口
POST /api/v1/experimental/lead3Lead12
通过输入单导联信号可以生成十二导联信号。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| ecgData | array | ✅ | ECG信号数据数组(ADC值) |
| ecgSampleRate | number | ✅ | 采样率,单位Hz(推荐250-500) |
请求示例
curl -X POST "https://api.heartvoice.com.cn/api/v1/experimental/lead3Lead12" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ecgData": [[512, 515, 520, 518, 525, ...],[512, 515, 520, 518, 525, ...],[512, 515, 520, 518, 525, ...]],
"ecgSampleRate": 500
}'
响应示例
{
"errorCode": "0",
"msg": "成功",
"data": [
[
-0.0025084596127271652,
0.0118071788037084,
0.014166647854523678,
...
]
]
}
可视化展示
import ecg_plot
ecg_plot.plot(gen_ecg12, sample_rate=fs, title='ECG 12')
ecg_plot.show()

PPGFlowECG接口
POST /api/v1/experimental/ppgFlowEcg
通过输入单导联信号可以生成十二导联信号。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| ppgData | array | ✅ | PPG信号数据数组。上传红光、绿光或者红外光数据 |
| ppgSampleRate | number | ✅ | 采样率,单位Hz(推荐250-500) |
请求示例
curl -X POST "https://api.heartvoice.com.cn/api/v1/experimental/ppgFlowEcg" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ppgData": [512, 515, 520, 518, 525, ...],
"ecgSampleRate": 500
}'
响应示例
{
"errorCode": "0",
"msg": "成功",
"data": [
[
-0.0005600000149570405,
0.05680999904870987,
-0.002580000087618828,
0.02824000082910061,
...
]
]
}