路径可定义,混合型改成灰色
This commit is contained in:
parent
0c6a41e668
commit
6e67c277fc
@ -7,6 +7,7 @@
|
|||||||
@email:2021022362@m.scnu.edu.cn
|
@email:2021022362@m.scnu.edu.cn
|
||||||
@time:2022/03/28
|
@time:2022/03/28
|
||||||
"""
|
"""
|
||||||
|
from pathlib import Path
|
||||||
from utils.Quality_Relabel import Quality_Relabel
|
from utils.Quality_Relabel import Quality_Relabel
|
||||||
|
|
||||||
# start-----一般不用修改------
|
# start-----一般不用修改------
|
||||||
@ -14,6 +15,11 @@ from utils.Quality_Relabel import Quality_Relabel
|
|||||||
frequency = 100
|
frequency = 100
|
||||||
# 心晓数据采样率
|
# 心晓数据采样率
|
||||||
bcg_frequency = 1000
|
bcg_frequency = 1000
|
||||||
|
PSG_Data_Path = Path("Data/PSG/")
|
||||||
|
PSG_Label_Path = Path("Data/PSG_label/")
|
||||||
|
BCG_Data_Path = Path("Data/BCG/")
|
||||||
|
BCG_Label_Path = Path("Data/BCG_label/")
|
||||||
|
all_path = [PSG_Data_Path, PSG_Label_Path, BCG_Data_Path, BCG_Label_Path]
|
||||||
# end-----一般不用修改------
|
# end-----一般不用修改------
|
||||||
|
|
||||||
# 要遍历的事件
|
# 要遍历的事件
|
||||||
@ -32,7 +38,7 @@ start_bcg_index = 0
|
|||||||
shifting = 0
|
shifting = 0
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
qualityRelabel = Quality_Relabel(sampNo=sampNo, frequency=frequency, bcg_frequency=bcg_frequency,
|
qualityRelabel = Quality_Relabel(all_path=all_path, sampNo=sampNo, frequency=frequency, bcg_frequency=bcg_frequency,
|
||||||
focus_event_list=focus_event_list)
|
focus_event_list=focus_event_list)
|
||||||
|
|
||||||
qualityRelabel.show_all_event(start_bcg_index=start_bcg_index,
|
qualityRelabel.show_all_event(start_bcg_index=start_bcg_index,
|
||||||
|
23
README.md
23
README.md
@ -24,11 +24,32 @@ Quality_Relabel 主目录
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 上色规则
|
||||||
|
|
||||||
|
| 事件代码 | 事件 | 颜色 |
|
||||||
|
| :------: | :------------: | :--: |
|
||||||
|
| 0 | 背景 | 蓝色 |
|
||||||
|
| 1 | 低通气 | 粉色 |
|
||||||
|
| 2 | 中枢性呼吸暂停 | 橙色 |
|
||||||
|
| 3 | 阻塞型呼吸暂停 | 红色 |
|
||||||
|
| 4 | 混合型呼吸暂停 | 灰色 |
|
||||||
|
| 5 | 血氧饱和度下降 | 绿色 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 注意事项
|
## 注意事项
|
||||||
|
|
||||||

|
<img src="graph/note.png" style="zoom: 80%;" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 偏移量计算
|
||||||
|
|
||||||
|
当心晓有一段事件不可用时,需要手动填入偏移量
|
||||||
|
|
||||||
|
<img src="graph/calc.png" style="zoom: 80%;" />
|
||||||
|
|
||||||
## 程序流程框图
|
## 程序流程框图
|
||||||
|
|
||||||
|
BIN
graph/calc.png
Normal file
BIN
graph/calc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 KiB |
@ -66,7 +66,7 @@ class Quality_Relabel:
|
|||||||
color_cycle = ["blue", "pink", "orange", "red", "grey", "green"]
|
color_cycle = ["blue", "pink", "orange", "red", "grey", "green"]
|
||||||
assert len(color_cycle) == len(base_event) + 1, "基础事件数量与颜色数量不一致"
|
assert len(color_cycle) == len(base_event) + 1, "基础事件数量与颜色数量不一致"
|
||||||
|
|
||||||
def __init__(self, sampNo: int, frequency: int = 100, bcg_frequency: int = 1000,
|
def __init__(self, all_path: List, sampNo: int, frequency: int = 100, bcg_frequency: int = 1000,
|
||||||
channel_list: List[str] = ['Effort Tho', 'Effort Abd', 'SpO2', 'Flow Patient', 'Flow Patient'],
|
channel_list: List[str] = ['Effort Tho', 'Effort Abd', 'SpO2', 'Flow Patient', 'Flow Patient'],
|
||||||
focus_event_list: List[str] = ["Obstructive apnea"]):
|
focus_event_list: List[str] = ["Obstructive apnea"]):
|
||||||
"""
|
"""
|
||||||
@ -77,6 +77,7 @@ class Quality_Relabel:
|
|||||||
:param channel_list: 显示的通道
|
:param channel_list: 显示的通道
|
||||||
:param focus_event_list: 关注暂停事件
|
:param focus_event_list: 关注暂停事件
|
||||||
"""
|
"""
|
||||||
|
self.PSG_Data_Path, self.PSG_Label_Path, self.BCG_Data_Path, self.BCG_Label_Path = all_path
|
||||||
self.sampNo = sampNo
|
self.sampNo = sampNo
|
||||||
self.channel_list = channel_list
|
self.channel_list = channel_list
|
||||||
self.focus_event_list = focus_event_list
|
self.focus_event_list = focus_event_list
|
||||||
@ -112,8 +113,8 @@ class Quality_Relabel:
|
|||||||
print(f"常见通道名:{self.channel_list}")
|
print(f"常见通道名:{self.channel_list}")
|
||||||
|
|
||||||
def read_data(self, frequency: int = 100, bcg_frequency: int = 1000):
|
def read_data(self, frequency: int = 100, bcg_frequency: int = 1000):
|
||||||
bcg_path = Path(f"Data/BCG/{self.sampNo}samp.npy")
|
bcg_path = self.BCG_Data_Path / f"{self.sampNo}samp.npy"
|
||||||
ecg_path = Path(f"Data/ECG/A{str(self.sampNo).rjust(7, '0')}.edf")
|
ecg_path = self.PSG_Data_Path / f"A{str(self.sampNo).rjust(7, '0')}.edf"
|
||||||
|
|
||||||
if not bcg_path.exists():
|
if not bcg_path.exists():
|
||||||
logging.error(f"{bcg_path} 不存在!")
|
logging.error(f"{bcg_path} 不存在!")
|
||||||
@ -178,8 +179,8 @@ class Quality_Relabel:
|
|||||||
self.signal_select['xin_xiao_respire'] = signal2
|
self.signal_select['xin_xiao_respire'] = signal2
|
||||||
|
|
||||||
def read_event(self):
|
def read_event(self):
|
||||||
bcg_label_path = Path(f"Data/BCG_label/{self.sampNo}_label_all.csv")
|
bcg_label_path = self.BCG_Label_Path / f"{self.sampNo}_label_all.csv"
|
||||||
ecg_label_path = Path(f"Data/ECG_label/export{self.sampNo}.csv")
|
ecg_label_path = self.PSG_Label_Path / f"export{self.sampNo}.csv"
|
||||||
|
|
||||||
if not bcg_label_path.exists():
|
if not bcg_label_path.exists():
|
||||||
logging.error(f"{bcg_label_path} 不存在!")
|
logging.error(f"{bcg_label_path} 不存在!")
|
||||||
@ -391,5 +392,10 @@ class Quality_Relabel:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
prepareData = Quality_Relabel(670)
|
PSG_Data_Path = "../Data/PSG/"
|
||||||
|
PSG_Label_Path = "../Data/PSG_label/"
|
||||||
|
BCG_Data_Path = "../Data/BCG/"
|
||||||
|
BCG_Label_Path = "../Data/BCG_label/"
|
||||||
|
all_path = [PSG_Data_Path, PSG_Label_Path, BCG_Data_Path, BCG_Label_Path]
|
||||||
|
prepareData = Quality_Relabel(all_path, 670)
|
||||||
prepareData.show_all_event()
|
prepareData.show_all_event()
|
||||||
|
Loading…
Reference in New Issue
Block a user