Merge branch 'master' into cxh_dev

# Conflicts:
#	func/Module_approximately_align.py
This commit is contained in:
marques
2025-06-02 20:24:11 +08:00
31 changed files with 6309 additions and 1437 deletions

View File

@ -2,23 +2,82 @@ from PySide6.QtGui import QIntValidator, QDoubleValidator
from matplotlib.ticker import FuncFormatter
class ConfigParams:
class Filename:
# 文件命名
PATH_ORGBCG_TEXT: str = "OrgBCG_Text"
PATH_PSG_TEXT: str = "PSG_Text"
PATH_ORGBCG_ALIGNED: str = "OrgBCG_Aligned"
PATH_PSG_ALIGNED: str = "PSG_Aligned"
PATH_ORGBCG_ORIGIN: str = "OrgBCG_Origin"
PATH_PSG_ORIGIN: str = "PSG_Origin"
PATH_LABEL: str = "Label"
PATH_REVEIVE_ORIGIN: str = "Receive_Origin"
PATH_REPORT: str = "Report"
PATH_SAMPID: str = "<sampID>"
SUFFIX_FREQ: str = "采样率"
# Folder: OrgBCG_Text
ORGBCG_RAW: str = "OrgBCG_Raw_"
BCG_FILTER: str = "BCG_Filter_"
JPEAK_REVISE: str = "Jpeak_revise_"
JPEAK_REVISE_CORRECTED: str = "Jpeak_revise_corrected_"
# Folder: PSG_Text
ECG_RAW: str = "ECG II_Raw_"
THO_RAW: str = "Effort Tho_Raw_"
ABD_RAW: str = "Effort Abd_Raw_"
FLOWT_RAW: str = "Flow T_Raw_"
FLOWP_RAW: str = "Flow P_Raw_"
SNORE_RAW: str = "Snore_Raw_"
SPO2_RAW: str = "SpO2_Raw_"
FIVE_CLASS_RAW: str = "5_class_Raw_"
STARTTIME_RAW: str = "StartTime_Raw"
SA_LABEL_RAW: str = "SA Label_Raw"
ECG_FILTER: str = "ECG_Filter_"
RPEAK_FINAL: str = "Rpeak_final_"
RPEAK_FINAL_CORRECTED: str = "Rpeak_final_corrected_"
# Folder: OrgBCG_Aligned
ORGBCG_SYNC: str = "OrgBCG_Sync_"
BCG_SYNC: str = "BCG_Sync_"
# Folder: PSG_Aligned
ECG_SYNC: str = "ECG_Sync_"
THO_SYNC: str = "Effort Tho_Sync_"
ABD_SYNC: str = "Effort Abd_Sync_"
FLOWT_SYNC: str = "Flow T_Sync_"
FLOWP_SYNC: str = "Flow P_Sync_"
SNORE_SYNC: str = "Snore_Sync_"
SPO2_SYNC: str = "SpO2_Sync_"
FIVE_CLASS_SYNC: str = "5_class_Sync_"
SA_LABEL_SYNC: str = "SA Label_Sync"
JPEAK_SYNC: str = "Jpeak_Sync_"
RPEAK_SYNC: str = "Rpeak_Sync_"
# Folder: Label
APPROXIMATELY_ALIGN_INFO: str = "Approximately_Align_Info"
PRECISELY_ALIGN_INFO: str = "Precisely_Align_Info"
ARTIFACT_A: str = "Artifact_a_"
ARTIFACT_B: str = "Artifact_b_"
ARTIFACT_C: str = "Artifact_c_"
SA_LABEL_CORRECTED: str = "SA Label_corrected"
SA_LABEL_ADD: str = "SA Label_add"
RESP_QUALITY_LABEL: str = "Resp_quality_label"
THO_PEAK: str = "Tho_peak_"
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_PATH_ORGBCG_TEXT: str = "OrgBCG_Text"
PUBLIC_PATH_PSG_TEXT: str = "PSG_Text"
PUBLIC_PATH_ORGBCG_ALIGNED: str = "OrgBCG_Aligned"
PUBLIC_PATH_PSG_ALIGNED: str = "PSG_Aligned"
PUBLIC_PATH_LABEL: str = "Label"
PUBLIC_CONFIG_NEW_CONTENT = {
"Path": {
"Root": ""
}
}
UTF8_ENCODING: str = "utf-8"
# 目前用到这个编码的地方:
# <BCG的质量评估打标>里的保存和读取csv文件的地方注意的是读取原始数据时依然使用UTF-8
GBK_ENCODING: str = "gbk"
ENDSWITH_TXT: str = ".txt"
ENDSWITH_CSV: str = ".csv"
@ -30,45 +89,6 @@ class ConfigParams:
VALIDATOR_INTEGER = QIntValidator(-2**31, 2**31 - 1)
VALIDATOR_DOUBLE = QDoubleValidator(-1e100, 1e100, 10)
# 文件命名
ORGBCG_RAW: str = "OrgBCG_Raw_"
ECG_RAW: str = "ECG II_Raw_"
THO_RAW: str = "Effort Tho_Raw_"
ABD_RAW: str = "Effort Abd_Raw_"
FLOWT_RAW: str = "Flow T_Raw_"
FLOWP_RAW: str = "Flow P_Raw_"
SNORE_RAW: str = "Snore_Raw_"
SPO2_RAW: str = "SpO2_Raw_"
FIVE_CLASS_RAW: str = "5_class_Raw_"
STARTTIME_RAW: str = "StartTime_Raw_"
SA_LABEL_RAW: str = "SA Label_Raw_"
BCG_FILTER: str = "BCG_Filter_"
ECG_FILTER: str = "ECG_Filter_"
JPEAK_REVISE: str = "Jpeak_revise_"
RPEAK_FINAL: str = "Rpeak_final_"
JPEAK_REVISE_CORRECTED: str = "Jpeak_revise_corrected_"
RPEAK_FINAL_CORRECTED: str = "Rpeak_final_corrected_"
APPROXIMATELY_ALIGN_INFO: str = "Approximately_Align_Info"
PRECISELY_ALIGN_INFO: str = "Precisely_Align_Info"
ARTIFACT_A: str = "Artifact_a"
ARTIFACT_B: str = "Artifact_b"
ARTIFACT_C: str = "Artifact_c"
BCG_SYNC: str = "BCG_Sync_"
ECG_SYNC: str = "ECG_Sync_"
JPEAK_SYNC: str = "Jpeak_Sync_"
RPEAK_SYNC: str = "Rpeak_Sync_"
ORGBCG_SYNC: str = "OrgBCG_Sync_"
THO_SYNC: str = "Effort Tho_Sync_"
ABD_SYNC: str = "Effort Abd_Sync_"
FLOWT_SYNC: str = "Flow T_Sync_"
FLOWP_SYNC: str = "Flow P_Sync_"
SNORE_SYNC: str = "Snore_Sync_"
SPO2_SYNC: str = "SpO2_Sync_"
FIVE_CLASS_SYNC: str = "5_class_Sync_"
SA_LABEL_SYNC: str = "SA Label_Sync"
SA_LABEL_CORRECTED: str = "SA Label_corrected"
SA_LABEL_ADD: str = "SA Label_add"
# 数据粗同步
APPROXIMATELY_ALIGN_CONFIG_FILE_PATH: str = "./config/Config_approximately_align.yaml"
APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT: dict = {
@ -195,29 +215,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,
@ -251,6 +271,44 @@ class ConfigParams:
ARTIFACT_LABEL_LABEL_TRANSPARENCY: float = 0.3
ARTIFACT_LABEL_ACTION_LABEL_ARTIFACT_SHORTCUT_KEY: str = "Z"
# BCG的质量标注
BCG_QUALITY_LABEL_CONFIG_FILE_PATH: str = "./config/Config_bcg_quality_label.yaml"
BCG_QUALITY_LABEL_CONFIG_NEW_CONTENT: dict = {
"InputConfig": {
"BCGFreq": 1000,
"UseFreq": 1000
}
}
BCG_QUALITY_LABEL_BTN_PREV_SHORTCUT_KEY: str = "A"
BCG_QUALITY_LABEL_BTN_NEXT_SHORTCUT_KEY: str = "D"
# 呼吸可用性及间期标注
RESP_QUALITY_LABEL_CONFIG_FILE_PATH: str = "./config/Config_resp_quality_label.yaml"
RESP_QUALITY_LABEL_CONFIG_NEW_CONTENT: dict = {
"InputConfig": {
"OrgBCGFreq": 1000,
"ThoFreq": 100,
"OrgBCGUseFreq": 1000,
"ThoUseFreq": 100
},
"Threshold": {
"Low": 0.65,
"High": 0.8
},
"FindPeaks" : {
"MinInterval": 300,
"MinHeight": 0.1
},
"Filter": {
"BandPassLow": 0.1,
"BandPassHigh": 1
}
}
RESP_QUALITY_LABEL_PREPROCESS_FC: int = 1
RESP_QUALITY_LABEL_PARTS_TIME_SEC: int = 30
RESP_QUALITY_LABEL_LABEL_TRANSPARENCY: float = 0.2
RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY: str = "Z"
# 睡眠呼吸暂停事件标注
SA_LABEL_CONFIG_FILE_PATH: str = "./config/Config_SA_label.yaml"
SA_LABEL_CONFIG_NEW_CONTENT: dict = {
@ -281,62 +339,10 @@ class ConfigParams:
SA_LABEL_RADIOBUTTON_2_CLASS_SHORTCUT_KEY: str = "I"
SA_LABEL_RADIOBUTTON_3_CLASS_SHORTCUT_KEY: str = "O"
# 质量打标
BCG_QUALITY_LABEL_INPUT_BCG_FILENAME: str = "BCG_sync_"
BCG_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME: str = "Artifact_a"
BCG_QUALITY_LABEL_SAVE_FILENAME: str = "SQ_label_"
BCG_QUALITY_LABEL_INPUT_DEFAULT_FS: int = 1000
BCG_QUALITY_LABEL_SAVE_MODE_10S: str = "10s"
BCG_QUALITY_LABEL_SAVE_MODE_30S: str = "30s"
BCG_QUALITY_LABEL_MODE_10S_LENGTH = 10 * BCG_QUALITY_LABEL_INPUT_DEFAULT_FS
BCG_QUALITY_LABEL_MODE_30S_LENGTH = 30 * BCG_QUALITY_LABEL_INPUT_DEFAULT_FS
# 呼吸可用性及间期标注
RESP_QUALITY_LABEL_INPUT_XINXIAO_FILENAME: str = "orgBcg_sync_"
RESP_QUALITY_LABEL_INPUT_THO_FILENAME: str = "Effort_Tho_sync_"
RESP_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME: str = "Artifact_a"
RESP_QUALITY_LABEL_SAVE_RESP_QUALITY_LABNEL_FILENAME: str = "Resp_quality_label"
RESP_QUALITY_LABEL_SAVE_THO_PEAK_FILENAME: str = "Tho_peak"
RESP_QUALITY_LABEL_INPUT_XINXIAO_DEFAULT_FS: int = 1000
RESP_QUALITY_LABEL_INPUT_THO_DEFAULT_FS: int = 200
RESP_QUALITY_LABEL_PARTS_TIME_SEC: int = 30
RESP_QUALITY_LABEL_PREPROCESS_FC: int = 1
RESP_QUALITY_LABEL_THRESHOLD1_DEFAULT: float = 0.65
RESP_QUALITY_LABEL_THRESHOLD2_DEFAULT: float = 0.8
RESP_QUALITY_LABEL_FINDPEAKS_MIN_INTERVAL_DEFAULT: int = 300
RESP_QUALITY_LABEL_FINDPEAKS_MIN_HEIGHT_DEFAULT: float = 0.1
RESP_QUALITY_LABEL_CUSTOM_LOW_DEFAULT: float = 0.1
RESP_QUALITY_LABEL_CUSTOM_HIGH_DEFAULT: float = 1
RESP_QUALITY_LABEL_LABEL_TRANSPARENCY: float = 0.2
RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY: str = "Z"
# 睡眠呼吸暂停事件打标
# 禁止实例化
def __new__(cls):
raise TypeError("Constants class cannot be instantiated")
# 禁止修改常量
@classmethod
def __setattr__(cls, key, value):

View File

@ -1,4 +1,4 @@
from func.utils.ConfigParams import ConfigParams
from func.utils.ConfigParams import Params
class Constants:
@ -94,16 +94,18 @@ class Constants:
"Path_Not_Exist": "(路径不存在)",
"File_Not_Exist": "(数据文件不存在)",
"File_More_Than_One": "(数据文件超过一个)",
"Data_Frequency_Not_In_Filename": "(无法找到文件名中的数据频率信息)",
"Suffix_Not_Correct": "(文件扩展名不正确)",
"Frequency_Not_In_Filename": "(数据频率不在文件名中)",
"Data_Not_Exist": "(数据不存在)",
"Model_File_Not_Exist": "(模型文件不存在)",
"Model_Path_Not_Exist": "(模型文件不存在)",
"Cut_Data_Length_not_Correct": "(切割数据时长度不正确)",
"Align_Label_SALabel_Format_not_Correct": "映射标签时SA Label中的文件格式不正确",
"Filename_Format_not_Correct": "(文件名格式不正确)",
"Method_Not_Exist": "(检测方法不存在)",
"Data_Length_not_Correct": "orgBcg和BCG长度不匹配",
"Artifact_Format_Not_Correct": "(体动长度或格式不正确)",
"Get_Artifact_Format_Exception": "获取体动长度或格式异常",
"Data_Length_Not_Correct": "信号长度不正确",
"Open_Data_Exception": "(打开数据异常)",
"Process_Exception": "(处理异常)",
@ -132,7 +134,9 @@ class Constants:
"Get_File_and_Freq_Excepetion": "(检查文件是否存在并获取其数据采样率异常)",
"Update_tableWidget_Exception": "(更新表格异常)",
"Update_Info_Exception": "(更新信息异常)",
"Get_Artifact_Format_Exception": "(获取体动长度或格式异常)",
"Label_Format_Exception": "(获取标签格式异常)",
"Calculate_Peak_Exception": "(计算峰值异常)",
"res_orgBcg_Not_Exist": "切割后orgBcg不存在",
"res_BCG_Not_Exist": "切割后BCG不存在",
@ -240,7 +244,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 +300,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 = "正在获取文件及其采样率"
@ -324,11 +328,17 @@ 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"标注体动({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 {
@ -381,6 +391,93 @@ class Constants:
background-color: #00ff00; /* 鼠标悬停时的背景颜色 */
}"""
# BCG的质量标注
BCG_QUALITY_LABEL_COLUMN_LABEL: str = "label"
BCG_QUALITY_LABEL_COLUMN_REMARK: str = "remark"
BCG_QUALITY_LABEL_PLOT_LABEL_SIGNAL: str = "BCG"
BCG_QUALITY_LABEL_PLOT_LABEL_ARTIFACT: str = "Artifact"
BCG_QUALITY_LABEL_PLOT_LABEL_LONGEST_CONTINUOUS: str = "Longest_Continuous"
BCG_QUALITY_LABEL_10S_A: str = "a1"
BCG_QUALITY_LABEL_10S_B: str = "b1"
BCG_QUALITY_LABEL_10S_C: str = "c1"
BCG_QUALITY_LABEL_30S_A1: str = "a1"
BCG_QUALITY_LABEL_30S_A2: str = "a2"
BCG_QUALITY_LABEL_30S_B1: str = "b1"
BCG_QUALITY_LABEL_30S_B2: str = "b2"
BCG_QUALITY_LABEL_30S_C: str = "c1"
BCG_QUALITY_LABEL_TOBELABELED: str = "f1"
BCG_QUALITY_LABEL_VIEWING_THE_FIRST_PART: str = "你正在查看第1段信号"
BCG_QUALITY_LABEL_VIEWING_THE_LAST_PART: str = "你正在查看最后1段信号"
BCG_QUALITY_LABEL_VIEWING_THE_FIRST_PART_UNLABELED: str = "前面的片段都被打标将跳转至第1段信号"
BCG_QUALITY_LABEL_VIEWING_THE_LAST_PART_UNLABELED: str = "后面的片段都被打标将跳转至最后1段信号"
BCG_QUALITY_LABEL_LABELED_FINISHED: str = "该份数据打标已全部完成"
BCG_QUALITY_LABEL_VIEWING_PART: str = "正在查看信号段"
BCG_QUALITY_LABEL_JUMP_PART: str = "跳转到片段"
BCG_QUALITY_LABEL_LABEL_ALL_TO_TYPE_C_QUESTION_CONTENT: str = "你确定要将所有片段标记为类型C"
BCG_QUALITY_LABEL_LABEL_ARTIFACT_TO_TYPE_C_QUESTION_CONTENT: str = "你确定要将所有带有体动的片段标记为类型C"
BCG_QUALITY_LABEL_LABELBTN_STYLE: str = """
QPushButton {
background-color: orange; /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: yellow; /* 鼠标悬停时的背景颜色 */
}"""
# 呼吸可用性及间期标注
RESP_QUALITY_LABEL_CALCULATING_PEAK: str = "正在计算峰值"
RESP_QUALITY_LABEL_CALCULATE_FINISHED: str = "计算完成"
RESP_QUALITY_LABEL_CALCULATE_FAILURE: str = "计算失败"
RESP_QUALITY_LABEL_PLOT_LABEL_ORGBCG: str = "BDR_Sync by filter OrgBCG_Sync"
RESP_QUALITY_LABEL_PLOT_LABEL_THO: str = "THO_Sync after preprocess"
RESP_QUALITY_LABEL_PLOT_LABEL_THO_PEAKS: str = "Tho_peak"
RESP_QUALITY_LABEL_PLOT_LABEL_ARTIFACT: str = "Artifact"
RESP_QUALITY_LABEL_SPECTRUM_BDR_TITLE: str = "Spectrum of BDR_sync by filter OrgBCG_Sync"
RESP_QUALITY_LABEL_SPECTRUM_THO_TITLE: str = "Spectrum of THO_sync after preprocess"
RESP_QUALITY_LABEL_SPECTRUM_ORGBCG_LABEL: str = "OrgBCG"
RESP_QUALITY_LABEL_SPECTRUM_BDR_LABEL: str = "BDR"
RESP_QUALITY_LABEL_SPECTRUM_THO_LABEL: str = "Tho"
RESP_QUALITY_LABEL_VIEWING_THE_FIRST_PART: str = "你正在查看第1段信号"
RESP_QUALITY_LABEL_VIEWING_THE_LAST_PART: str = "你正在查看最后1段信号"
RESP_QUALITY_LABEL_PREV_PART: str = "上一个片段index "
RESP_QUALITY_LABEL_NEXT_PART: str = "下一个片段index "
RESP_QUALITY_LABEL_JUMP: str = "跳转到片段index "
RESP_QUALITY_LABEL_LABEL_SUCCESSFULLY: str = "片段标注成功"
RESP_QUALITY_LABEL_LABEL_TYPE: str = "标注类型为:"
RESP_QUALITY_LABEL_ADD_POINTS_SUCCESSFULLY: str = "成功新增点,横坐标:"
RESP_QUALITY_LABEL_REMOVE_POINTS_SUCCESSFULLY: str = "成功删除点,横坐标:"
RESP_QUALITY_LABEL_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无新增或删除点"
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"批量更改标签({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
RESP_QUALITY_LABEL_KEY_VALUE = {
1: "Good",
0: "Bad",
-1: "None"
}
RESP_QUALITY_LABEL_FIGTOOLBAR_SPECTRUM_STYLESHEET: str = """
QToolBar {
border: 1px;
spacing: 2px; /* 设置工具栏按钮之间的间距 */
}
QToolButton {
height: 20px; /* 设置工具栏按钮的高度 */
width: 20px; /* 设置工具栏按钮的宽度 */
font-size: 8px; /* 设置按钮文字大小 */
}
QToolButton::menu-button {
width: 0px; /* 隐藏下拉菜单按钮 */
}
"""
# 睡眠呼吸暂停事件标注
SA_LABEL_JUMP: str = "跳转到事件"
SA_LABEL_VIEWING_FIRST: str = "你正在查看第1个事件"
@ -398,133 +495,6 @@ class Constants:
SA_LABEL_LENGTH_LESS_THEN_10S: str = "当前标注的事件的持续时间小于10秒"
SA_LABEL_WRONG_ARGS: str = "起始时间和终止时间输入错误"
# 质量打标
BCG_QUALITY_LABEL_FILES_NOT_FOUND: str = f"无法找到{ConfigParams.BCG_QUALITY_LABEL_INPUT_BCG_FILENAME}{ConfigParams.ENDSWITH_TXT}{ConfigParams.BCG_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME}{ConfigParams.ENDSWITH_TXT},无法执行<BCG的质量标注>"
BCG_QUALITY_LABEL_FILES_FOUND: str = f"找到{ConfigParams.BCG_QUALITY_LABEL_INPUT_BCG_FILENAME}{ConfigParams.ENDSWITH_TXT}{ConfigParams.BCG_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME}{ConfigParams.ENDSWITH_TXT}"
BCG_QUALITY_LABEL_HISTORICAL_SAVE_FOUND: str = f"找到历史存档文件{ConfigParams.BCG_QUALITY_LABEL_SAVE_FILENAME}{ConfigParams.BCG_QUALITY_LABEL_SAVE_MODE_10S}{ConfigParams.ENDSWITH_CSV}{ConfigParams.BCG_QUALITY_LABEL_SAVE_FILENAME}{ConfigParams.BCG_QUALITY_LABEL_SAVE_MODE_30S}{ConfigParams.ENDSWITH_CSV},已成功读取"
BCG_QUALITY_LABEL_MODE_UNSELECTED: str = "显示模式未选择"
BCG_QUALITY_LABEL_INPUT_SIGNAL_FAILURE: str = "导入信号失败,请检查信号长度"
BCG_QUALITY_LABEL_INPUT_ARTIFACT_FAILURE_FORMAT: str = "导入体动失败,请检查体动标签格式"
BCG_QUALITY_LABEL_INPUT_ARTIFACT_FAILURE_LENGTH: str = "导入体动失败请检查体动长度是否为4的倍数"
BCG_QUALITY_LABEL_RUNNING: str = "开始执行任务<BCG的质量评估标注>"
BCG_QUALITY_LABEL_10S_MODE: str = f"{ConfigParams.BCG_QUALITY_LABEL_SAVE_MODE_10S}_MODE"
BCG_QUALITY_LABEL_30S_MODE: str = f"{ConfigParams.BCG_QUALITY_LABEL_SAVE_MODE_30S}_MODE"
BCG_QUALITY_LABEL_COLUMN_LABEL: str = "label"
BCG_QUALITY_LABEL_COLUMN_REMARK: str = "remark"
BCG_QUALITY_LABEL_VIEWING_THE_FIRST_PART: str = "你正在查看第1段信号"
BCG_QUALITY_LABEL_VIEWING_THE_LAST_PART: str = "你正在查看最后1段信号"
BCG_QUALITY_LABEL_VIEWING_THE_FIRST_PART_UNLABELED: str = "前面的片段都被打标将跳转至第1段信号"
BCG_QUALITY_LABEL_VIEWING_THE_LAST_PART_UNLABELED: str = "后面的片段都被打标将跳转至最后1段信号"
BCG_QUALITY_LABEL_LABELED_FINISHED: str = "该份数据打标已全部完成"
BCG_QUALITY_LABEL_VIEWING_PART: str = "正在查看信号段"
BCG_QUALITY_LABEL_JUMP_PART: str = "跳转到片段"
BCG_QUALITY_LABEL_CLICKED_CHECKBOX_HIGHLIGHT_LONGEST_CONTINUOUS: str = "点击了<高亮最长连续>"
BCG_QUALITY_LABEL_CLICKED_CHECKBOX_DISPLAY_AFTERFILTER: str = "点击了<去除工频噪声>"
BCG_QUALITY_LABEL_CLICKED_CHECKBOX_EXAMINE_TOBOLABELED: str = "点击了<仅查未标片段>"
BCG_QUALITY_LABEL_LABEL_ALL_TO_TYPE_C_QUESTION_CONTENT: str = "你确定要将所有片段标记为类型C"
BCG_QUALITY_LABEL_LABEL_ALL_TO_TYPE_C: str = "已将所有片段标记为类型C"
BCG_QUALITY_LABEL_LABEL_ARTIFACT_TO_TYPE_C_QUESTION_CONTENT: str = "你确定要将所有带有体动的片段标记为类型C"
BCG_QUALITY_LABEL_LABEL_ARTIFACT_TO_TYPE_C: str = "已将所有带有体动的片段标记为类型C"
BCG_QUALITY_LABEL_PLOT_LABEL_SIGNAL: str = "BCG"
BCG_QUALITY_LABEL_PLOT_LABEL_ARTIFACT: str = "Artifact"
BCG_QUALITY_LABEL_PLOT_LABEL_LONGEST_CONTINUOUS: str = "Longest_Continuous"
BCG_QUALITY_LABEL_10S_A: str = "a"
BCG_QUALITY_LABEL_10S_B: str = "b"
BCG_QUALITY_LABEL_10S_C: str = "c"
BCG_QUALITY_LABEL_10S_A_LIST: str = "label_a"
BCG_QUALITY_LABEL_10S_B_LIST: str = "label_b"
BCG_QUALITY_LABEL_10S_C_LIST: str = "label_c"
BCG_QUALITY_LABEL_30S_A1: str = "a"
BCG_QUALITY_LABEL_30S_A2: str = "b"
BCG_QUALITY_LABEL_30S_B1: str = "c"
BCG_QUALITY_LABEL_30S_B2: str = "d"
BCG_QUALITY_LABEL_30S_C: str = "e"
BCG_QUALITY_LABEL_30S_A1_LIST: str = "label_a1"
BCG_QUALITY_LABEL_30S_A2_LIST: str = "label_a2"
BCG_QUALITY_LABEL_30S_B1_LIST: str = "label_b1"
BCG_QUALITY_LABEL_30S_B2_LIST: str = "label_b2"
BCG_QUALITY_LABEL_30S_C_LIST: str = "label_c"
BCG_QUALITY_LABEL_tobeLabeled: str = "f"
BCG_QUALITY_LABEL_tobeLabeled_LIST: str = "label_tobeLabeled"
BCG_QUALITY_LABEL_LABELBTN_STYLE: str = """
QPushButton {
background-color: orange; /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: yellow; /* 鼠标悬停时的背景颜色 */
}"""
# 呼吸可用性及间期标注
RESP_QUALITY_LABEL_FILES_NOT_FOUND: str = f"无法找到{ConfigParams.RESP_QUALITY_LABEL_INPUT_XINXIAO_FILENAME}{ConfigParams.ENDSWITH_TXT}{ConfigParams.RESP_QUALITY_LABEL_INPUT_THO_FILENAME}{ConfigParams.ENDSWITH_TXT}{ConfigParams.RESP_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME}{ConfigParams.ENDSWITH_TXT},无法执行<呼吸可用性及间期标注>"
RESP_QUALITY_LABEL_FILES_FOUND: str = f"找到{ConfigParams.RESP_QUALITY_LABEL_INPUT_XINXIAO_FILENAME}{ConfigParams.ENDSWITH_TXT}{ConfigParams.RESP_QUALITY_LABEL_INPUT_THO_FILENAME}{ConfigParams.ENDSWITH_TXT}{ConfigParams.RESP_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME}{ConfigParams.ENDSWITH_TXT}"
RESP_QUALITY_LABEL_HISTORICAL_SAVE1_FOUND: str = f"找到历史存档文件{ConfigParams.RESP_QUALITY_LABEL_SAVE_RESP_QUALITY_LABNEL_FILENAME}{ConfigParams.ENDSWITH_TXT},已成功读取"
RESP_QUALITY_LABEL_HISTORICAL_SAVE2_FOUND: str = f"找到历史存档文件{ConfigParams.RESP_QUALITY_LABEL_SAVE_THO_PEAK_FILENAME}{ConfigParams.ENDSWITH_TXT},已成功读取"
RESP_QUALITY_LABEL_INPUT_SIGNAL_FAILURE: str = "导入信号失败,请检查信号长度"
RESP_QUALITY_LABEL_INPUT_SUCCESSFULLY: str = "导入数据成功"
RESP_QUALITY_LABEL_PREPROCESS_SUCCESSFULLY: str = "导入数据成功"
RESP_QUALITY_LABEL_INPUT_ARTIFACT_FAILURE_FORMAT: str = "导入体动失败,请检查体动标签格式"
RESP_QUALITY_LABEL_INPUT_ARTIFACT_FAILURE_LENGTH: str = "导入体动失败请检查体动长度是否为4的倍数"
RESP_QUALITY_LABEL_RUNNING: str = "开始执行任务<呼吸可用性及间期标注>"
RESP_QUALITY_LABEL_PLOT_LABEL_ORGBCG: str = "BDR_sync by filter orgBcg_sync"
RESP_QUALITY_LABEL_PLOT_LABEL_THO: str = "THO_sync after preprocess"
RESP_QUALITY_LABEL_PLOT_LABEL_THO_PEAKS: str = "THO_peak"
RESP_QUALITY_LABEL_PLOT_LABEL_ARTIFACT: str = "Artifact"
RESP_QUALITY_LABEL_VIEWING_THE_FIRST_PART: str = "你正在查看第1段信号"
RESP_QUALITY_LABEL_VIEWING_THE_LAST_PART: str = "你正在查看最后1段信号"
RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_NAME: str = f"批量更改标签({ConfigParams.RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY})"
RESP_QUALITY_LABEL_CUSTOM_NAVIGATIONTOOLBAR_WIDGET_NAME: str = "MainWindow"
RESP_QUALITY_LABEL_BUTTON_PRESS_EVENT: str = "button_press_event"
RESP_QUALITY_LABEL_BUTTON_RELEASE_EVENT: str = "button_release_event"
RESP_QUALITY_LABEL_MOTION_NOTIFY_EVENT: str = "motion_notify_event"
RESP_QUALITY_LABEL_ADD_POINTS_SUCCESSFULLY: str = "成功新增点,横坐标:"
RESP_QUALITY_LABEL_REMOVE_POINTS_SUCCESSFULLY: str = "成功删除点,横坐标:"
RESP_QUALITY_LABEL_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无新增或删除点"
RESP_QUALITY_LABEL_SAVE_PEAKS_SUCCESSFULLY: str = "保存峰值成功"
RESP_QUALITY_LABEL_DATA_NOT_FOUND: str = "数据未导入"
RESP_QUALITY_LABEL_LABEL_SUCCESSFULLY: str = "片段标注并保存成功"
RESP_QUALITY_LABEL_RESET_SUCCESSFULLY: str = "片段重置并保存成功"
RESP_QUALITY_LABEL_PLOT_LABEL_VLINE: str = "vline"
RESP_QUALITY_LABEL_PLOT_LABEL_HLINE: str = "hline"
RESP_QUALITY_LABEL_A_QUALITY: int = 1
RESP_QUALITY_LABEL_B_QUALITY: int = 0
RESP_QUALITY_LABEL_C_QUALITY: int = -1
RESP_QUALITY_LABEL_LABELED: str = "已标注"
RESP_QUALITY_LABEL_TOBELABELED: str = "未标注"
RESP_QUALITY_LABEL_SPECTRUM_BDR_TITLE: str = "Spectrum of BDR_sync by filter orgBcg_sync"
RESP_QUALITY_LABEL_SPECTRUM_THO_TITLE: str = "Spectrum of THO_sync after preprocess"
RESP_QUALITY_LABEL_SPECTRUM_ORGBCG_LABEL: str = "orgBcg"
RESP_QUALITY_LABEL_SPECTRUM_BDR_LABEL: str = "BDR"
RESP_QUALITY_LABEL_SPECTRUM_THO_LABEL: str = "THO"
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_KEY_VALUE = {
1: "Good",
0: "Bad",
-1: "None"
}
# 禁止实例化
def __new__(cls):
raise TypeError("Constants class cannot be instantiated")

View File

@ -177,7 +177,7 @@ class PublicFunc:
QApplication.processEvents()
@staticmethod
def examine_file(path_str, filename):
def examine_file(path_str, filename, suffix):
temp_path = list(
Path(path_str).glob(f"{filename}*"))
if len(temp_path) == 0:
@ -201,8 +201,24 @@ class PublicFunc:
info=Constants.INPUT_FAILURE + "\n" +
filename + "" +
Constants.FAILURE_REASON["Data_Frequency_Not_In_Filename"])
if Path(path).suffix != suffix:
return Result().failure(
info=Constants.INPUT_FAILURE + "\n" +
filename + "" +
Constants.FAILURE_REASON["Suffix_Not_Correct"])
data = {
"path": str(path),
"freq": int(freq)
}
return Result().success(data=data)
return Result().success(data=data)
@staticmethod
def examine_artifact(artifact):
# 检查体动标签正确性,长度
if len(artifact) % 4 != 0:
return Result().failure(info=Constants.INPUT_FAILURE +
Constants.FAILURE_REASON["Artifact_Format_Not_Correct"])
for i in range(0, len(artifact), 4):
unit_data = artifact[i:i + 4]
if len(unit_data) < 4:
break