"
+ SUFFIX_FREQ: str = "采样率"
+
# Folder: OrgBCG_Text
ORGBCG_RAW: str = "OrgBCG_Raw_"
BCG_FILTER: str = "BCG_Filter_"
@@ -82,6 +67,28 @@ class ConfigParams:
SQ_LABEL_10S: str = "SQ_label_10s"
SQ_LABEL_30S: str = "SQ_label_30s"
+
+class Params:
+
+ # 公共
+ PUBLIC_CONFIG_FILE_PATH: str = "./config/Config_public.yaml"
+ PUBLIC_CONFIG_NEW_CONTENT = {
+ "Path": {
+ "Root": ""
+ }
+ }
+ UTF8_ENCODING: str = "utf-8"
+ GBK_ENCODING: str = "gbk"
+ ENDSWITH_TXT: str = ".txt"
+ ENDSWITH_CSV: str = ".csv"
+ ENDSWITH_EDF: str = ".edf"
+ FORMATTER = FuncFormatter(lambda x, p: f"{x:.0f}")
+ ACTION_PAN_SHORTCUT_KEY: str = "X"
+ ACTION_ZOOM_SHORTCUT_KEY: str = "C"
+ FONT: str = "Microsoft YaHei UI"
+ VALIDATOR_INTEGER = QIntValidator(-2**31, 2**31 - 1)
+ VALIDATOR_DOUBLE = QDoubleValidator(-1e100, 1e100, 10)
+
# 数据粗同步
APPROXIMATELY_ALIGN_CONFIG_FILE_PATH: str = "./config/Config_approximately_align.yaml"
APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT: dict = {
@@ -207,29 +214,29 @@ class ConfigParams:
CUT_PSG_CONFIG_NEW_CONTENT: dict = {
"ECGFreq": 1000,
"ChannelInput": {
- "Effort Tho": THO_RAW,
- "Effort Abd": ABD_RAW,
- "Flow T": FLOWT_RAW,
- "Flow P": FLOWP_RAW,
- "Snore": SNORE_RAW,
- "SpO2": SPO2_RAW,
- "5_class": FIVE_CLASS_RAW
+ "Effort Tho": Filename.THO_RAW,
+ "Effort Abd": Filename.ABD_RAW,
+ "Flow T": Filename.FLOWT_RAW,
+ "Flow P": Filename.FLOWP_RAW,
+ "Snore": Filename.SNORE_RAW,
+ "SpO2": Filename.SPO2_RAW,
+ "5_class": Filename.FIVE_CLASS_RAW
},
"LabelInput": {
- "SA Label": SA_LABEL_RAW
+ "SA Label": Filename.SA_LABEL_RAW
},
- "StartTime": STARTTIME_RAW,
+ "StartTime": Filename.STARTTIME_RAW,
"ChannelSave": {
- "Effort Tho": THO_SYNC,
- "Effort Abd": ABD_SYNC,
- "Flow T": FLOWT_SYNC,
- "Flow P": FLOWP_SYNC,
- "Snore": SNORE_SYNC,
- "SpO2": SPO2_SYNC,
- "5_class": FIVE_CLASS_SYNC
+ "Effort Tho": Filename.THO_SYNC,
+ "Effort Abd": Filename.ABD_SYNC,
+ "Flow T": Filename.FLOWT_SYNC,
+ "Flow P": Filename.FLOWP_SYNC,
+ "Snore": Filename.SNORE_SYNC,
+ "SpO2": Filename.SPO2_SYNC,
+ "5_class": Filename.FIVE_CLASS_SYNC
},
"LabelSave": {
- "SA Label": SA_LABEL_SYNC
+ "SA Label": Filename.SA_LABEL_SYNC
},
"EndWith": {
"Effort Tho": ENDSWITH_TXT,
@@ -335,7 +342,6 @@ class ConfigParams:
def __new__(cls):
raise TypeError("Constants class cannot be instantiated")
-
# 禁止修改常量
@classmethod
def __setattr__(cls, key, value):
diff --git a/func/utils/Constants.py b/func/utils/Constants.py
index 56df68d..ab85a69 100644
--- a/func/utils/Constants.py
+++ b/func/utils/Constants.py
@@ -1,4 +1,4 @@
-from func.utils.ConfigParams import ConfigParams
+from func.utils.ConfigParams import Params
class Constants:
@@ -240,7 +240,7 @@ class Constants:
LABEL_CHECK_ADD_POINTS_SUCCESSFULLY: str = "成功新增点,横坐标:"
LABEL_CHECK_REMOVE_POINTS_SUCCESSFULLY: str = "成功删除点,横坐标:"
LABEL_CHECK_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无新增或删除点"
- LABEL_CHECK_ACTION_LABEL_MULTIPLE_NAME: str = f"批量更改标签({ConfigParams.LABEL_CHECK_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY})"
+ LABEL_CHECK_ACTION_LABEL_MULTIPLE_NAME: str = f"批量更改标签({Params.LABEL_CHECK_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY})"
# 数据精同步
PRECISELY_ALIGN_PROCESSING_DATA: str = "正在处理数据"
@@ -296,7 +296,7 @@ class Constants:
PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT: str = "Selected Point"
PRECISELY_ALIGN_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无有效点"
PRECISELY_ALIGN_RECOVER_SCALE: str = "尺度恢复"
- PRECISELY_ALIGN_ACTION_GET_RANGE_NAME: str = f"设置范围({ConfigParams.PRECISELY_ALIGN_ACTION_GET_RANGE_SHORTCUT_KEY})"
+ PRECISELY_ALIGN_ACTION_GET_RANGE_NAME: str = f"设置范围({Params.PRECISELY_ALIGN_ACTION_GET_RANGE_SHORTCUT_KEY})"
# 冗余数据切割和标签映射
CUT_PSG_GETTING_FILE_AND_FREQ: str = "正在获取文件及其采样率"
@@ -328,7 +328,7 @@ class Constants:
ARTIFACT_LABEL_MERGE: str = "当前所打标的片段距离附近片段不到2秒,片段序号:"
ARTIFACT_LABEL_DELETE_ARTIFACT_SUCCESSFULLY: str = "体动被删除"
ARTIFACT_LABEL_DELETE_ARTIFACT_FAILURE: str = "需要被删除的体动不存在"
- ARTIFACT_LABEL_ACTION_LABEL: str = f"标注体动({ConfigParams.ARTIFACT_LABEL_ACTION_LABEL_ARTIFACT_SHORTCUT_KEY})"
+ ARTIFACT_LABEL_ACTION_LABEL: str = f"标注体动({Params.ARTIFACT_LABEL_ACTION_LABEL_ARTIFACT_SHORTCUT_KEY})"
ARTIFACT_LABEL_LABELBTN_STYLE_1: str = """
QPushButton {
@@ -444,7 +444,7 @@ class Constants:
RESP_QUALITY_LABEL_CUSTOM_FILTER_ARGS_ERROR: str = "OrgBCG带通滤波频率设置范围应为数字,范围是0~1"
RESP_QUALITY_LABEL_AUTOLABEL_ARGS_ERROR: str = "人工标注阈值设置范围应为数字,范围是0~1"
RESP_QUALITY_LABEL_CHECK_ARGS_QUESTION_CONTENT: str = "你确定要执行此操作吗,请确保参数输入正确"
- RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_NAME: str = f"批量更改标签({ConfigParams.RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY})"
+ RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_NAME: str = f"批量更改标签({Params.RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY})"
RESP_QUALITY_LABEL_A_QUALITY: int = 1
RESP_QUALITY_LABEL_B_QUALITY: int = 0
RESP_QUALITY_LABEL_C_QUALITY: int = -1
diff --git a/数据结构化输入和输出命名规范.html b/数据结构化输入和输出命名规范.html
new file mode 100644
index 0000000..ac2ba9c
--- /dev/null
+++ b/数据结构化输入和输出命名规范.html
@@ -0,0 +1,168 @@
+文件命名规范
+当一份数据被完整走完标注流程后,数据文件夹目录结构将会是:
+.../Label/<sampID>
+ |-Artifact_a_采样率.txt
+ |-Artifact_b_采样率.txt
+ |-Artifact_c_采样率.csv
+ |-SQ_label_10s.csv
+ |-SQ_label_30s.csv
+ |-Resp_quality_label.txt
+ |-Tho_peak_采样率.txt
+ |-SA Label_corrected.csv
+ |-SA Label_add.csv
+ |-Precisely_Align_Info.txt
+ |-Approximately_Align_Info.csv
+.../OrgBCG_Aligned/<sampID>
+ |-BCG_Sync_采样率.txt
+ |-OrgBCG_Sync_采样率.txt
+ |-Jpeak_Sync_采样率.txt
+.../OrgBCG_Text/<sampID>
+ |-OrgBCG_Raw_采样率.txt
+ |-BCG_Filter_采样率.txt
+ |-Jpeak_revise_采样率.txt
+ |-Jpeak_revise_corrected_采样率.txt
+.../OrgBCG_Origin/<sampID>
+ |-...
+.../PSG_Aligned/<sampID>
+ |-ECG_Sync_采样率.txt
+ |-Rpeak_Sync_采样率.txt
+ |-5_class_Sync_采样率.txt
+ |-SA Label_Sync.csv
+ |-Effort Abd_Sync_采样率.txt
+ |-Effort Tho_Sync_采样率.txt
+ |-Flow T_Sync_采样率.txt
+ |-Flow P_Sync_采样率.txt
+ |-Snore_Sync_采样率.txt
+ |-SpO2_Sync_采样率.txt
+.../PSG_Text/<sampID>
+ |-ECG II_Raw_采样率.txt
+ |-ECG_Filter_采样率.txt
+ |-Rpeak_final_采样率.txt
+ |-Rpeak_final_corrected_采样率.txt
+ |-5_class_Raw_采样率.txt
+ |-SA Label_Raw.csv
+ |-Effort Abd_Raw_采样率.txt
+ |-Effort Tho_Raw_采样率.txt
+ |-Flow T_Raw_采样率.txt
+ |-Flow P_Raw_采样率.txt
+ |-Snore_Raw_采样率.txt
+ |-SpO2_Raw_采样率.txt
+ |-StartTime_Raw.txt
+.../PSG_Origin/<sampID>
+ |-...
+.../Receive_Origin
+ |-...
+.../Report
+ |-...
+
+1 数据粗同步
+输入:
+原始OrgBCG信号:./OrgBCG_Text/<sampID>/OrgBCG_Raw_采样率.txt
+原始Tho信号:./PSG_Text/<sampID>/Effort Tho_Raw_采样率.txt
+原始Abd信号:./PSG_Text/<sampID>/Effort Abd_Raw_采样率.txt
+输出:
+粗同步后的位置索引:./Label/<sampID>/Approximately_Align_Info.csv
+2 预处理
+输入:
+原始OrgBCG信号:./OrgBCG_Text/<sampID>/OrgBCG_Raw_采样率.txt
+原始ECG信号:./PSG_Text/<sampID>/ECG II_Raw_采样率.txt
+输出:
+滤波后的BCG信号:./OrgBCG_Text/<sampID>/BCG_Filter_采样率.txt
+滤波后的ECG信号:./PSG_Text/<sampID>/ECG_Filter_采样率.txt
+3 数据精同步
+3.1 算法定位
+3.1.1 R峰算法定位
+输入:
+滤波后的ECG信号:./PSG_Text/<sampID>/ECG_Filter_采样率.txt
+输出:
+算法定位的R峰坐标:./PSG_Text/<sampID>/Rpeak_final_采样率.txt
+3.1.2 J峰算法定位
+输入:
+滤波后的BCG信号:./OrgBCG_Text/<sampID>/BCG_Filter_采样率.txt
+输出:
+算法定位的J峰坐标:./OrgBCG_Text/<sampID>/Jpeak_revise_采样率.txt
+3.2 人工纠正
+3.2.1 R峰人工纠正
+输入:
+滤波后的ECG信号:./PSG_Text/<sampID>/ECG_Filter_采样率.txt
+算法定位的R峰坐标:./PSG_Text/<sampID>/Rpeak_final_采样率.txt
+粗同步后的位置索引:./Label/<sampID>/Approximately_Align_Info.csv
+输出:
+人工纠正后的R峰坐标:./PSG_Text/<sampID>/Rpeak_final_corrected_采样率.txt
+3.2.2 J峰人工纠正*
+输入:
+滤波后的BCG信号:./OrgBCG_Text/<sampID>/BCG_Filter_采样率.txt
+算法定位的J峰坐标:./OrgBCG_Text/<sampID>/Jpeak_revise_采样率.txt
+粗同步后的位置索引:./Label/<sampID>/Approximately_Align_Info.csv
+输出:
+人工纠正后的J峰坐标:./OrgBCG_Text/<sampID>/Jpeak_revise_corrected_采样率.txt
+3.3 数据片段起止对齐、数据采样率同步
+输入:
+滤波后的ECG信号:./PSG_Text/<sampID>/ECG_Filter_采样率.txt
+人工纠正后的R峰坐标:./PSG_Text/<sampID>/Rpeak_final_corrected_采样率.txt
+滤波后的BCG信号:./OrgBCG_Text/<sampID>/BCG_Filter_采样率.txt
+人工纠正后的J峰坐标:./OrgBCG_Text/<sampID>/Jpeak_revise_corrected_采样率.txt
+原始OrgBCG信号:./OrgBCG_Text/<sampID>/OrgBCG_Raw_采样率.txt
+粗同步后的位置索引:./Label/<sampID>/Approximately_Align_Info.csv
+输出:
+精同步对齐信息:./Label/<sampID>/Precisely_Align_Info.txt
+同步后的ECG信号:./PSG_Aligned/<sampID>/ECG_Sync_采样率.txt
+同步后的R峰坐标:./PSG_Aligned/<sampID>/Rpeak_Sync_采样率.txt
+同步后的BCG信号:./OrgBCG_Aligned/<sampID>/BCG_Sync_采样率.txt
+同步后的OrgBCG信号:./OrgBCG_Aligned/<sampID>/OrgBCG_Sync_采样率.txt
+同步后的J峰坐标:./OrgBCG_Aligned/<sampID>/Jpeak_Sync_采样率.txt
+3.4、冗余数据切割、标签映射
+输入:
+精同步对齐信息:./Label/<sampID>/Precisely_Align_Info.txt
+原始的Flow T信号:./PSG_Text/<sampID>/Flow T_Sync_采样率.txt
+原始的Flow P信号:./PSG_Text/<sampID>/Flow P_Sync_采样率.txt
+原始的Tho信号:./PSG_Text/<sampID>/Effort Tho_Sync_采样率.txt
+原始的Abd信号:./PSG_Text/<sampID>/Effort Abd_Sync_采样率.txt
+原始的SpO2信号:./PSG_Text/<sampID>/SpO2_Sync_采样率.txt
+原始的Snore信号:./PSG_Text/<sampID>/Snore_Sync_采样率.txt
+原始的睡眠分期标签:./PSG_Text/<sampID>/5_class_Raw_采样率.txt
+原始的睡眠呼吸暂停事件标签:./PSG_Text/<sampID>/SA Label_Raw.csv
+输出:
+同步后的Flow T信号:./PSG_Aligned/<sampID>/Flow T_Sync_采样率.txt
+同步后的Flow P信号:./PSG_Aligned/<sampID>/Flow P_Sync_采样率.txt
+同步后的Tho信号:./PSG_Aligned/<sampID>/Effort Tho_Sync_采样率.txt
+同步后的Abd信号:./PSG_Aligned/<sampID>/Effort Abd_Sync_采样率.txt
+同步后的SpO2信号:./PSG_Aligned/<sampID>/SpO2_Sync_采样率.txt
+同步后的Snore信号:./PSG_Aligned/<sampID>/Snore_Sync_采样率.txt
+同步后的睡眠分期标签:./PSG_Aligned/<sampID>/5_class_Sync_采样率.txt
+同步后的睡眠呼吸暂停事件标签:./PSG_Aligned/<sampID>/SA Label_Sync.csv
+4 体动标记
+输入:
+同步后的BCG信号:./OrgBCG_Aligned/<sampID>/BCG_Sync_采样率.txt
+同步后的OrgBCG信号:./OrgBCG_Aligned/<sampID>/OrgBCG_Sync_采样率.txt
+输出:
+txt格式的体动标签:./Label/<sampID>/Artifact_a_采样率.txt
+体动标签类型数量统计:./Label/<sampID>/Artifact_b_采样率.txt
+csv格式的体动标签:./Label/<sampID>/Artifact_c_采样率.csv
+5 质量评估
+输入:
+同步后的BCG信号:./OrgBCG_Aligned/<sampID>/BCG_Sync_采样率.txt
+txt格式的体动标签:./Label/<sampID>/Artifact_a_采样率.txt
+输出:
+质量标签:./Label/<sampID>/SQ_label_10s.csv或./Label/<sampID>/SQ_label_30s.csv
+6 呼吸提取
+输入:
+同步后的OrgBCG信号:./OrgBCG_Aligned/<sampID>/OrgBCG_Sync_采样率.txt
+同步后的Tho信号:./PSG_Aligned/<sampID>/Effort Tho_Sync_采样率.txt
+txt格式的体动标签:./Label/<sampID>/Artifact_a_采样率.txt
+输出:
+呼吸可用性标签:./Label/<sampID>/Resp_quality_label.txt
+Tho信号呼吸间期标签:./Label/<sampID>/Tho_peak_采样率.txt
+8 呼吸暂停事件标注
+输入:
+同步后的OrgBCG信号:./OrgBCG_Aligned/<sampID>/OrgBCG_Sync_采样率.txt
+txt格式的体动标签:./Label/<sampID>/Artifact_a_采样率.txt
+同步后的Flow T信号:./PSG_Aligned/<sampID>/Flow T_Sync_采样率.txt
+同步后的Flow P信号:./PSG_Aligned/<sampID>/Flow P_Sync_采样率.txt
+同步后的Tho信号:./PSG_Aligned/<sampID>/Effort Tho_Sync_采样率.txt
+同步后的Abd信号:./PSG_Aligned/<sampID>/Effort Abd_Sync_采样率.txt
+同步后的SpO2信号:./PSG_Aligned/<sampID>/SpO2_Sync_采样率.txt
+同步后的睡眠呼吸暂停事件标签:./PSG_Aligned/<sampID>/SA Label_Sync.csv
+输出:
+修正后的呼吸暂停标签:./Label/<sampID>/SA Label_corrected.csv
+新增的呼吸暂停标签:./Label/<sampID>/SA Label_add.csv
\ No newline at end of file
diff --git a/数据结构化输入和输出命名规范.md b/数据结构化输入和输出命名规范.md
deleted file mode 100644
index e7b4a5f..0000000
--- a/数据结构化输入和输出命名规范.md
+++ /dev/null
@@ -1,300 +0,0 @@
-# 文件命名规范
-
-
-### 当一份数据被完整走完标注流程后,数据文件夹目录结构将会是:
-
-
-```
-.../Label/
- |-Artifact_a_采样率.txt
- |-Artifact_b_采样率.txt
- |-Artifact_c_采样率.csv
- |-SQ_label_10s.csv
- |-SQ_label_30s.csv
- |-Resp_quality_label.txt
- |-Tho_peak_采样率.txt
- |-SA Label_corrected.csv
- |-SA Label_add.csv
- |-Precisely_Align_info.txt
- |-Approximately_Align_Info.csv
-.../OrgBCG_Aligned/
- |-BCG_Sync_采样率.txt
- |-OrgBCG_Sync_采样率.txt
- |-Jpeak_Sync_采样率.txt
-.../OrgBCG_Text/
- |-OrgBCG_Raw_采样率.txt
- |-BCG_Filter_采样率.txt
- |-Jpeak_revise_采样率.txt
- |-Jpeak_revise_corrected_采样率.txt
-.../OrgBCG_Origin/
- |-...
-.../PSG_Aligned/
- |-ECG_Sync_采样率.txt
- |-Rpeak_Sync_采样率.txt
- |-5_class_Sync_采样率.txt
- |-SA Label_Sync.csv
- |-Effort Abd_Sync_采样率.txt
- |-Effort Tho_Sync_采样率.txt
- |-Flow T_Sync_采样率.txt
- |-Flow P_Sync_采样率.txt
- |-Snore_Sync_采样率.txt
- |-SpO2_Sync_采样率.txt
-.../PSG_Text/
- |-ECG II_Raw_采样率.txt
- |-ECG_Filter_采样率.txt
- |-Rpeak_final_采样率.txt
- |-Rpeak_final_corrected_采样率.txt
- |-5_class_Raw_采样率.txt
- |-SA Label_Raw.csv
- |-Effort Abd_Raw_采样率.txt
- |-Effort Tho_Raw_采样率.txt
- |-Flow T_Raw_采样率.txt
- |-Flow P_Raw_采样率.txt
- |-Snore_Raw_采样率.txt
- |-SpO2_Raw_采样率.txt
- |-StartTime_Raw.txt
-.../PSG_Origin/
- |-...
-.../Receive_Origin
- |-...
-.../Report
- |-...
-```
-
-
-### 1 数据粗同步
-
-
-输入:
-
-原始orgBcg信号:`./OrgBCG_Text//OrgBCG_Raw_采样率.txt`
-
-原始PSG信号:`./PSG_Text//Axxxxxxx.edf`
-
-输出:
-
-粗同步后的位置索引:`./Label//Approximately_Align_Info.csv`
-
-
-### 2 预处理
-
-
-输入:
-
-原始orgBcg信号:`./OrgBCG_Text//OrgBCG_Raw_采样率.txt`
-
-原始ECG信号:`./PSG_Text//ECG II_Raw_采样率.txt`
-
-输出:
-
-带通滤波BCG信号:`./OrgBCG_Text//BCG_Filter_采样率.txt`
-
-滤波后的ECG信号:`./PSG_Text//ECG_Filter_采样率.txt`
-
-
-### 3 数据精同步
-
-
-#### 3.1 算法定位
-
-
-#### 3.1.1 R峰算法定位
-
-输入:
-
-滤波后的ECG信号:`./PSG_Text//ECG_Filter_采样率.txt`
-
-输出:
-
-算法定位的R峰坐标:`./PSG_Text//Rpeak_final_采样率.txt`
-
-
-#### 3.1.2 J峰算法定位
-
-
-输入:
-
-带通滤波BCG信号:`./OrgBCG_Text//BCG_Filter_采样率.txt`
-
-输出:
-
-算法定位的J峰坐标:`./OrgBCG_Text//Jpeak_revise_采样率.txt`
-
-
-#### 3.2 人工纠正
-
-
-#### 3.2.1 R峰人工纠正
-
-
-输入:
-
-滤波后的ECG信号:`./PSG_Text//ECG_Filter_采样率.txt`
-
-算法定位的R峰坐标:`./PSG_Text//Rpeak_final_采样率.txt`
-
-粗同步后的位置索引:`./Label//Approximately_Align_Info.csv`
-
-输出:
-
-人工纠正后的R峰坐标:`./PSG_Text//Rpeak_final_corrected_采样率.txt`
-
-
-#### 3.2.2 J峰人工纠正*
-
-
-输入:
-
-带通滤波BCG信号:`./OrgBCG_Text//BCG_Filter_采样率.txt`
-
-算法定位的J峰坐标:`./OrgBCG_Text//Jpeak_revise_采样率.txt`
-
-粗同步后的位置索引:`./Label//Approximately_Align_Info.csv`
-
-输出:
-
-人工纠正后的J峰坐标:`./OrgBCG_Text//Jpeak_revise_corrected_采样率.txt`
-
-
-#### 3.3 数据片段起止对齐、数据采样率同步
-
-
-输入:
-
-滤波后的ECG信号:`./PSG_Text//ECG_Filter_采样率.txt`
-
-人工纠正后的R峰坐标:`./PSG_Text//Rpeak_final_corrected_采样率.txt`
-
-带通滤波BCG信号:`./OrgBCG_Text//BCG_Filter_采样率.txt`
-
-人工纠正后的J峰坐标:`./OrgBCG_Text//Jpeak_revise_corrected_采样率.txt`
-
-原始orgBcg信号:`./OrgBCG_Text//OrgBCG_Raw_采样率.txt`
-
-粗同步后的位置索引:`./Label//Approximately_Align_Info.csv`
-
-输出:
-
-精同步对齐信息:`./Label//Precisely_Align_info.txt`
-
-同步后的ECG信号:`./PSG_Aligned//ECG_Sync_采样率.txt`
-
-同步后的R峰坐标:`./PSG_Aligned//Rpeak_Sync_采样率.txt`
-
-同步后的BCG信号:`./OrgBCG_Aligned//BCG_Sync_采样率.txt`
-
-同步后的orgBcg信号:`./OrgBCG_Aligned//OrgBCG_Sync_采样率.txt`
-
-同步后的J峰坐标:`./OrgBCG_Aligned//Jpeak_Sync_采样率.txt`
-
-
-#### 3.4、冗余数据切割、标签映射
-
-
-输入:
-
-精同步对齐信息:`./Label//Precisely_Align_info.txt`
-
-原始的其他PSG通道信号:`./PSG_Text//通道名_Raw_采样率.txt`(通道名包括:Effort Abd, Effort Tho, Flow T, Flow P, Snore, SpO2)
-
-原始的睡眠分期标签:`./PSG_Text//5_class_Raw_采样率.txt`
-
-原始的睡眠呼吸暂停事件标签:`./PSG_Text//SA Label_Raw.csv`
-
-输出:
-
-同步后的其他PSG通道信号:`./PSG_Aligned//通道名_Sync_采样率.txt`(通道名包括:Effort Abd, Effort Tho, Flow T, Flow P, Snore, SpO2)
-
-同步后的睡眠分期标签:`./PSG_Aligned//5_class_Sync_采样率.txt`
-
-同步后的睡眠呼吸暂停事件标签:`./PSG_Aligned//SA Label_Sync.csv`
-
-
-### 4 体动标记
-
-
-输入:
-
-同步后的BCG信号:`./OrgBCG_Aligned//BCG_Sync_采样率.txt`
-
-同步后的orgBcg信号:`./OrgBCG_Aligned//OrgBCG_Sync_采样率.txt`
-
-输出:
-
-txt格式的体动标签:`./Label//Artifact_a_采样率.txt`
-
-体动标签类型数量统计:`./Label//Artifact_b_采样率.txt`
-
-csv格式的体动标签:`./Label//Artifact_c_采样率.csv`
-
-
-### 5 质量评估
-
-
-输入:
-
-同步后的BCG信号:`./OrgBCG_Aligned//BCG_Sync_采样率.txt`
-
-txt格式的体动标签:`./Label//Artifact_a_采样率.txt`
-
-输出:
-
-质量标签:`./Label//SQ_label_10s.csv`或`./Label//SQ_label_30s.csv`
-
-
-### 6 心搏定位数据标注
-
-
-输入:
-
-?
-
-输出:
-
-?
-
-
-### 7 呼吸提取
-
-
-输入:
-
-同步后的orgBcg信号:`./OrgBCG_Aligned//orgBcg_Sync_采样率.txt`
-
-同步后的THO信号:`./PSG_Aligned//Effort Tho_Sync_采样率.txt`
-
-txt格式的体动标签:`./Label//Artifact_a_采样率.txt`
-
-输出:
-
-呼吸可用性标签:`./Label//Resp_quality_label.txt`
-
-THO信号呼吸间期标签:`./Label//Tho_peak_采样率.txt`
-
-
-### 8 呼吸暂停事件标注
-
-
-输入:
-
-同步后的orgBcg信号:`./OrgBCG_Aligned//OrgBCG_Sync_采样率.txt`
-
-txt格式的体动标签:`./Label//Artifact_a_采样率.txt`
-
-同步后的Flow T信号:`./PSG_Aligned//Flow T_Sync_采样率.txt`
-
-同步后的Flow P信号:`./PSG_Aligned//Flow P_Sync_采样率.txt`
-
-同步后的THO信号:`./PSG_Aligned//Effort Tho_Sync_采样率.txt`
-
-同步后的ABD信号:`./PSG_Aligned//Effort Abd_Sync_采样率.txt`
-
-同步后的SpO2信号:`./PSG_Aligned//SpO2_Sync_采样率.txt`
-
-同步后的呼吸暂停标签:`./PSG_Aligned//SA Label_Sync.csv`
-
-输出:
-
-修正后的呼吸暂停标签:`./Label//SA Label_corrected.csv`
-
-新增的呼吸暂停标签:`./Label//SA Label_add.csv`
\ No newline at end of file
From 5b7516985ffa9d651f917ac4fb321832fc792876 Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Wed, 28 May 2025 22:07:02 +0800
Subject: [PATCH 18/26] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5b688d9..ec99799 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
4、在J峰算法定位的时候滤波导致的信号偏移,导致之后的峰值坐标点与实际峰值出现偏移
-5、写一个脚本,用于直接从ConfigParams.py中读取文件命名规则,并直接自动化写入到一个markdown文件中。目的是方便文件命名的修改。
+~~5、写一个脚本,用于直接从ConfigParams.py中读取文件命名规则,并直接自动化写入到一个markdown文件中。目的是方便文件命名的修改。~~
## 1、主菜单
From 6b7ba17c6a1231147f0bd721d6bd3d65eeb62466 Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Thu, 29 May 2025 13:49:44 +0800
Subject: [PATCH 19/26] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86<=E4=BD=93?=
=?UTF-8?q?=E5=8A=A8=E6=A0=87=E6=B3=A8>=E4=B8=AD=E4=BD=93=E5=8A=A8?=
=?UTF-8?q?=E9=80=89=E5=8F=96=E5=8C=BA=E5=9F=9F=E7=9A=84=E5=88=A4=E5=88=AB?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 8 +-
func/Module_approximately_align.py | 1 -
func/Module_artifact_label.py | 181 ++++++++++++++++++++++-------
func/utils/Constants.py | 10 +-
4 files changed, 151 insertions(+), 49 deletions(-)
diff --git a/README.md b/README.md
index ec99799..b38f597 100644
--- a/README.md
+++ b/README.md
@@ -9,13 +9,17 @@
## TODO LIST:
1、根据选定区域获取峰值时,将绘制的区域设置为有上限和下限的矩形,根据矩形获取到的横纵区域来计算峰值
-2、体动选取区域的判别尚未做的很完整,选中多个已有的体动的区域时可能会出现问题
+~~2、体动选取区域的判别尚未做的很完整,选中多个已有的体动的区域时可能会出现问题~~
3、部分模块在导入失败后重新导入时会出现问题,已知模块有<人工纠正>、<体动标注>、<呼吸可用性及间期标注>、<睡眠呼吸暂停事件标注>,主要是涉及到按钮状态的设置,有待后续优化。当前将这些有涉及到的功能,禁止了导入数据后在不关闭界面的情况下直接重新导入
4、在J峰算法定位的时候滤波导致的信号偏移,导致之后的峰值坐标点与实际峰值出现偏移
-~~5、写一个脚本,用于直接从ConfigParams.py中读取文件命名规则,并直接自动化写入到一个markdown文件中。目的是方便文件命名的修改。~~
+~~5、写一个脚本,用于直接从ConfigParams.py中读取文件命名规则,并直接自动化写入到一个markdown文件中。目的是方便文件命名的修改~~
+
+6、<呼吸可用性及间期标注>的体动显示做一个和一样的可以根据勾选来显示需要显示的体动
+
+7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹
## 1、主菜单
diff --git a/func/Module_approximately_align.py b/func/Module_approximately_align.py
index 3b64623..b0b8a8f 100644
--- a/func/Module_approximately_align.py
+++ b/func/Module_approximately_align.py
@@ -1041,7 +1041,6 @@ class Data:
# 预重采样
try:
if Config["InputConfig"]["ThoFreq"] != Config["TempFrequency"]:
- print(int(Config["InputConfig"]["ThoFreq"]), int(Config["TempFrequency"]))
self.processed_Tho = resample(self.processed_Tho,
int(Config["PSG_seconds"] * Config["TempFrequency"]))
diff --git a/func/Module_artifact_label.py b/func/Module_artifact_label.py
index ccd4348..f092361 100644
--- a/func/Module_artifact_label.py
+++ b/func/Module_artifact_label.py
@@ -9,7 +9,7 @@ from PySide6.QtWidgets import QMessageBox, QMainWindow, QApplication, QTableWidg
from matplotlib import gridspec, patches
from matplotlib.backends.backend_qt import NavigationToolbar2QT
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
-from numpy import array
+from numpy import array, append, sum as np_sum, nonzero
from numpy.fft import fft, fftfreq
from overrides import overrides
from pandas import read_csv, DataFrame, concat
@@ -655,7 +655,12 @@ class MainWindow_artifact_label(QMainWindow):
def __slot_btn_label__(self):
sender = self.sender()
flag = False
- select_row = array([]).astype(dict)
+ select_row = []
+ select_type = array([0, 0, 0, 0, 0])
+ flagf = False
+ flagb = False
+ start_time = 0
+ end_time = 0
if sender == self.ui.pushButton_type_1:
type = 1
@@ -678,61 +683,149 @@ class MainWindow_artifact_label(QMainWindow):
for index, row in self.data.df_Artifact_a.iterrows():
value_startTime = row['startTime']
value_endTime = row['endTime']
+ value_type = row['type']
- # if ((value_endTime >= int(self.ui.lineEdit_start_time.text()) and value_startTime <= int(self.ui.lineEdit_start_time.text())) or
- # (value_endTime >= int(self.ui.lineEdit_end_time.text()) and value_startTime <= int(self.ui.lineEdit_end_time.text())) or
- # (value_startTime >= int(self.ui.lineEdit_start_time.text()) and value_endTime <= int(self.ui.lineEdit_end_time.text())) or
- # (value_startTime <= int(self.ui.lineEdit_start_time.text()) and value_endTime >= int(self.ui.lineEdit_end_time.text()))):
- # select_row = append(select_row, row)
+ if ((value_startTime <= int(self.ui.lineEdit_end_time.text()) <= value_endTime) or
+ (value_startTime <= int(self.ui.lineEdit_start_time.text()) <= value_endTime) or
+ (value_startTime >= int(self.ui.lineEdit_start_time.text()) and value_endTime <= int(self.ui.lineEdit_end_time.text())) or
+ (0 < (int(self.ui.lineEdit_start_time.text()) - value_endTime) <= (2 * Config["InputConfig"]["UseFreq"])) or
+ (0 < (value_startTime - int(self.ui.lineEdit_end_time.text())) <= (2 * Config["InputConfig"]["UseFreq"]))):
+ select_row.append(row.to_dict())
+ if row['type'] == 1:
+ select_type[0] = select_type[0] + 1
+ elif row['type'] == 2:
+ select_type[1] = select_type[1] + 1
+ elif row['type'] == 3:
+ select_type[2] = select_type[2] + 1
+ elif row['type'] == 4:
+ select_type[3] = select_type[3] + 1
+ elif row['type'] == 5:
+ select_type[4] = select_type[4] + 1
+ if (0 < (int(self.ui.lineEdit_start_time.text()) - value_endTime) <= (2 * Config["InputConfig"]["UseFreq"])) and (value_type == type):
+ flagf = True
+ if (0 < (value_startTime - int(self.ui.lineEdit_end_time.text())) <= (2 * Config["InputConfig"]["UseFreq"])) and (value_type == type):
+ flagb = True
- # TODO:体动选取区域的判别尚未做的很完整,选中多个已有的体动的区域时可能会出现问题
- if (type == 1 and row['type'] == 1) or (type == 2 and row['type'] == 2) or (type == 3 and row['type'] == 3):
- if ((value_startTime > int(self.ui.lineEdit_start_time.text()) and (value_startTime - int(self.ui.lineEdit_end_time.text()) <= 2 * Config["InputConfig"]["UseFreq"])) or
- (value_endTime < int(self.ui.lineEdit_end_time.text()) and (int(self.ui.lineEdit_end_time.text()) - value_endTime <= 2 * Config["InputConfig"]["UseFreq"]))):
- reply = QMessageBox.question(self, '确认', '{}{},是否确认合并?'.format(Constants.ARTIFACT_LABEL_MERGE, row['number']), QMessageBox.Yes | QMessageBox.No,
- QMessageBox.No)
- if reply == QMessageBox.Yes:
- self.data.df_Artifact_a.loc[self.data.df_Artifact_a['number'] == row['number'],
- ['number', 'type', 'startTime', 'endTime']] = [
- int(row['number']),
- int(type),
- int(self.ui.lineEdit_start_time.text()) if int(self.ui.lineEdit_start_time.text()) < int(row['startTime']) else int(row['startTime']),
- int(self.ui.lineEdit_end_time.text()) if int(self.ui.lineEdit_end_time.text()) > int(row['endTime']) else int(row['endTime'])
- ]
- new_row = {'number': int(row['number']),
- 'type': int(type),
- 'startTime': int(self.ui.lineEdit_start_time.text()),
- 'endTime': int(self.ui.lineEdit_end_time.text())}
- flag = True
- break
- else:
- return
- if value_startTime <= int(self.ui.lineEdit_end_time.text()) and int(
- self.ui.lineEdit_start_time.text()) <= value_endTime:
- PublicFunc.msgbox_output(self, f"{Constants.ARTIFACT_LABEL_OVERLAPPING}{row['number']}", Constants.MSGBOX_TYPE_ERROR)
- return
+ count = np_sum(select_type >= 1)
+ if count >= 2 or (count == 1 and nonzero(select_type)[0][0] + 1 == type):
+ if count >= 2:
+ reply = QMessageBox.question(self, '确认',
+ '{}{}'.format(Constants.ARTIFACT_LABEL_MULTIPLE_ARTIFACT_COVER_OR_DELETE, [d["number"] for d in select_row]),
+ QMessageBox.Yes | QMessageBox.No,
+ QMessageBox.No)
+ if reply == QMessageBox.No:
+ return
- if not flag:
- new_row = {'number': int(len(self.data.df_Artifact_a) + 1),
- 'type': int(type),
- 'startTime': int(self.ui.lineEdit_start_time.text()),
- 'endTime': int(self.ui.lineEdit_end_time.text())}
- self.data.df_Artifact_a = concat([self.data.df_Artifact_a, DataFrame([new_row])], ignore_index=True)
- sorted_part = self.data.df_Artifact_a[['type', 'startTime', 'endTime']].sort_values(by='startTime').reset_index(
+ if flagf == True and flagb == False:
+ if type == 1 or type == 2 or type == 3:
+ PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE,
+ Constants.MSGBOX_TYPE_INFO)
+ start_time = select_row[0]['startTime']
+ end_time = int(self.ui.lineEdit_end_time.text())
+ elif type == 4 or type == 5:
+ PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_WARNING,
+ Constants.MSGBOX_TYPE_INFO)
+ select_row = select_row[1:]
+ start_time = int(self.ui.lineEdit_start_time.text())
+ end_time = int(self.ui.lineEdit_end_time.text())
+ if flagf == False and flagb == True:
+ if type == 1 or type == 2 or type == 3:
+ PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE,
+ Constants.MSGBOX_TYPE_INFO)
+ start_time = int(self.ui.lineEdit_start_time.text())
+ end_time = select_row[-1]['endTime']
+ elif type == 4 or type == 5:
+ PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_WARNING,
+ Constants.MSGBOX_TYPE_INFO)
+ select_row = select_row[:-1]
+ start_time = int(self.ui.lineEdit_start_time.text())
+ end_time = int(self.ui.lineEdit_end_time.text())
+ if flagf == True and flagb == True:
+ if type == 1 or type == 2 or type == 3:
+ PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE,
+ Constants.MSGBOX_TYPE_INFO)
+ start_time = select_row[0]['startTime']
+ end_time = select_row[-1]['endTime']
+ elif type == 4 or type == 5:
+ PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_WARNING,
+ Constants.MSGBOX_TYPE_INFO)
+ select_row = select_row[1:-1]
+ start_time = int(self.ui.lineEdit_start_time.text())
+ end_time = int(self.ui.lineEdit_end_time.text())
+ if flagf == False and flagb == False:
+ start_time = int(self.ui.lineEdit_start_time.text())
+ end_time = int(self.ui.lineEdit_end_time.text())
+
+ for select_each_row in select_row:
+ self.data.df_Artifact_a = self.data.df_Artifact_a[self.data.df_Artifact_a['number'] != select_each_row["number"]]
+ else:
+ select_row = []
+ select_type = array([0, 0, 0, 0, 0])
+ for index, row in self.data.df_Artifact_a.iterrows():
+ value_startTime = row['startTime']
+ value_endTime = row['endTime']
+ value_type = row['type']
+ if ((value_startTime <= int(self.ui.lineEdit_end_time.text()) <= value_endTime) or
+ (value_startTime <= int(self.ui.lineEdit_start_time.text()) <= value_endTime) or
+ (value_startTime >= int(self.ui.lineEdit_start_time.text()) and value_endTime <= int(
+ self.ui.lineEdit_end_time.text()))):
+ select_row.append(row.to_dict())
+ if row['type'] == 1:
+ select_type[0] = select_type[0] + 1
+ elif row['type'] == 2:
+ select_type[1] = select_type[1] + 1
+ elif row['type'] == 3:
+ select_type[2] = select_type[2] + 1
+ elif row['type'] == 4:
+ select_type[3] = select_type[3] + 1
+ elif row['type'] == 5:
+ select_type[4] = select_type[4] + 1
+
+ count = np_sum(select_type >= 1)
+
+ if (count == 1 and nonzero(select_type)[0][0] + 1 != type):
+ reply = QMessageBox.question(self, '确认',
+ '{}{}'.format(Constants.ARTIFACT_LABEL_SINGLE_TYPE_NOT_EQUAL,
+ [d["number"] for d in select_row]),
+ QMessageBox.Yes | QMessageBox.No,
+ QMessageBox.No)
+ if reply == QMessageBox.No:
+ return
+
+ start_time = int(self.ui.lineEdit_start_time.text())
+ end_time = int(self.ui.lineEdit_end_time.text())
+
+ for select_each_row in select_row:
+ self.data.df_Artifact_a = self.data.df_Artifact_a[self.data.df_Artifact_a['number'] != select_each_row["number"]]
+ elif count == 0:
+ start_time = int(self.ui.lineEdit_start_time.text())
+ end_time = int(self.ui.lineEdit_end_time.text())
+ else:
+ raise ValueError("count值不存在")
+
+ new_row = {
+ 'number': 1,
+ 'type': int(type),
+ 'startTime': start_time,
+ 'endTime': end_time
+ }
+
+ self.data.df_Artifact_a = concat([self.data.df_Artifact_a, DataFrame([new_row])], ignore_index=True)
+ self.data.df_Artifact_a[['type', 'startTime', 'endTime']] = self.data.df_Artifact_a[['type', 'startTime', 'endTime']].sort_values(by='startTime').reset_index(
drop=True)
- self.data.df_Artifact_a[['type', 'startTime', 'endTime']] = sorted_part
+ self.data.df_Artifact_a['number'] = range(1, len(self.data.df_Artifact_a) + 1)
+
self.update_tableWidget()
self.update_Info()
self.__plot_artifact__()
- target_row = self.data.df_Artifact_a[
- self.data.df_Artifact_a.eq(int(self.ui.lineEdit_start_time.text())).any(axis=1)]
+ target_row = self.data.df_Artifact_a[self.data.df_Artifact_a.eq(start_time).any(axis=1)]
if not target_row.empty:
first_column_value = target_row.iloc[0, 0] # 获取第1列的值
else:
raise AttributeError()
- PublicFunc.text_output(self.ui, f"新增体动标签{first_column_value}, 类型{new_row['type']},从{int(self.ui.lineEdit_start_time.text())}ms到{int(self.ui.lineEdit_end_time.text())}ms", Constants.TIPS_TYPE_INFO)
+ PublicFunc.text_output(self.ui, f"新增体动标签{first_column_value}, 类型{new_row['type']},从{int(start_time)}ms到{int(end_time)}ms", Constants.TIPS_TYPE_INFO)
self.save()
diff --git a/func/utils/Constants.py b/func/utils/Constants.py
index ab85a69..7cbdab4 100644
--- a/func/utils/Constants.py
+++ b/func/utils/Constants.py
@@ -324,8 +324,14 @@ class Constants:
ARTIFACT_LABEL_JUMP_ARTIFACT: str = "跳转到体动"
ARTIFACT_LABEL_RECOVER_SCALE: str = "尺度恢复"
ARTIFACT_LABEL_MISS_ARGS: str = "打标参数未填写"
- ARTIFACT_LABEL_OVERLAPPING: str = "当前所打标的片段存在重合,重合片段序号:"
- ARTIFACT_LABEL_MERGE: str = "当前所打标的片段距离附近片段不到2秒,片段序号:"
+ ARTIFACT_LABEL_MULTIPLE_ARTIFACT_COVER_OR_DELETE: str = "所选区域包含多种类型的体动,是否需要删除它们并使用新标注进行覆盖?所选区域中含有的体动序号:"
+ ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE: str = "所选区域前2秒内有与当前标注相同类型的体动,将执行合并"
+ ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE: str = "所选区域后2秒内有与当前标注相同类型的体动,将执行合并"
+ ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE: str = "所选区域前后2秒内都有与当前标注相同类型的体动,将执行合并"
+ ARTIFACT_LABEL_FRONT_TWO_SECONDS_WARNING: str = "所选区域前2秒内有与当前标注相同类型的体动,仅进行提示"
+ ARTIFACT_LABEL_BACK_TWO_SECONDS_WARNING: str = "所选区域后2秒内有与当前标注相同类型的体动,仅进行提示"
+ ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_WARNING: str = "所选区域前后2秒内都有与当前标注相同类型的体动,仅进行提示"
+ ARTIFACT_LABEL_SINGLE_TYPE_NOT_EQUAL: str = "所选区域仅包含一种类型的体动,但其类型与当前标注的类型不匹配,是否需要删除它们并使用新标注覆盖?所选区域中含有的体动序号:"
ARTIFACT_LABEL_DELETE_ARTIFACT_SUCCESSFULLY: str = "体动被删除"
ARTIFACT_LABEL_DELETE_ARTIFACT_FAILURE: str = "需要被删除的体动不存在"
ARTIFACT_LABEL_ACTION_LABEL: str = f"标注体动({Params.ARTIFACT_LABEL_ACTION_LABEL_ARTIFACT_SHORTCUT_KEY})"
From b01e2f1161ce1a56deb40732e8ffe0661d42d6f3 Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Thu, 29 May 2025 14:05:52 +0800
Subject: [PATCH 20/26] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E8=B7=AF?=
=?UTF-8?q?=E5=BE=84=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E6=97=A0=E6=B3=95?=
=?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=88=9B=E5=BB=BA=E6=96=87=E4=BB=B6=E5=A4=B9?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
func/Module_SA_label.py | 3 ---
func/Module_approximately_align.py | 2 --
func/Module_artifact_label.py | 7 -------
func/Module_bcg_quality_label.py | 3 ---
func/Module_cut_PSG.py | 3 ---
func/Module_detect_Jpeak.py | 3 ---
func/Module_detect_Rpeak.py | 3 ---
func/Module_label_check.py | 3 ---
func/Module_mainwindow.py | 25 ++++++++++++++++++++++++-
func/Module_precisely_align.py | 3 ---
func/Module_preprocess.py | 3 ---
func/Module_resp_quality_label.py | 3 ---
13 files changed, 25 insertions(+), 38 deletions(-)
diff --git a/README.md b/README.md
index b38f597..15e2934 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
6、<呼吸可用性及间期标注>的体动显示做一个和一样的可以根据勾选来显示需要显示的体动
-7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹
+~~7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹~~
## 1、主菜单
diff --git a/func/Module_SA_label.py b/func/Module_SA_label.py
index a92237f..acc017f 100644
--- a/func/Module_SA_label.py
+++ b/func/Module_SA_label.py
@@ -1590,9 +1590,6 @@ class Data:
return Result().success(info=Constants.RESAMPLE_FINISHED)
def save(self):
- if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
- Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
-
if self.df_corrected is None:
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
diff --git a/func/Module_approximately_align.py b/func/Module_approximately_align.py
index b0b8a8f..8d4b482 100644
--- a/func/Module_approximately_align.py
+++ b/func/Module_approximately_align.py
@@ -964,8 +964,6 @@ class Data:
return Result().success(info=Constants.INPUT_FINISHED)
def save(self, epoch):
- if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
- Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
try:
pos = Config["pos"]
ApplyFrequency = Config["ApplyFrequency"]
diff --git a/func/Module_artifact_label.py b/func/Module_artifact_label.py
index f092361..4c946ae 100644
--- a/func/Module_artifact_label.py
+++ b/func/Module_artifact_label.py
@@ -1378,13 +1378,6 @@ class Data:
return Result().success(info=Constants.ARCHIVE_EXIST)
def save(self, amount, duration):
- if (not Path(Config["Path"]["Save_a"]).parent.exists()) or (not Path(Config["Path"]["Save_a"]).parent.is_dir()):
- Path(Config["Path"]["Save_a"]).parent.mkdir(parents=True, exist_ok=True)
- if (not Path(Config["Path"]["Save_b"]).parent.exists()) or (not Path(Config["Path"]["Save_b"]).parent.is_dir()):
- Path(Config["Path"]["Save_b"]).parent.mkdir(parents=True, exist_ok=True)
- if (not Path(Config["Path"]["Save_c"]).parent.exists()) or (not Path(Config["Path"]["Save_c"]).parent.is_dir()):
- Path(Config["Path"]["Save_c"]).parent.mkdir(parents=True, exist_ok=True)
-
try:
# Artifact_a.txt和Artifact_c.csv的内容遍历
output_lines = []
diff --git a/func/Module_bcg_quality_label.py b/func/Module_bcg_quality_label.py
index e6f5217..e7deb72 100644
--- a/func/Module_bcg_quality_label.py
+++ b/func/Module_bcg_quality_label.py
@@ -1085,9 +1085,6 @@ class Data():
return Result().success(info=Constants.PREPROCESS_FINISHED)
def save(self, label):
- if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
- Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
-
if self.df_label is None:
return Result().failure(info=Filename.RESP_QUALITY_LABEL + Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
diff --git a/func/Module_cut_PSG.py b/func/Module_cut_PSG.py
index cedb1d6..1d43c64 100644
--- a/func/Module_cut_PSG.py
+++ b/func/Module_cut_PSG.py
@@ -323,9 +323,6 @@ class Data:
return Result().success(info=Constants.CUT_PSG_ALIGN_LABEL_FINISHED)
def save(self):
- if (not Path(Config["Path"]["SaveFolder"]).exists()) or (not Path(Config["Path"]["SaveFolder"]).is_dir()):
- Path(Config["Path"]["SaveFolder"]).mkdir(parents=True, exist_ok=True)
-
for raw in self.raw.values():
if len(raw) == 0:
return Result().failure(info=Constants.SAVE_FAILURE +
diff --git a/func/Module_detect_Jpeak.py b/func/Module_detect_Jpeak.py
index de66a0d..11f36ff 100644
--- a/func/Module_detect_Jpeak.py
+++ b/func/Module_detect_Jpeak.py
@@ -460,9 +460,6 @@ class Data:
return Result().success(info=Constants.DETECT_JPEAK_PREDICT_FINISHED)
def save(self, chunk):
- if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
- Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
-
if self.peak is None:
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
diff --git a/func/Module_detect_Rpeak.py b/func/Module_detect_Rpeak.py
index 76d700e..f884eb4 100644
--- a/func/Module_detect_Rpeak.py
+++ b/func/Module_detect_Rpeak.py
@@ -452,9 +452,6 @@ class Data:
return Result().success(info=Constants.DETECT_RPEAK_PREDICT_FINISHED)
def save(self, chunk):
- if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
- Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
-
if self.peak is None:
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
diff --git a/func/Module_label_check.py b/func/Module_label_check.py
index 14d5517..55b1a43 100644
--- a/func/Module_label_check.py
+++ b/func/Module_label_check.py
@@ -960,9 +960,6 @@ class Data:
return Result().success(info=Constants.INPUT_FINISHED)
def get_archive(self):
- if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
- Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
-
if not Path(Config["Path"]["Save"]).exists():
self.corrected_peak = self.original_peak
return Result().success(info=Constants.ARCHIVE_NOT_EXIST)
diff --git a/func/Module_mainwindow.py b/func/Module_mainwindow.py
index 3f62ec0..056972e 100644
--- a/func/Module_mainwindow.py
+++ b/func/Module_mainwindow.py
@@ -126,6 +126,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.approximately_align.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.approximately_align.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_preprocess__(self):
self.preprocess = MainWindow_preprocess()
@@ -146,6 +147,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.preprocess.show(mode, root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.preprocess.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_detect_Jpeak__(self):
self.detect_Jpeak = MainWindow_detect_Jpeak()
@@ -158,6 +160,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.detect_Jpeak.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.detect_Jpeak.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_detect_Rpeak__(self):
self.detect_Rpeak = MainWindow_detect_Rpeak()
@@ -170,6 +173,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.detect_Rpeak.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.detect_Rpeak.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_label_check__(self):
self.label_check = MainWindow_label_check()
@@ -192,6 +196,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.label_check.show(mode, root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.label_check.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_precisely_align__(self):
self.precisely_align = MainWindow_precisely_align()
@@ -204,6 +209,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.precisely_align.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.precisely_align.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_cut_PSG__(self):
self.cut_PSG = MainWindow_cut_PSG()
@@ -214,6 +220,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.cut_PSG.show(root_path, int(sampID))
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_artifact_label__(self):
self.artifact_label = MainWindow_artifact_label()
@@ -226,6 +233,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.artifact_label.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.artifact_label.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_bcg_quality_label__(self):
self.bcg_quality_label = MainWindow_bcg_quality_label()
@@ -238,6 +246,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.bcg_quality_label.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.bcg_quality_label.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_resp_quality_label__(self):
self.resp_quality_label = MainWindow_resp_quality_label()
@@ -250,6 +259,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.resp_quality_label.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.resp_quality_label.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def __slot_btn_SA_label__(self):
self.SA_label = MainWindow_SA_label()
@@ -262,6 +272,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.SA_label.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.SA_label.showMaximized()
+ self.check_save_path_and_mkdir(root_path, sampID)
def seek_sampID(self, path):
if not Path(path).exists():
@@ -271,7 +282,6 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
sub_folders = [item.name for item in Path(path).iterdir() if item.is_dir()]
self.ui.comboBox_sampID.addItems(sub_folders)
-
def check_root_path(self):
if self.ui.plainTextEdit_root_path.toPlainText() == Constants.STRING_IS_EMPTY:
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_ROOT_PATH_NOT_EXIST, Constants.MSGBOX_TYPE_ERROR)
@@ -283,3 +293,16 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_SAMPID_EMPTY, Constants.MSGBOX_TYPE_ERROR)
return False
return True
+
+ def check_save_path_and_mkdir(self, root_path, sampID):
+ path_Label = Path(root_path) / Path(Filename.PATH_LABEL) / Path(str(sampID))
+ path_OrgBCG_Aligned = Path(root_path) / Path(Filename.PATH_ORGBCG_ALIGNED) / Path(str(sampID))
+ path_PSG_Aligned = Path(root_path) / Path(Filename.PATH_PSG_ALIGNED) / Path(str(sampID))
+ path_OrgBCG_Text = Path(root_path) / Path(Filename.PATH_ORGBCG_TEXT) / Path(str(sampID))
+ path_PSG_Text = Path(root_path) / Path(Filename.PATH_PSG_TEXT) / Path(str(sampID))
+
+ path_list = [path_Label, path_OrgBCG_Aligned, path_PSG_Aligned, path_OrgBCG_Text, path_PSG_Text]
+
+ for path in path_list:
+ if not path.exists():
+ path.mkdir(parents=True, exist_ok=True)
\ No newline at end of file
diff --git a/func/Module_precisely_align.py b/func/Module_precisely_align.py
index 4093469..98934a6 100644
--- a/func/Module_precisely_align.py
+++ b/func/Module_precisely_align.py
@@ -1871,9 +1871,6 @@ class Data:
return Result().success(info=info)
def save_alignInfo(self):
- if (not Path(Config["Path"]["Save_AlignInfo"]).parent.exists()) or (not Path(Config["Path"]["Save_AlignInfo"]).parent.is_dir()):
- Path(Config["Path"]["Save_AlignInfo"]).parent.mkdir(parents=True, exist_ok=True)
-
try:
save_data = {
"front": {
diff --git a/func/Module_preprocess.py b/func/Module_preprocess.py
index f751ef5..f016e26 100644
--- a/func/Module_preprocess.py
+++ b/func/Module_preprocess.py
@@ -474,9 +474,6 @@ class Data:
return Result().success(info=Constants.PREPROCESS_FINISHED)
def save(self, chunk):
- if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
- Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
-
if self.processed_data is None:
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
diff --git a/func/Module_resp_quality_label.py b/func/Module_resp_quality_label.py
index e6ab281..7699227 100644
--- a/func/Module_resp_quality_label.py
+++ b/func/Module_resp_quality_label.py
@@ -1458,9 +1458,6 @@ class Data():
return BDR, band_low, band_high, bcg_spectrum, bcg_freq, tho_spectrum, tho_freq
def save_resp_quality_label(self):
- if (not Path(Config["Path"]["Save_Resp_quality_label"]).parent.exists()) or (not Path(Config["Path"]["Save_Resp_quality_label"]).parent.is_dir()):
- Path(Config["Path"]["Save_Resp_quality_label"]).parent.mkdir(parents=True, exist_ok=True)
-
if self.resp_quality_label is None:
return Result().failure(info=Filename.RESP_QUALITY_LABEL + Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
From e379aa6a4abc5147451791ef9e2b22a7ab6515ee Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Thu, 29 May 2025 21:13:44 +0800
Subject: [PATCH 21/26] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E5=92=8C<=E5=91=BC?=
=?UTF-8?q?=E5=90=B8=E5=8F=AF=E7=94=A8=E6=80=A7=E5=8F=8A=E9=97=B4=E6=9C=9F?=
=?UTF-8?q?=E6=A0=87=E6=B3=A8>=E7=9A=84=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
func/Module_bcg_quality_label.py | 26 +-
ui/MainWindow/MainWindow_bcg_quality_label.py | 26 +-
ui/MainWindow/MainWindow_bcg_quality_label.ui | 24 +-
.../MainWindow_resp_quality_label.py | 83 +++++-
.../MainWindow_resp_quality_label.ui | 244 +++++++++++++-----
5 files changed, 291 insertions(+), 112 deletions(-)
diff --git a/func/Module_bcg_quality_label.py b/func/Module_bcg_quality_label.py
index e7deb72..b524db7 100644
--- a/func/Module_bcg_quality_label.py
+++ b/func/Module_bcg_quality_label.py
@@ -293,14 +293,20 @@ class MainWindow_bcg_quality_label(QMainWindow):
if (sender == self.ui.pushButton_input or
sender == self.ui.pushButton_prev or
sender == self.ui.pushButton_next or
- self.ui.tableWidget_a1 or
- self.ui.tableWidget_a2 or
- self.ui.tableWidget_b1 or
- self.ui.tableWidget_b2 or
- self.ui.tableWidget_c or
- self.ui.tableWidget_f or
- self.ui.checkBox_highlight_longest_continuous or
- self.ui.checkBox_display_afterfilter):
+ sender == self.ui.tableWidget_a1 or
+ sender == self.ui.tableWidget_a2 or
+ sender == self.ui.tableWidget_b1 or
+ sender == self.ui.tableWidget_b2 or
+ sender == self.ui.tableWidget_c or
+ sender == self.ui.tableWidget_f or
+ sender == self.ui.checkBox_highlight_longest_continuous or
+ sender == self.ui.checkBox_display_afterfilter or
+ sender == self.ui.checkBox_allin or
+ sender == self.ui.checkBox_type1 or
+ sender == self.ui.checkBox_type2 or
+ sender == self.ui.checkBox_type3 or
+ sender == self.ui.checkBox_type4 or
+ sender == self.ui.checkBox_type5):
try:
artifact_type_seq = array([])
artifact_type_seq = artifact_type_seq.astype(int64)
@@ -336,8 +342,8 @@ class MainWindow_bcg_quality_label(QMainWindow):
display_data[Config["CurrentDataIdx"]: Config["CurrentDataIdx"] + length],
label=Constants.BCG_QUALITY_LABEL_PLOT_LABEL_SIGNAL, color=Constants.PLOT_COLOR_BLUE)
for i in artifact_type_seq:
- mask[i] = self.data.artifact_mask[Config["CurrentDataIdx"]: Config["CurrentDataIdx"] + length] == i
- mask[i] = (display_data[Config["CurrentDataIdx"]: Config["CurrentDataIdx"] + length] *
+ mask[i] = self.data.artifact_mask[Config["CurrentDataIdx"]:Config["CurrentDataIdx"] + length] == i
+ mask[i] = (display_data[Config["CurrentDataIdx"]:Config["CurrentDataIdx"] + length] *
mask[i]).astype(float64)
place(mask[i], mask[i] == 0, nan)
self.ax0.plot(arange(Config["CurrentDataIdx"], Config["CurrentDataIdx"] + length), mask[i],
diff --git a/ui/MainWindow/MainWindow_bcg_quality_label.py b/ui/MainWindow/MainWindow_bcg_quality_label.py
index dec5d33..2d2c363 100644
--- a/ui/MainWindow/MainWindow_bcg_quality_label.py
+++ b/ui/MainWindow/MainWindow_bcg_quality_label.py
@@ -158,8 +158,8 @@ class Ui_MainWindow_bcg_quality_label(object):
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.groupBox_artifact_type = QGroupBox(self.groupBox_left)
self.groupBox_artifact_type.setObjectName(u"groupBox_artifact_type")
- self.gridLayout_6 = QGridLayout(self.groupBox_artifact_type)
- self.gridLayout_6.setObjectName(u"gridLayout_6")
+ self.verticalLayout_3 = QVBoxLayout(self.groupBox_artifact_type)
+ self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.checkBox_allin = QCheckBox(self.groupBox_artifact_type)
self.checkBox_allin.setObjectName(u"checkBox_allin")
font2 = QFont()
@@ -167,42 +167,42 @@ class Ui_MainWindow_bcg_quality_label(object):
self.checkBox_allin.setFont(font2)
self.checkBox_allin.setChecked(True)
- self.gridLayout_6.addWidget(self.checkBox_allin, 0, 1, 1, 1)
+ self.verticalLayout_3.addWidget(self.checkBox_allin)
self.checkBox_type1 = QCheckBox(self.groupBox_artifact_type)
self.checkBox_type1.setObjectName(u"checkBox_type1")
self.checkBox_type1.setFont(font1)
self.checkBox_type1.setChecked(True)
- self.gridLayout_6.addWidget(self.checkBox_type1, 0, 2, 1, 1)
+ self.verticalLayout_3.addWidget(self.checkBox_type1)
self.checkBox_type2 = QCheckBox(self.groupBox_artifact_type)
self.checkBox_type2.setObjectName(u"checkBox_type2")
self.checkBox_type2.setFont(font1)
self.checkBox_type2.setChecked(True)
- self.gridLayout_6.addWidget(self.checkBox_type2, 1, 1, 1, 1)
+ self.verticalLayout_3.addWidget(self.checkBox_type2)
self.checkBox_type3 = QCheckBox(self.groupBox_artifact_type)
self.checkBox_type3.setObjectName(u"checkBox_type3")
self.checkBox_type3.setFont(font1)
self.checkBox_type3.setChecked(True)
- self.gridLayout_6.addWidget(self.checkBox_type3, 1, 2, 1, 1)
+ self.verticalLayout_3.addWidget(self.checkBox_type3)
self.checkBox_type4 = QCheckBox(self.groupBox_artifact_type)
self.checkBox_type4.setObjectName(u"checkBox_type4")
self.checkBox_type4.setFont(font1)
self.checkBox_type4.setChecked(True)
- self.gridLayout_6.addWidget(self.checkBox_type4, 2, 1, 1, 1)
+ self.verticalLayout_3.addWidget(self.checkBox_type4)
self.checkBox_type5 = QCheckBox(self.groupBox_artifact_type)
self.checkBox_type5.setObjectName(u"checkBox_type5")
self.checkBox_type5.setFont(font1)
self.checkBox_type5.setChecked(True)
- self.gridLayout_6.addWidget(self.checkBox_type5, 2, 2, 1, 1)
+ self.verticalLayout_3.addWidget(self.checkBox_type5)
self.horizontalLayout_2.addWidget(self.groupBox_artifact_type)
@@ -510,11 +510,11 @@ class Ui_MainWindow_bcg_quality_label(object):
self.label_13.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u4f53\u52a8\u65f6\u95f4\u5360\u6bd4", None))
self.groupBox_artifact_type.setTitle(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u4f53\u52a8\u7c7b\u578b", None))
self.checkBox_allin.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u5168\u9009", None))
- self.checkBox_type1.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b1", None))
- self.checkBox_type2.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b2", None))
- self.checkBox_type3.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b3", None))
- self.checkBox_type4.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b4", None))
- self.checkBox_type5.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b5", None))
+ self.checkBox_type1.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b1-\u5267\u70c8\u4f53\u52a8", None))
+ self.checkBox_type2.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b2-\u8109\u51b2\u4f53\u52a8", None))
+ self.checkBox_type3.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b3-\u5e38\u89c4\u4f53\u52a8", None))
+ self.checkBox_type4.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b4-\u7591\u4f3c\u9f3e\u58f0", None))
+ self.checkBox_type5.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u7c7b\u578b5-\u79bb\u5e8a", None))
self.groupBox_function.setTitle(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u529f\u80fd", None))
self.pushButton_invalid_signal_label.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"\u65e0\u6548\u4fe1\u53f7\u6807\u6ce8", None))
self.pushButton_Ctype_signal_label.setText(QCoreApplication.translate("MainWindow_bcg_quality_label", u"C\u7c7b\u4fe1\u53f7\u6807\u6ce8", None))
diff --git a/ui/MainWindow/MainWindow_bcg_quality_label.ui b/ui/MainWindow/MainWindow_bcg_quality_label.ui
index 5be4fb4..7fdaef1 100644
--- a/ui/MainWindow/MainWindow_bcg_quality_label.ui
+++ b/ui/MainWindow/MainWindow_bcg_quality_label.ui
@@ -245,8 +245,8 @@
体动类型
-
- -
+
+
-
@@ -261,7 +261,7 @@
- -
+
-
@@ -269,14 +269,14 @@
- 类型1
+ 类型1-剧烈体动
true
- -
+
-
@@ -284,14 +284,14 @@
- 类型2
+ 类型2-脉冲体动
true
- -
+
-
@@ -299,14 +299,14 @@
- 类型3
+ 类型3-常规体动
true
- -
+
-
@@ -314,14 +314,14 @@
- 类型4
+ 类型4-疑似鼾声
true
- -
+
-
@@ -329,7 +329,7 @@
- 类型5
+ 类型5-离床
true
diff --git a/ui/MainWindow/MainWindow_resp_quality_label.py b/ui/MainWindow/MainWindow_resp_quality_label.py
index 24339c4..7a5e9a5 100644
--- a/ui/MainWindow/MainWindow_resp_quality_label.py
+++ b/ui/MainWindow/MainWindow_resp_quality_label.py
@@ -15,11 +15,11 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
-from PySide6.QtWidgets import (QApplication, QDoubleSpinBox, QGridLayout, QGroupBox,
- QHBoxLayout, QHeaderView, QLabel, QLineEdit,
- QMainWindow, QPushButton, QRadioButton, QSizePolicy,
- QSpacerItem, QStatusBar, QTableWidget, QTableWidgetItem,
- QTextBrowser, QVBoxLayout, QWidget)
+from PySide6.QtWidgets import (QApplication, QCheckBox, QDoubleSpinBox, QGridLayout,
+ QGroupBox, QHBoxLayout, QHeaderView, QLabel,
+ QLineEdit, QMainWindow, QPushButton, QRadioButton,
+ QSizePolicy, QSpacerItem, QStatusBar, QTableWidget,
+ QTableWidgetItem, QTextBrowser, QVBoxLayout, QWidget)
class Ui_MainWindow_resp_quality_label(object):
def setupUi(self, MainWindow_resp_quality_label):
@@ -159,6 +159,59 @@ class Ui_MainWindow_resp_quality_label(object):
self.verticalLayout_2.addWidget(self.groupBox_autoqualitylabel_options)
+ self.horizontalLayout_2 = QHBoxLayout()
+ self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
+ self.groupBox_artifact_type = QGroupBox(self.groupBox_left)
+ self.groupBox_artifact_type.setObjectName(u"groupBox_artifact_type")
+ self.verticalLayout_3 = QVBoxLayout(self.groupBox_artifact_type)
+ self.verticalLayout_3.setObjectName(u"verticalLayout_3")
+ self.checkBox_allin = QCheckBox(self.groupBox_artifact_type)
+ self.checkBox_allin.setObjectName(u"checkBox_allin")
+ font2 = QFont()
+ font2.setPointSize(20)
+ self.checkBox_allin.setFont(font2)
+ self.checkBox_allin.setChecked(True)
+
+ self.verticalLayout_3.addWidget(self.checkBox_allin)
+
+ self.checkBox_type1 = QCheckBox(self.groupBox_artifact_type)
+ self.checkBox_type1.setObjectName(u"checkBox_type1")
+ self.checkBox_type1.setFont(font1)
+ self.checkBox_type1.setChecked(True)
+
+ self.verticalLayout_3.addWidget(self.checkBox_type1)
+
+ self.checkBox_type2 = QCheckBox(self.groupBox_artifact_type)
+ self.checkBox_type2.setObjectName(u"checkBox_type2")
+ self.checkBox_type2.setFont(font1)
+ self.checkBox_type2.setChecked(True)
+
+ self.verticalLayout_3.addWidget(self.checkBox_type2)
+
+ self.checkBox_type3 = QCheckBox(self.groupBox_artifact_type)
+ self.checkBox_type3.setObjectName(u"checkBox_type3")
+ self.checkBox_type3.setFont(font1)
+ self.checkBox_type3.setChecked(True)
+
+ self.verticalLayout_3.addWidget(self.checkBox_type3)
+
+ self.checkBox_type4 = QCheckBox(self.groupBox_artifact_type)
+ self.checkBox_type4.setObjectName(u"checkBox_type4")
+ self.checkBox_type4.setFont(font1)
+ self.checkBox_type4.setChecked(True)
+
+ self.verticalLayout_3.addWidget(self.checkBox_type4)
+
+ self.checkBox_type5 = QCheckBox(self.groupBox_artifact_type)
+ self.checkBox_type5.setObjectName(u"checkBox_type5")
+ self.checkBox_type5.setFont(font1)
+ self.checkBox_type5.setChecked(True)
+
+ self.verticalLayout_3.addWidget(self.checkBox_type5)
+
+
+ self.horizontalLayout_2.addWidget(self.groupBox_artifact_type)
+
self.groupBox_findpeaks_options = QGroupBox(self.groupBox_left)
self.groupBox_findpeaks_options.setObjectName(u"groupBox_findpeaks_options")
self.gridLayout_2 = QGridLayout(self.groupBox_findpeaks_options)
@@ -194,7 +247,11 @@ class Ui_MainWindow_resp_quality_label(object):
self.gridLayout_2.addWidget(self.doubleSpinBox_findpeaks_min_height, 1, 1, 1, 1)
- self.verticalLayout_2.addWidget(self.groupBox_findpeaks_options)
+ self.horizontalLayout_2.addWidget(self.groupBox_findpeaks_options)
+
+ self.horizontalLayout_2.setStretch(0, 2)
+
+ self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.groupBox_threshold_setting = QGroupBox(self.groupBox_left)
self.groupBox_threshold_setting.setObjectName(u"groupBox_threshold_setting")
@@ -246,6 +303,7 @@ class Ui_MainWindow_resp_quality_label(object):
self.label_7 = QLabel(self.groupBox_threshold_setting)
self.label_7.setObjectName(u"label_7")
self.label_7.setFont(font1)
+ self.label_7.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.gridLayout_6.addWidget(self.label_7, 3, 2, 1, 1)
@@ -257,6 +315,10 @@ class Ui_MainWindow_resp_quality_label(object):
self.gridLayout_6.addWidget(self.pushButton_refilter_orgBcg, 0, 2, 1, 2)
+ self.gridLayout_6.setColumnStretch(0, 2)
+ self.gridLayout_6.setColumnStretch(1, 2)
+ self.gridLayout_6.setColumnStretch(2, 1)
+ self.gridLayout_6.setColumnStretch(3, 2)
self.verticalLayout_2.addWidget(self.groupBox_threshold_setting)
@@ -364,8 +426,6 @@ class Ui_MainWindow_resp_quality_label(object):
self.verticalLayout_2.setStretch(1, 3)
self.verticalLayout_2.setStretch(2, 1)
self.verticalLayout_2.setStretch(3, 3)
- self.verticalLayout_2.setStretch(4, 3)
- self.verticalLayout_2.setStretch(5, 3)
self.verticalLayout_2.setStretch(6, 1)
self.verticalLayout_2.setStretch(7, 6)
self.verticalLayout_2.setStretch(8, 5)
@@ -467,6 +527,13 @@ class Ui_MainWindow_resp_quality_label(object):
self.label_6.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"threshold[1]", None))
self.label_5.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"threshold[0]", None))
self.pushButton_autoqualitylabel_recalculate.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u5e94\u7528\u5e76\u8ba1\u7b97", None))
+ self.groupBox_artifact_type.setTitle(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u4f53\u52a8\u7c7b\u578b", None))
+ self.checkBox_allin.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u5168\u9009", None))
+ self.checkBox_type1.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u7c7b\u578b1-\u5267\u70c8\u4f53\u52a8", None))
+ self.checkBox_type2.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u7c7b\u578b2-\u8109\u51b2\u4f53\u52a8", None))
+ self.checkBox_type3.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u7c7b\u578b3-\u5e38\u89c4\u4f53\u52a8", None))
+ self.checkBox_type4.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u7c7b\u578b4-\u7591\u4f3c\u9f3e\u58f0", None))
+ self.checkBox_type5.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u7c7b\u578b5-\u79bb\u5e8a", None))
self.groupBox_findpeaks_options.setTitle(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u5bfb\u5cf0\u53c2\u6570\u8bbe\u7f6e", None))
self.label_4.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u6700\u5c0f\u95f4\u9694", None))
self.label_3.setText(QCoreApplication.translate("MainWindow_resp_quality_label", u"\u6700\u5c0f\u9ad8\u5ea6", None))
diff --git a/ui/MainWindow/MainWindow_resp_quality_label.ui b/ui/MainWindow/MainWindow_resp_quality_label.ui
index 14af760..d522177 100644
--- a/ui/MainWindow/MainWindow_resp_quality_label.ui
+++ b/ui/MainWindow/MainWindow_resp_quality_label.ui
@@ -42,7 +42,7 @@
呼吸可用性及间期标注
-
+
-
-
@@ -248,80 +248,183 @@
-
-
-
- 寻峰参数设置
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 12
-
-
-
- 最小间隔
-
-
-
- -
-
-
-
- 12
-
-
-
- 10000.000000000000000
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 12
-
-
-
- 最小高度
-
-
-
- -
-
-
-
- 12
-
-
-
- 10000.000000000000000
-
-
-
-
-
+
+ -
+
+
+ 体动类型
+
+
+
-
+
+
+
+ 20
+
+
+
+ 全选
+
+
+ true
+
+
+
+ -
+
+
+
+ 12
+
+
+
+ 类型1-剧烈体动
+
+
+ true
+
+
+
+ -
+
+
+
+ 12
+
+
+
+ 类型2-脉冲体动
+
+
+ true
+
+
+
+ -
+
+
+
+ 12
+
+
+
+ 类型3-常规体动
+
+
+ true
+
+
+
+ -
+
+
+
+ 12
+
+
+
+ 类型4-疑似鼾声
+
+
+ true
+
+
+
+ -
+
+
+
+ 12
+
+
+
+ 类型5-离床
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ 寻峰参数设置
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 12
+
+
+
+ 最小间隔
+
+
+
+ -
+
+
+
+ 12
+
+
+
+ 10000.000000000000000
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 12
+
+
+
+ 最小高度
+
+
+
+ -
+
+
+
+ 12
+
+
+
+ 10000.000000000000000
+
+
+
+
+
+
+
-
OrgBCG带通滤波频率设置
-
+
-
@@ -419,6 +522,9 @@
~
+
+ Qt::AlignmentFlag::AlignCenter
+
-
From afc93cf498fdff4cd8529bf54757367fbec1811e Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Thu, 29 May 2025 21:21:02 +0800
Subject: [PATCH 22/26] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=AD=E4=BD=93?=
=?UTF-8?q?=E5=8A=A8=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
func/Module_bcg_quality_label.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/func/Module_bcg_quality_label.py b/func/Module_bcg_quality_label.py
index b524db7..d903e9f 100644
--- a/func/Module_bcg_quality_label.py
+++ b/func/Module_bcg_quality_label.py
@@ -1030,7 +1030,16 @@ class Data():
artifact_end = append(artifact_end, self.Artifact_a[i])
self.artifact_mask = zeros(len(self.BCG))
for i in range(0, len(self.artifact_number)):
- self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 1
+ if self.artifact_type[i] == 1:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 1
+ elif self.artifact_type[i] == 2:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 2
+ elif self.artifact_type[i] == 3:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 3
+ elif self.artifact_type[i] == 4:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 4
+ elif self.artifact_type[i] == 5:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 5
except Exception as e:
return Result().failure(info=Constants.INPUT_FAILURE +
Constants.FAILURE_REASON["Get_Artifact_Format_Exception"] + "\n" + format_exc())
From 6494dc84788fa5ab81dbf09b887bd8b396ed1d79 Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Thu, 29 May 2025 21:30:25 +0800
Subject: [PATCH 23/26] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86<=E5=91=BC?=
=?UTF-8?q?=E5=90=B8=E5=8F=AF=E7=94=A8=E6=80=A7=E5=8F=8A=E9=97=B4=E6=9C=9F?=
=?UTF-8?q?=E6=A0=87=E6=B3=A8>=E7=9A=84=E4=BD=93=E5=8A=A8=E5=88=86?=
=?UTF-8?q?=E7=B1=BB=E6=98=BE=E7=A4=BA=E7=9A=84=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
func/Module_resp_quality_label.py | 92 ++++++++++++++++++++++++++++---
1 file changed, 83 insertions(+), 9 deletions(-)
diff --git a/func/Module_resp_quality_label.py b/func/Module_resp_quality_label.py
index 7699227..54c9577 100644
--- a/func/Module_resp_quality_label.py
+++ b/func/Module_resp_quality_label.py
@@ -285,6 +285,12 @@ class MainWindow_resp_quality_label(QMainWindow):
self.ui.pushButton_reset.clicked.connect(self.__slot_btn_label__)
self.ui.lineEdit_filter_labeled.textChanged.connect(self.__slot_lineEdit_filter__)
self.ui.lineEdit_filter_tobelabeled.textChanged.connect(self.__slot_lineEdit_filter__)
+ self.ui.checkBox_allin.clicked.connect(self.__slot_checkBox__)
+ self.ui.checkBox_type1.clicked.connect(self.__slot_checkBox__)
+ self.ui.checkBox_type2.clicked.connect(self.__slot_checkBox__)
+ self.ui.checkBox_type3.clicked.connect(self.__slot_checkBox__)
+ self.ui.checkBox_type4.clicked.connect(self.__slot_checkBox__)
+ self.ui.checkBox_type5.clicked.connect(self.__slot_checkBox__)
self.ui.doubleSpinBox_quality_threshold1.valueChanged.connect(self.update_config)
self.ui.doubleSpinBox_quality_threshold2.valueChanged.connect(self.update_config)
self.ui.doubleSpinBox_findpeaks_min_interval.valueChanged.connect(self.update_config)
@@ -349,7 +355,13 @@ class MainWindow_resp_quality_label(QMainWindow):
sender == self.ui.pushButton_prev or
sender == self.ui.pushButton_next or
sender == self.ui.tableWidget_labeled or
- sender == self.ui.tableWidget_tobelabeled):
+ sender == self.ui.tableWidget_tobelabeled or
+ sender == self.ui.checkBox_allin or
+ sender == self.ui.checkBox_type1 or
+ sender == self.ui.checkBox_type2 or
+ sender == self.ui.checkBox_type3 or
+ sender == self.ui.checkBox_type4 or
+ sender == self.ui.checkBox_type5):
try:
if Config["CurrentPartNum"] != Config["DataPartNum"]:
begin_OrgBCG = Config["CurrentOrgBCGIndex"]
@@ -385,15 +397,34 @@ class MainWindow_resp_quality_label(QMainWindow):
[self.data.Tho_peak_y[x] for x in
[index for index, value in enumerate(self.data.Tho_peak) if begin_Tho <= value <= end_Tho]], 'ro',
label=Constants.RESP_QUALITY_LABEL_PLOT_LABEL_THO_PEAKS)
+
+ # 绘制体动
+ artifact_type_seq = array([])
+ artifact_type_seq = artifact_type_seq.astype(int64)
+ if self.ui.checkBox_type1.isChecked():
+ artifact_type_seq = append(artifact_type_seq, 1)
+ if self.ui.checkBox_type2.isChecked():
+ artifact_type_seq = append(artifact_type_seq, 2)
+ if self.ui.checkBox_type3.isChecked():
+ artifact_type_seq = append(artifact_type_seq, 3)
+ if self.ui.checkBox_type4.isChecked():
+ artifact_type_seq = append(artifact_type_seq, 4)
+ if self.ui.checkBox_type5.isChecked():
+ artifact_type_seq = append(artifact_type_seq, 5)
+ length = Config["InputConfig"]["OrgBCGUseFreq"] * Params.RESP_QUALITY_LABEL_PARTS_TIME_SEC
+ mask = array([arange(length), arange(length), arange(length), arange(length), arange(length), arange(length)])
+ mask = mask.astype(float64)
+ for i in artifact_type_seq:
+ mask[i] = self.data.artifact_mask[begin_OrgBCG:end_OrgBCG] == i
+ mask[i] = (BDR[begin_OrgBCG:end_OrgBCG] * mask[i]).astype(float64)
+ place(mask[i], mask[i] == 0, nan)
+ self.ax0.plot(arange(begin_OrgBCG, end_OrgBCG), mask[i],
+ label=f"{Constants.RESP_QUALITY_LABEL_PLOT_LABEL_ARTIFACT}{i}", color=Constants.PLOT_COLOR_RED,
+ linestyle="-")
+
self.ax0.legend(loc=Constants.PLOT_UPPER_RIGHT)
self.ax1.legend(loc=Constants.PLOT_UPPER_RIGHT)
- # 绘制体动
- mask = self.data.artifact_mask[begin_OrgBCG: end_OrgBCG] == 1
- mask = (BDR * mask).astype(float64)
- place(mask, mask == 0, nan)
- self.ax0.plot(arange(begin_OrgBCG, end_OrgBCG), mask,
- label=f"{Constants.RESP_QUALITY_LABEL_PLOT_LABEL_ARTIFACT}",
- color=Constants.PLOT_COLOR_PINK, linestyle="-")
+
# 绘制频谱
self.ax0_spectrum.plot(bcg_freq, bcg_spectrum,
label=Constants.RESP_QUALITY_LABEL_SPECTRUM_ORGBCG_LABEL,
@@ -952,6 +983,40 @@ class MainWindow_resp_quality_label(QMainWindow):
else:
raise ValueError("发生信号不存在")
+ def __slot_checkBox__(self):
+ sender = self.sender()
+
+ if sender == self.ui.checkBox_allin:
+ if self.ui.checkBox_allin.isChecked():
+ self.ui.checkBox_type1.setChecked(True)
+ self.ui.checkBox_type2.setChecked(True)
+ self.ui.checkBox_type3.setChecked(True)
+ self.ui.checkBox_type4.setChecked(True)
+ self.ui.checkBox_type5.setChecked(True)
+ else:
+ self.ui.checkBox_type1.setChecked(False)
+ self.ui.checkBox_type2.setChecked(False)
+ self.ui.checkBox_type3.setChecked(False)
+ self.ui.checkBox_type4.setChecked(False)
+ self.ui.checkBox_type5.setChecked(False)
+ elif (sender == self.ui.checkBox_type1 or
+ sender == self.ui.checkBox_type2 or
+ sender == self.ui.checkBox_type3 or
+ sender == self.ui.checkBox_type4 or
+ sender == self.ui.checkBox_type5):
+ if (self.ui.checkBox_type1.isChecked() and
+ self.ui.checkBox_type2.isChecked() and
+ self.ui.checkBox_type3.isChecked() and
+ self.ui.checkBox_type4.isChecked() and
+ self.ui.checkBox_type5.isChecked()):
+ self.ui.checkBox_allin.setChecked(True)
+ else:
+ self.ui.checkBox_allin.setChecked(False)
+ else:
+ raise ValueError("发射信号不存在")
+
+ self.__plot__()
+
def reset_axes(self):
if self.ax0 is not None:
self.ax0.clear()
@@ -1372,7 +1437,16 @@ class Data():
artifact_end = append(artifact_end, self.Artifact_a[i])
self.artifact_mask = zeros(len(self.OrgBCG))
for i in range(0, len(self.artifact_number)):
- self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 1
+ if self.artifact_type[i] == 1:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 1
+ elif self.artifact_type[i] == 2:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 2
+ elif self.artifact_type[i] == 3:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 3
+ elif self.artifact_type[i] == 4:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 4
+ elif self.artifact_type[i] == 5:
+ self.artifact_mask[artifact_start[i]: artifact_end[i] + 1] = 5
except Exception as e:
return Result().failure(info=Constants.INPUT_FAILURE +
Constants.FAILURE_REASON["Get_Artifact_Format_Exception"] + "\n" + format_exc())
From 80ffbbcc6980aa7d0834c945ef59adef16a9dab4 Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Thu, 29 May 2025 21:40:00 +0800
Subject: [PATCH 24/26] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 15e2934..7357f8d 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
~~5、写一个脚本,用于直接从ConfigParams.py中读取文件命名规则,并直接自动化写入到一个markdown文件中。目的是方便文件命名的修改~~
-6、<呼吸可用性及间期标注>的体动显示做一个和一样的可以根据勾选来显示需要显示的体动
+~~6、<呼吸可用性及间期标注>的体动显示做一个和一样的可以根据勾选来显示需要显示的体动~~
~~7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹~~
From e23f3e8ee054766855425843717150083c0a2c1a Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Thu, 29 May 2025 22:07:37 +0800
Subject: [PATCH 25/26] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E7=AC=AC?=
=?UTF-8?q?=E4=B8=80=E6=AC=A1=E6=89=93=E5=BC=80<=E4=BA=BA=E5=B7=A5?=
=?UTF-8?q?=E7=BA=A0=E6=AD=A3>=E6=97=B6=E5=B0=B1=E4=BF=9D=E5=AD=98?=
=?UTF-8?q?=E7=BA=A0=E6=AD=A3=E5=90=8E=E7=9A=84=E6=96=87=E4=BB=B6=E7=9A=84?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
func/Module_label_check.py | 47 +++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/func/Module_label_check.py b/func/Module_label_check.py
index 55b1a43..e28b0b1 100644
--- a/func/Module_label_check.py
+++ b/func/Module_label_check.py
@@ -464,70 +464,81 @@ class MainWindow_label_check(QMainWindow):
self.data = Data()
# 导入数据
- PublicFunc.progressbar_update(self, 1, 6, Constants.INPUTTING_DATA, 0)
+ PublicFunc.progressbar_update(self, 1, 7, Constants.INPUTTING_DATA, 0)
result = self.data.open_file()
if not result.status:
- PublicFunc.text_output(self.ui, "(1/6)" + result.info, Constants.TIPS_TYPE_ERROR)
+ PublicFunc.text_output(self.ui, "(1/7)" + result.info, Constants.TIPS_TYPE_ERROR)
PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
PublicFunc.finish_operation(self, ButtonState)
return
else:
- PublicFunc.text_output(self.ui, "(1/6)" + result.info, Constants.TIPS_TYPE_INFO)
+ PublicFunc.text_output(self.ui, "(1/7)" + result.info, Constants.TIPS_TYPE_INFO)
# 获取存档
- PublicFunc.progressbar_update(self, 2, 6, Constants.LOADING_ARCHIVE, 20)
+ PublicFunc.progressbar_update(self, 2, 7, Constants.LOADING_ARCHIVE, 20)
result = self.data.get_archive()
if not result.status:
- PublicFunc.text_output(self.ui, "(2/6)" + result.info, Constants.TIPS_TYPE_ERROR)
+ PublicFunc.text_output(self.ui, "(2/7)" + result.info, Constants.TIPS_TYPE_ERROR)
PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
PublicFunc.finish_operation(self, ButtonState)
return
else:
- PublicFunc.text_output(self.ui, "(2/6)" + result.info, Constants.TIPS_TYPE_INFO)
+ PublicFunc.text_output(self.ui, "(2/7)" + result.info, Constants.TIPS_TYPE_INFO)
+
+ # 保存
+ PublicFunc.progressbar_update(self, 3, 7, Constants.SAVING_DATA, 25)
+ result = self.data.save()
+ if not result.status:
+ PublicFunc.text_output(self.ui, "(3/7)" + result.info, Constants.TIPS_TYPE_ERROR)
+ PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
+ PublicFunc.finish_operation(self, ButtonState)
+ return
+ else:
+ PublicFunc.text_output(self.ui, "(3/7)" + result.info, Constants.TIPS_TYPE_INFO)
# 数据预处理
- PublicFunc.progressbar_update(self, 3, 6, Constants.PREPROCESSING_DATA, 30)
+ PublicFunc.progressbar_update(self, 4, 7, Constants.PREPROCESSING_DATA, 30)
result = self.data.preprocess()
if not result.status:
- PublicFunc.text_output(self.ui, "(3/6)" + result.info, Constants.TIPS_TYPE_ERROR)
+ PublicFunc.text_output(self.ui, "(4/7)" + result.info, Constants.TIPS_TYPE_ERROR)
PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
PublicFunc.finish_operation(self, ButtonState)
return
else:
- PublicFunc.text_output(self.ui, "(3/6)" + result.info, Constants.TIPS_TYPE_INFO)
+ PublicFunc.text_output(self.ui, "(4/7)" + result.info, Constants.TIPS_TYPE_INFO)
# 更新表格
- PublicFunc.progressbar_update(self, 4, 6, Constants.UPDATING_TABLEWIDGET_AND_INFO, 50)
+ PublicFunc.progressbar_update(self, 5, 7, Constants.UPDATING_TABLEWIDGET_AND_INFO, 50)
result = self.__update_tableWidget_and_info__()
if not result.status:
- PublicFunc.text_output(self.ui, "(4/6)" + result.info, Constants.TIPS_TYPE_ERROR)
+ PublicFunc.text_output(self.ui, "(5/7)" + result.info, Constants.TIPS_TYPE_ERROR)
PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
PublicFunc.finish_operation(self, ButtonState)
return
else:
- PublicFunc.text_output(self.ui, "(4/6)" + result.info, Constants.TIPS_TYPE_INFO)
+ PublicFunc.text_output(self.ui, "(5/7)" + result.info, Constants.TIPS_TYPE_INFO)
# 绘图
- PublicFunc.progressbar_update(self, 5, 6, Constants.DRAWING_DATA, 60)
+ PublicFunc.progressbar_update(self, 6, 7, Constants.DRAWING_DATA, 60)
result = self.__plot__()
if not result.status:
- PublicFunc.text_output(self.ui, "(5/6)" + result.info, Constants.TIPS_TYPE_ERROR)
+ PublicFunc.text_output(self.ui, "(6/7)" + result.info, Constants.TIPS_TYPE_ERROR)
PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
PublicFunc.finish_operation(self, ButtonState)
return
else:
- PublicFunc.text_output(self.ui, "(5/6)" + result.info, Constants.TIPS_TYPE_INFO)
+ PublicFunc.text_output(self.ui, "(6/7)" + result.info, Constants.TIPS_TYPE_INFO)
# 绘点
- PublicFunc.progressbar_update(self, 6, 6, Constants.DRAWING_DATA, 80)
+ PublicFunc.progressbar_update(self, 7, 7, Constants.DRAWING_DATA, 80)
result = self.__plot_peaks__()
if not result.status:
- PublicFunc.text_output(self.ui, "(6/6)" + result.info, Constants.TIPS_TYPE_ERROR)
+ PublicFunc.text_output(self.ui, "(7/7)" + result.info, Constants.TIPS_TYPE_ERROR)
PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
PublicFunc.finish_operation(self, ButtonState)
return
else:
- PublicFunc.text_output(self.ui, "(6/6)" + result.info, Constants.TIPS_TYPE_INFO)
+ PublicFunc.text_output(self.ui, "(7/7)" + result.info, Constants.TIPS_TYPE_INFO)
self.__reset__()
self.canvas.mpl_connect("motion_notify_event", self.on_motion)
From 31a6160c972ab41aef3b854b8043e2fc25e132f1 Mon Sep 17 00:00:00 2001
From: Yorusora
Date: Fri, 30 May 2025 20:46:15 +0800
Subject: [PATCH 26/26] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86<=E5=91=BC?=
=?UTF-8?q?=E5=90=B8=E5=8F=AF=E7=94=A8=E6=80=A7=E5=8F=8A=E9=97=B4=E6=9C=9F?=
=?UTF-8?q?=E6=A0=87=E6=B3=A8>=E4=B8=AD=E7=BB=98=E5=9B=BE=E5=A4=B1?=
=?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
func/Module_resp_quality_label.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/func/Module_resp_quality_label.py b/func/Module_resp_quality_label.py
index 54c9577..5da029e 100644
--- a/func/Module_resp_quality_label.py
+++ b/func/Module_resp_quality_label.py
@@ -416,7 +416,7 @@ class MainWindow_resp_quality_label(QMainWindow):
mask = mask.astype(float64)
for i in artifact_type_seq:
mask[i] = self.data.artifact_mask[begin_OrgBCG:end_OrgBCG] == i
- mask[i] = (BDR[begin_OrgBCG:end_OrgBCG] * mask[i]).astype(float64)
+ mask[i] = (BDR * mask[i]).astype(float64)
place(mask[i], mask[i] == 0, nan)
self.ax0.plot(arange(begin_OrgBCG, end_OrgBCG), mask[i],
label=f"{Constants.RESP_QUALITY_LABEL_PLOT_LABEL_ARTIFACT}{i}", color=Constants.PLOT_COLOR_RED,