Compare commits

...

16 Commits

Author SHA1 Message Date
2da21a8733 Merge branch 'master' into cxh_dev 2025-06-16 18:42:43 +08:00
4ef5463b1a 修复了<数据精同步>中切割索引可能存在负值的问题 2025-06-14 19:32:09 +08:00
bf0c780f01 优化了<数据精同步>的部分代码结构 2025-06-13 23:11:06 +08:00
170926ddd0 优化了部分代码结构 2025-06-11 23:35:13 +08:00
647509cf4a 优化了部分代码结构 2025-06-11 23:34:12 +08:00
cc7e246d65 优化了部分代码结构 2025-06-11 23:33:09 +08:00
8010d7c250 优化了部分代码结构;
修改了复选框的样式
2025-06-11 11:09:48 +08:00
30b041d945 Merge branch 'master' into cxh_dev 2025-06-11 10:12:23 +08:00
3c60f769ca 修复了导入设置窗口活动的情况下,关闭模块窗口或点击了开始导入后,导入设置未同时关闭的问题 2025-06-11 08:37:24 +08:00
07223f222b 新增了手动切换深浅色模式的功能 2025-06-11 00:28:59 +08:00
8d3408aac3 修复了<睡眠呼吸暂停事件标注>中逐帧检查模式下复原按钮功能异常的问题 2025-06-10 22:16:18 +08:00
fede37f5c5 Merge remote-tracking branch 'origin/master' 2025-06-10 22:07:37 +08:00
34e52e25aa 修复了<数据精对齐>中相关对齐步骤选取峰值后点击重新选取却未能重置选取的峰值的问题 2025-06-10 22:07:22 +08:00
09efee5635 纠正了部分界面的信号名称规范 2025-06-10 19:50:51 +08:00
15bccb2da1 优化了所有按钮的点击体验 2025-06-10 19:45:08 +08:00
af1a0ec531 软件界面适配深色模式
修改了<体动标注>中按钮的颜色显示规则
2025-06-10 17:43:36 +08:00
22 changed files with 522 additions and 240 deletions

View File

@ -322,6 +322,9 @@ class MainWindow_SA_label(QMainWindow):
self.figToolbar = None
self.gs = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
# 设定事件和其对应颜色
# event_code color event
# 0 黑色 背景
@ -479,6 +482,7 @@ class MainWindow_SA_label(QMainWindow):
self.ax6.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -498,19 +502,12 @@ class MainWindow_SA_label(QMainWindow):
sender = self.sender()
if sender == self.ui.pushButton_input:
try:
self.draw_one_event()
self.canvas.draw()
except Exception as e:
return Result().failure(info=Constants.DRAW_FAILURE + "\n" + format_exc())
elif sender == self.ui.tableWidget_label or sender == self.ui.tableWidget_label_add:
try:
self.draw_one_event()
self.canvas.draw()
except Exception as e:
return Result().failure(info=Constants.DRAW_FAILURE + "\n" + format_exc())
elif sender == self.ui.pushButton_prev or sender == self.ui.pushButton_next:
if (sender == self.ui.pushButton_input or
sender == self.ui.tableWidget_label or
sender == self.ui.tableWidget_label_add or
sender == self.ui.pushButton_prev or
sender == self.ui.pushButton_next or
sender == self.figToolbar.action_Reset_Signal_and_Time):
try:
self.draw_one_event()
self.canvas.draw()
@ -529,8 +526,6 @@ class MainWindow_SA_label(QMainWindow):
return Result().failure(info=Constants.DRAW_FAILURE + "\n" + format_exc())
return Result().success(info=Constants.DRAW_FINISHED)
def update_UI_Args(self):
try:
if self.data is not None and self.data.df_corrected is not None:
@ -628,11 +623,10 @@ class MainWindow_SA_label(QMainWindow):
if str(remark) != "" and str(remark) != "nan" and row.get("isLabeled", None) == 1:
for col in range(self.ui.tableWidget_label.columnCount()):
item = self.ui.tableWidget_label.item(index, col)
item.setBackground(QColor(255, 200, 200))
item.setBackground(QColor(255, 200, 200, 128))
else:
for col in range(self.ui.tableWidget_label.columnCount()):
item = self.ui.tableWidget_label.item(index, col)
item.setBackground(QColor(255, 255, 255))
if self.data.df_addNew is not None:
self.ui.tableWidget_label_add.setRowCount(len(self.data.df_addNew))
@ -675,11 +669,10 @@ class MainWindow_SA_label(QMainWindow):
if str(remark) != Constants.STRING_IS_EMPTY and str(remark) != Constants.STRING_IS_NAN and row.get("isLabeled", None) == 1:
for col in range(self.ui.tableWidget_label_add.columnCount()):
item = self.ui.tableWidget_label_add.item(index, col)
item.setBackground(QColor(255, 200, 200))
item.setBackground(QColor(255, 200, 200, 128))
else:
for col in range(self.ui.tableWidget_label_add.columnCount()):
item = self.ui.tableWidget_label_add.item(index, col)
item.setBackground(QColor(255, 255, 255))
except Exception as e:
return Result().failure(info=Constants.UPDATE_FAILURE +
Constants.FAILURE_REASON["Update_tableWidget_Exception"] + "\n" + format_exc())
@ -800,6 +793,7 @@ class MainWindow_SA_label(QMainWindow):
PublicFunc.msgbox_output(self, Constants.SA_LABEL_ALL_LABELED, Constants.MSGBOX_TYPE_INFO)
self.__reset__()
self.setting.close()
self.figToolbar.action_Reset_Signal_and_Time.setEnabled(True)
for action in self.figToolbar._actions.values():
action.setEnabled(True)
@ -1115,6 +1109,10 @@ class MainWindow_SA_label(QMainWindow):
PublicFunc.finish_operation(self, ButtonState)
def toggle_resetOriginalView(self):
if self.ui.checkBox_examineBySecond.isChecked():
self.__plot__()
self.update_UI_Args()
else:
self.figToolbar.home()
self.figToolbar.action_Reset_Signal_and_Time.setChecked(False)
self.ui.spinBox_correctStart.setValue(Config["BCG_SP"])

View File

@ -251,6 +251,9 @@ class MainWindow_approximately_align(QMainWindow):
self.fig = None
self.canvas = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -271,8 +274,6 @@ class MainWindow_approximately_align(QMainWindow):
PublicFunc.__resetAllButton__(self, ButtonState)
# self.ui.groupBox_align_position.setEnabled(False)
self.ui.pushButton_input.clicked.connect(self.__slot_btn_input__)
self.ui.pushButton_input_setting.clicked.connect(self.setting.show)
self.ui.pushButton_Standardize.clicked.connect(self.__slot_btn_Standardize__)
@ -295,7 +296,6 @@ class MainWindow_approximately_align(QMainWindow):
self.ui.radioButton_freqTHO.clicked.connect(self.__EstimateFrequencySelect__)
self.ui.radioButton_freqABD.clicked.connect(self.__EstimateFrequencySelect__)
@overrides
def closeEvent(self, event):
reply = QMessageBox.question(self, '确认', '确认退出吗?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
@ -306,6 +306,7 @@ class MainWindow_approximately_align(QMainWindow):
QApplication.processEvents()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -418,6 +419,7 @@ class MainWindow_approximately_align(QMainWindow):
self.ui.label_orgBcg_length.setText(str(orgBcg_seconds))
self.ui.label_PSG_length.setText(str(PSG_seconds))
self.__reset__()
self.setting.close()
PublicFunc.finish_operation(self, ButtonState)
def __slot_btn_save__(self):

View File

@ -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, sum as np_sum, nonzero
from numpy import array
from numpy.fft import fft, fftfreq
from overrides import overrides
from pandas import read_csv, DataFrame, concat
@ -228,6 +228,9 @@ class MainWindow_artifact_label(QMainWindow):
}
})
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -265,6 +268,8 @@ class MainWindow_artifact_label(QMainWindow):
self.ax1.grid(True)
self.ax1.xaxis.set_major_formatter(Params.FORMATTER)
self.reset_labelBtn_color()
PublicFunc.__resetAllButton__(self, ButtonState)
self.ui.spinBox_moveLength.setValue(Config["CustomAutoplayArgs"]["MoveLength"])
@ -332,6 +337,7 @@ class MainWindow_artifact_label(QMainWindow):
self.ax1.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -396,74 +402,74 @@ class MainWindow_artifact_label(QMainWindow):
# 绘制体动
for i in range(0, len(self.data.df_Artifact_a)):
if self.data.df_Artifact_a.iloc[i][1] == 1:
# 橙色,剧烈体动
# 橙色orange,剧烈体动
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_DEEP_YELLOW)
color="#ffa500")
self.rectangles_ax0_patches.append(rectangle)
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_DEEP_YELLOW)
color="#ffa500")
self.rectangles_ax1_patches.append(rectangle)
elif self.data.df_Artifact_a.iloc[i][1] == 2:
# 黄色,脉冲体动
# 黄色yellow,脉冲体动
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_YELLOW)
color="#ffff00")
self.rectangles_ax0_patches.append(rectangle)
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_YELLOW)
color="#ffff00")
self.rectangles_ax1_patches.append(rectangle)
elif self.data.df_Artifact_a.iloc[i][1] == 3:
# 青色,常规体动
# 草绿色limegreen,常规体动
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_AQUA)
color="#32cd32")
self.rectangles_ax0_patches.append(rectangle)
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_AQUA)
color="#32cd32")
self.rectangles_ax1_patches.append(rectangle)
elif self.data.df_Artifact_a.iloc[i][1] == 4:
# 紫色,疑似鼾声
# 青色cyan,疑似鼾声
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_PURPLE_PINK)
color="#00ffff")
self.rectangles_ax0_patches.append(rectangle)
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_PURPLE_PINK)
color="#00ffff")
self.rectangles_ax1_patches.append(rectangle)
elif self.data.df_Artifact_a.iloc[i][1] == 5:
# 灰色,离床
# 品红色magenta,离床
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_DEEP_GREY)
color="#ff00ff")
self.rectangles_ax0_patches.append(rectangle)
rectangle = patches.Rectangle((self.data.df_Artifact_a.iloc[i][2], self.rect_down),
width=(self.data.df_Artifact_a.iloc[i][3] - self.data.df_Artifact_a.iloc[i][2]),
height=self.rect_up - self.rect_down,
fill=True, alpha=Params.ARTIFACT_LABEL_LABEL_TRANSPARENCY,
color=Constants.PLOT_COLOR_DEEP_GREY)
color="#ff00ff")
self.rectangles_ax1_patches.append(rectangle)
for patch in self.rectangles_ax0_patches:
self.ax0.add_patch(patch)
@ -665,6 +671,7 @@ class MainWindow_artifact_label(QMainWindow):
PublicFunc.text_output(self.ui, "(6/6)" + result.info, Constants.TIPS_TYPE_INFO)
self.__reset__()
self.setting.close()
self.figToolbar.action_Label_Artifact.setEnabled(True)
for action in self.figToolbar._actions.values():
action.setEnabled(True)
@ -948,6 +955,7 @@ class MainWindow_artifact_label(QMainWindow):
self.update_tableWidget()
self.update_Info()
self.__plot_artifact__()
self.reset_labelBtn_color()
target_row = self.data.df_Artifact_a[self.data.df_Artifact_a.eq(start_time).any(axis=1)]
if not target_row.empty:
@ -1191,45 +1199,45 @@ class MainWindow_artifact_label(QMainWindow):
if type == 1:
self.ui.pushButton_type_1.setStyleSheet(
Constants.ARTIFACT_LABEL_LABELBTN_STYLE_1)
self.ui.pushButton_type_2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_3.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_4.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_5.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_3.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_4.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_5.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif type == 2:
self.ui.pushButton_type_1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_2.setStyleSheet(
Constants.ARTIFACT_LABEL_LABELBTN_STYLE_2)
self.ui.pushButton_type_3.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_4.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_5.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_3.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_4.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_5.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif type == 3:
self.ui.pushButton_type_1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_3.setStyleSheet(
Constants.ARTIFACT_LABEL_LABELBTN_STYLE_3)
self.ui.pushButton_type_4.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_5.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_4.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_5.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif type == 4:
self.ui.pushButton_type_1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_3.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_3.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_4.setStyleSheet(
Constants.ARTIFACT_LABEL_LABELBTN_STYLE_4)
self.ui.pushButton_type_5.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_5.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif type == 5:
self.ui.pushButton_type_1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_3.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_4.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_3.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_4.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_5.setStyleSheet(
Constants.ARTIFACT_LABEL_LABELBTN_STYLE_5)
def reset_labelBtn_color(self):
self.ui.pushButton_type_1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_3.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_4.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_5.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_type_1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_3.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_4.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_type_5.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
def toggle_home(self):
if Config["AutoplayArgs"]["AutoplayMode"] != "pause":

View File

@ -194,6 +194,9 @@ class MainWindow_bcg_quality_label(QMainWindow):
self.line_data = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -289,6 +292,7 @@ class MainWindow_bcg_quality_label(QMainWindow):
self.ax0.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -478,6 +482,7 @@ class MainWindow_bcg_quality_label(QMainWindow):
self.update_tableWidget()
self.update_status()
self.change_labelBtn_color()
self.setting.close()
ButtonState["Current"]["pushButton_input_setting"] = False
ButtonState["Current"]["pushButton_input"] = False
ButtonState["Current"]["pushButton_invalid_signal_label"] = True
@ -837,10 +842,9 @@ class MainWindow_bcg_quality_label(QMainWindow):
value - 1]) != Constants.STRING_IS_EMPTY and
str(self.data.df_label[Constants.BCG_QUALITY_LABEL_COLUMN_REMARK][value - 1]) != Constants.STRING_IS_NAN):
item = tableWidget.item(row, 0)
item.setBackground(QColor(255, 200, 200))
item.setBackground(QColor(255, 200, 200, 128))
else:
item = tableWidget.item(row, 0)
item.setBackground(QColor(255, 255, 255))
self.ui.tableWidget_a1.verticalScrollBar().setValue(self.ui.tableWidget_a1.verticalScrollBar().maximum())
self.ui.tableWidget_a2.verticalScrollBar().setValue(self.ui.tableWidget_a2.verticalScrollBar().maximum())
self.ui.tableWidget_b1.verticalScrollBar().setValue(self.ui.tableWidget_b2.verticalScrollBar().maximum())
@ -875,10 +879,9 @@ class MainWindow_bcg_quality_label(QMainWindow):
value - 1]) != Constants.STRING_IS_EMPTY and
str(self.data.df_label[Constants.BCG_QUALITY_LABEL_COLUMN_REMARK][value - 1]) != Constants.STRING_IS_NAN):
item = tableWidget.item(row, 0)
item.setBackground(QColor(255, 200, 200))
item.setBackground(QColor(255, 200, 200, 128))
else:
item = tableWidget.item(row, 0)
item.setBackground(QColor(255, 255, 255))
self.ui.tableWidget_a1.verticalScrollBar().setValue(self.ui.tableWidget_a1.verticalScrollBar().maximum())
self.ui.tableWidget_b1.verticalScrollBar().setValue(self.ui.tableWidget_b1.verticalScrollBar().maximum())
self.ui.tableWidget_c.verticalScrollBar().setValue(self.ui.tableWidget_c.verticalScrollBar().maximum())
@ -949,40 +952,40 @@ class MainWindow_bcg_quality_label(QMainWindow):
def change_labelBtn_color(self):
if self.data.df_label.at[Config["CurrentPartNum"] - 1, Constants.BCG_QUALITY_LABEL_COLUMN_LABEL] == "a1":
self.ui.pushButton_a1.setStyleSheet(Constants.BCG_QUALITY_LABEL_LABELBTN_STYLE)
self.ui.pushButton_a2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_c.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_c.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif self.data.df_label.at[Config["CurrentPartNum"] - 1, Constants.BCG_QUALITY_LABEL_COLUMN_LABEL] == "a2":
self.ui.pushButton_a1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_a2.setStyleSheet(Constants.BCG_QUALITY_LABEL_LABELBTN_STYLE)
self.ui.pushButton_b1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_c.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_c.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif self.data.df_label.at[Config["CurrentPartNum"] - 1, Constants.BCG_QUALITY_LABEL_COLUMN_LABEL] == "b1":
self.ui.pushButton_a1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_a2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b1.setStyleSheet(Constants.BCG_QUALITY_LABEL_LABELBTN_STYLE)
self.ui.pushButton_b2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_c.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_c.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif self.data.df_label.at[Config["CurrentPartNum"] - 1, Constants.BCG_QUALITY_LABEL_COLUMN_LABEL] == "b2":
self.ui.pushButton_a1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_a2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b2.setStyleSheet(Constants.BCG_QUALITY_LABEL_LABELBTN_STYLE)
self.ui.pushButton_c.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_c.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
elif self.data.df_label.at[Config["CurrentPartNum"] - 1, Constants.BCG_QUALITY_LABEL_COLUMN_LABEL] == "c1":
self.ui.pushButton_a1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_a2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_c.setStyleSheet(Constants.BCG_QUALITY_LABEL_LABELBTN_STYLE)
elif self.data.df_label.at[Config["CurrentPartNum"] - 1, Constants.BCG_QUALITY_LABEL_COLUMN_LABEL] == "f1":
self.ui.pushButton_a1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b1.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_b2.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_c.setStyleSheet(Constants.STRING_IS_EMPTY)
self.ui.pushButton_a1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_a2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b1.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_b2.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
self.ui.pushButton_c.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
class Data():

View File

@ -46,6 +46,9 @@ class MainWindow_cut_PSG(QMainWindow):
self.data = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
# 初始化进度条
self.ui.progressbar.setStyleSheet(Constants.PROGRESSBAR_STYLE)
self.progressbar = self.ui.progressbar

View File

@ -156,6 +156,9 @@ class MainWindow_detect_Jpeak(QMainWindow):
self.gs = None
self.ax0 = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -219,6 +222,7 @@ class MainWindow_detect_Jpeak(QMainWindow):
self.ax0.clear()
# 释放资源
self.setting.close()
del self.data
del self.model
self.fig.clf()
@ -303,6 +307,7 @@ class MainWindow_detect_Jpeak(QMainWindow):
else:
PublicFunc.text_output(self.ui, "(2/2)" + result.info, Constants.TIPS_TYPE_INFO)
self.setting.close()
ButtonState["Current"]["pushButton_input_setting"] = False
ButtonState["Current"]["pushButton_input"] = False
ButtonState["Current"]["pushButton_view"] = True

View File

@ -154,6 +154,9 @@ class MainWindow_detect_Rpeak(QMainWindow):
self.ax0 = None
self.ax1 = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -215,6 +218,7 @@ class MainWindow_detect_Rpeak(QMainWindow):
self.ax1.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -301,6 +305,7 @@ class MainWindow_detect_Rpeak(QMainWindow):
else:
PublicFunc.text_output(self.ui, "(2/2)" + result.info, Constants.TIPS_TYPE_INFO)
self.setting.close()
ButtonState["Current"]["pushButton_input_setting"] = False
ButtonState["Current"]["pushButton_input"] = False
ButtonState["Current"]["pushButton_view"] = True

View File

@ -249,6 +249,9 @@ class MainWindow_label_check(QMainWindow):
self.point_peak_corrected = None
self.annotation_tableWidget = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
# 初始化自动播放定时器
self.autoplay_xlim_start = None
self.autoplay_xlim_end = None
@ -356,6 +359,7 @@ class MainWindow_label_check(QMainWindow):
self.ax1.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -553,6 +557,7 @@ class MainWindow_label_check(QMainWindow):
PublicFunc.text_output(self.ui, "(7/7)" + result.info, Constants.TIPS_TYPE_INFO)
self.__reset__()
self.setting.close()
self.canvas.mpl_connect("motion_notify_event", self.on_motion)
self.figToolbar.action_Label_Multiple.setEnabled(True)
for action in self.figToolbar._actions.values():

View File

@ -1,6 +1,8 @@
from pathlib import Path
from traceback import format_exc
from PySide6.QtWidgets import QMainWindow, QMessageBox, QFileDialog
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QMainWindow, QMessageBox, QFileDialog, QApplication, QWidget
from PySide6.QtGui import QGuiApplication
from matplotlib import use
from yaml import dump, load, FullLoader
@ -25,12 +27,53 @@ from func.utils.Constants import Constants
use("QtAgg")
# style.use('dark_background')
# rcParams.update({
# 'figure.facecolor': '#f5f5dc',
# 'axes.facecolor': '#f5f5dc'
# })
Config = {
}
ButtonState = {
"Default": {
"pushButton_open": True,
"pushButton_approximately_align": True,
"pushButton_preprocess_BCG": True,
"pushButton_preprocess_ECG": True,
"pushButton_detect_Jpeak": True,
"pushButton_detect_Rpeak": True,
"pushButton_label_check_BCG": True,
"pushButton_label_check_ECG": True,
"pushButton_precisely_align": True,
"pushButton_cut_PSG": True,
"pushButton_artifact_label": True,
"pushButton_bcg_quality_label": True,
"pushButton_resp_quality_label": True,
"pushButton_SA_label": True
},
"Current": {
"pushButton_open": True,
"pushButton_approximately_align": True,
"pushButton_preprocess_BCG": True,
"pushButton_preprocess_ECG": True,
"pushButton_detect_Jpeak": True,
"pushButton_detect_Rpeak": True,
"pushButton_label_check_BCG": True,
"pushButton_label_check_ECG": True,
"pushButton_precisely_align": True,
"pushButton_cut_PSG": True,
"pushButton_artifact_label": True,
"pushButton_bcg_quality_label": True,
"pushButton_resp_quality_label": True,
"pushButton_SA_label": True
}
}
class MainWindow(QMainWindow, Ui_Signal_Label):
@ -69,7 +112,18 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.resp_quality_label = None
self.SA_label = None
PublicFunc.__styleAllButton__(self, ButtonState)
try:
if QApplication.styleHints().colorScheme() == Qt.ColorScheme.Dark:
self.ui.checkBox_darkmode.setChecked(True)
else:
self.ui.checkBox_darkmode.setChecked(False)
except Exception as e:
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_GET_DARKMODE_FAILURE + "" + format_exc(), Constants.TIPS_TYPE_ERROR)
# 绑定槽函数
self.ui.checkBox_darkmode.stateChanged.connect(self.set_dark_mode_status)
self.ui.pushButton_open.clicked.connect(self.__slot_btn_open__)
self.ui.pushButton_approximately_align.clicked.connect(self.__slot_btn_approximately_align__)
self.ui.pushButton_preprocess_BCG.clicked.connect(self.__slot_btn_preprocess__)
@ -309,3 +363,47 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
for path in path_list:
if not path.exists():
path.mkdir(parents=True, exist_ok=True)
def set_dark_mode_status(self):
module_list = [
self,
self.approximately_align,
self.preprocess,
self.detect_Jpeak,
self.detect_Rpeak,
self.label_check,
self.precisely_align,
self.cut_PSG,
self.artifact_label,
self.bcg_quality_label,
self.resp_quality_label,
self.SA_label
]
try:
if self.ui.checkBox_darkmode.isChecked():
QApplication.styleHints().setColorScheme(Qt.ColorScheme.Dark)
else:
QApplication.styleHints().setColorScheme(Qt.ColorScheme.Light)
except Exception as e:
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_DARKMODE_FAILURE + "" + format_exc(), Constants.MSGBOX_TYPE_ERROR)
return
for module in module_list:
try:
if module is not None:
MainWindow.update_widget_style(module)
except RuntimeError:
pass
@staticmethod
def update_widget_style(mainWindow):
all_widgets = mainWindow.centralWidget().findChildren(QWidget)
# 迭代所有部件
for widget in all_widgets:
try:
widget.style().unpolish(widget)
widget.style().polish(widget)
widget.update()
except TypeError:
pass

View File

@ -346,6 +346,9 @@ class MainWindow_precisely_align(QMainWindow):
self.ax4_xlime = None
self.ax4_ylime = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -434,6 +437,7 @@ class MainWindow_precisely_align(QMainWindow):
self.ax4.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -698,6 +702,7 @@ class MainWindow_precisely_align(QMainWindow):
else:
PublicFunc.text_output(self.ui, "(4/4)" + result.info, Constants.TIPS_TYPE_INFO)
self.setting.close()
self.figToolbar.action_Get_Range.setEnabled(True)
self.rect_down = min(self.ax0.get_ylim()[0], self.ax1.get_ylim()[0]) - 10000
self.rect_up = max(self.ax0.get_ylim()[1], self.ax1.get_ylim()[1]) + 10000
@ -716,6 +721,9 @@ class MainWindow_precisely_align(QMainWindow):
self.reset_axes()
self.canvas.draw()
self.data.correlation_align_point_match_ECG = array([]).astype(int)
self.data.correlation_align_point_match_BCG = array([]).astype(int)
# 处理数据
PublicFunc.progressbar_update(self, 1, 2, Constants.PRECISELY_ALIGN_PROCESSING_DATA, 50)
result = self.data.data_process_for_calculate_correlation()
@ -1637,9 +1645,6 @@ class Data:
self.correlation_align_point_match_ECG = array([]).astype(int)
self.correlation_align_point_match_BCG = array([]).astype(int)
self.argmax_BCG = None
self.argmax_ECG = None
def open_file(self):
if Path(Config["Path"]["Input_OrgBCG"]).is_file():
Config["Path"]["Input_OrgBCG"] = str(Path(Config["Path"]["Input_OrgBCG"]).parent)
@ -1732,8 +1737,6 @@ class Data:
self.Rpeak = read_csv(Config["Path"]["Input_Rpeak"],
encoding=Params.UTF8_ENCODING,
header=None).to_numpy().reshape(-1)
self.argmax_BCG = np_argmax(self.raw_BCG)
self.argmax_ECG = np_argmax(self.raw_ECG)
except Exception as e:
return Result().failure(info=Constants.INPUT_FAILURE +
Constants.FAILURE_REASON["Open_Data_Exception"] + "\n" + format_exc())
@ -1941,55 +1944,63 @@ class Data:
def correlation_align(self, mode):
try:
if mode == "init":
anchor0 = [Config["front"]["anchor_R"], Config["front"]["anchor_J"]]
anchor1 = [Config["back"]["anchor_R"], Config["back"]["anchor_J"]]
Config["orgfs"] = ((int(anchor1[1]) - int(anchor0[1])) * Config["InputConfig"]["UseFreq"] /
(int(anchor1[0]) - int(anchor0[0])))
Config["offset_anchor"] = anchor0[0] - anchor0[1]
orgfs = Config["orgfs"]
off = Config["offset_anchor"]
Config["orgfs"] = ((int(Config["back"]["anchor_J"]) - int(Config["front"]["anchor_J"])) * Config["InputConfig"]["UseFreq"] /
(int(Config["back"]["anchor_R"]) - int(Config["front"]["anchor_R"])))
Config["offset_anchor"] = Config["front"]["anchor_R"] - Config["front"]["anchor_J"]
self.res_orgBcg = self.raw_orgBcg.copy()
self.res_BCG = self.raw_BCG.copy()
self.cut_ECG = self.raw_ECG.copy()
self.cut_Rpeak = self.Rpeak.copy()
if off > 0:
self.cut_ECG = self.cut_ECG[off:]
anchor0[0] = anchor0[0] - off
anchor1[0] = anchor1[0] - off
idxs = where(self.cut_Rpeak > off)[0]
self.cut_Rpeak = self.cut_Rpeak[idxs] - off
Config["frontcut_index_BCG"], Config["frontcut_index_ECG"] = 0, 0
if Config["offset_anchor"] > 0:
self.cut_ECG = self.cut_ECG[Config["offset_anchor"]:]
Config["front"]["anchor_R"] = Config["front"]["anchor_R"] - Config["offset_anchor"]
Config["back"]["anchor_R"] = Config["back"]["anchor_R"] - Config["offset_anchor"]
idxs = where(self.cut_Rpeak > Config["offset_anchor"])[0]
self.cut_Rpeak = self.cut_Rpeak[idxs] - Config["offset_anchor"]
Config["frontcut_index_ECG"] += Config["offset_anchor"]
else:
self.res_BCG = self.res_BCG[-off:]
self.res_orgBcg = self.res_orgBcg[-off:]
anchor0[1] = anchor0[1] + off
anchor1[1] = anchor1[1] + off
self.res_BCG = self.res_BCG[-Config["offset_anchor"]:]
self.res_orgBcg = self.res_orgBcg[-Config["offset_anchor"]:]
Config["front"]["anchor_J"] = Config["front"]["anchor_J"] + Config["offset_anchor"]
Config["back"]["anchor_J"] = Config["back"]["anchor_J"] + Config["offset_anchor"]
Config["frontcut_index_BCG"] -= Config["offset_anchor"]
self.res_BCG = resample(self.res_BCG, orgfs, Config["InputConfig"]["UseFreq"])
self.res_orgBcg = resample(self.res_orgBcg, orgfs, Config["InputConfig"]["UseFreq"])
self.res_BCG = resample(self.res_BCG, Config["orgfs"], Config["InputConfig"]["UseFreq"])
self.res_orgBcg = resample(self.res_orgBcg, Config["orgfs"], Config["InputConfig"]["UseFreq"])
anchor0[1] = round(int(anchor0[1]) * Config["InputConfig"]["UseFreq"] / orgfs)
anchor1[1] = round(int(anchor1[1]) * Config["InputConfig"]["UseFreq"] / orgfs)
off = anchor1[0] - anchor1[1]
Config["front"]["anchor_J"] = round(int(Config["front"]["anchor_J"]) * Config["InputConfig"]["UseFreq"] / Config["orgfs"])
Config["back"]["anchor_J"] = round(int(Config["back"]["anchor_J"]) * Config["InputConfig"]["UseFreq"] / Config["orgfs"])
Config["offset_anchor"] = Config["back"]["anchor_R"] - Config["back"]["anchor_J"]
if off > 0:
self.cut_ECG = self.cut_ECG[off:]
anchor0[0] = anchor0[0] - off
anchor1[0] = anchor1[0] - off
idxs = where(self.cut_Rpeak > off)[0]
self.cut_Rpeak = self.cut_Rpeak[idxs] - off
if Config["offset_anchor"] > 0:
self.cut_ECG = self.cut_ECG[Config["offset_anchor"]:]
Config["front"]["anchor_R"] = Config["front"]["anchor_R"] - Config["offset_anchor"]
Config["back"]["anchor_R"] = Config["back"]["anchor_R"] - Config["offset_anchor"]
idxs = where(self.cut_Rpeak > Config["offset_anchor"])[0]
self.cut_Rpeak = self.cut_Rpeak[idxs] - Config["offset_anchor"]
Config["frontcut_index_ECG"] += Config["offset_anchor"] * Config["orgfs"] / Config["InputConfig"]["UseFreq"]
else:
self.res_BCG = self.res_BCG[-off:]
self.res_orgBcg = self.res_orgBcg[-off:]
anchor0[1] = anchor0[1] + off
anchor1[1] = anchor1[1] + off
self.res_BCG = self.res_BCG[-Config["offset_anchor"]:]
self.res_orgBcg = self.res_orgBcg[-Config["offset_anchor"]:]
Config["front"]["anchor_J"] = Config["front"]["anchor_J"] + Config["offset_anchor"]
Config["back"]["anchor_J"] = Config["back"]["anchor_J"] + Config["offset_anchor"]
Config["frontcut_index_BCG"] -= Config["offset_anchor"] * Config["orgfs"] / Config["InputConfig"]["UseFreq"]
datalen = np_min([len(self.cut_ECG), len(self.res_BCG)])
self.cut_ECG = self.cut_ECG[:datalen]
self.res_BCG = self.res_BCG[:datalen]
self.res_orgBcg = self.res_orgBcg[:datalen]
Config["frontcut_index_BCG"] = int(Config["frontcut_index_BCG"])
Config["frontcut_index_ECG"] = int(Config["frontcut_index_ECG"])
Config["backcut_index_BCG"] = int(Config["frontcut_index_BCG"] + datalen)
Config["backcut_index_ECG"] = int(Config["frontcut_index_ECG"] + datalen)
a = np_max([np_max(self.cut_ECG), np_max(self.res_BCG)])
b = np_min([np_min(self.cut_ECG), np_min(self.res_BCG)])
peak_ECG, _ = find_peaks(self.cut_ECG)
@ -2001,8 +2012,8 @@ class Data:
result = {
"res_BCG": self.res_BCG,
"cut_ECG": self.cut_ECG,
"anchor00": anchor0[0],
"anchor10": anchor1[0],
"anchor00": Config["front"]["anchor_R"],
"anchor10": Config["back"]["anchor_R"],
"a": a,
"b": b,
"peak_ECG": peak_ECG,
@ -2026,38 +2037,41 @@ class Data:
def data_postprocess(self):
try:
if len(self.correlation_align_point_match_ECG) != 2 and len(self.correlation_align_point_match_BCG) != 2:
off = 0
Config["offset_anchor"] = 0
else:
self.correlation_align_point_match_ECG.sort()
self.correlation_align_point_match_BCG.sort()
off = round(((int(self.correlation_align_point_match_ECG[1]) - int(
Config["offset_anchor"] = round(((int(self.correlation_align_point_match_ECG[1]) - int(
self.correlation_align_point_match_BCG[1])) + (int(self.correlation_align_point_match_ECG[0]) - int(
self.correlation_align_point_match_BCG[0]))) / 2)
anchor0 = [Config["front"]["anchor_R"], Config["front"]["anchor_J"]]
anchor1 = [Config["back"]["anchor_R"], Config["back"]["anchor_J"]]
if off > 0:
self.cut_ECG = self.cut_ECG[off:]
anchor0[0] = anchor0[0] - off
anchor1[0] = anchor1[0] - off
self.cut_Rpeak = self.cut_Rpeak[where(self.cut_Rpeak > off)[0]] - off
if Config["offset_anchor"] > 0:
self.cut_ECG = self.cut_ECG[Config["offset_anchor"]:]
Config["front"]["anchor_R"] = Config["front"]["anchor_R"] - Config["offset_anchor"]
Config["back"]["anchor_R"] = Config["back"]["anchor_R"] - Config["offset_anchor"]
self.cut_Rpeak = self.cut_Rpeak[where(self.cut_Rpeak > Config["offset_anchor"])[0]] - Config["offset_anchor"]
Config["frontcut_index_ECG"] += Config["offset_anchor"] * Config["orgfs"] / Config["InputConfig"]["UseFreq"]
else:
self.res_BCG = self.res_BCG[-off:]
self.res_orgBcg = self.res_orgBcg[-off:]
anchor0[1] = anchor0[1] + off
anchor1[1] = anchor1[1] + off
self.res_BCG = self.res_BCG[-Config["offset_anchor"]:]
self.res_orgBcg = self.res_orgBcg[-Config["offset_anchor"]:]
Config["front"]["anchor_J"] = Config["front"]["anchor_J"] + Config["offset_anchor"]
Config["back"]["anchor_J"] = Config["back"]["anchor_J"] + Config["offset_anchor"]
Config["frontcut_index_BCG"] -= Config["offset_anchor"] * Config["orgfs"] / Config["InputConfig"]["UseFreq"]
datalen = np_min([len(self.cut_ECG), len(self.res_BCG)])
self.cut_ECG = self.cut_ECG[:datalen]
self.res_BCG = self.res_BCG[:datalen]
self.res_orgBcg = self.res_orgBcg[:datalen]
Config["frontcut_index_BCG"] = int(Config["frontcut_index_BCG"])
Config["frontcut_index_ECG"] = int(Config["frontcut_index_ECG"])
Config["backcut_index_BCG"] = int(Config["frontcut_index_BCG"] + datalen)
Config["backcut_index_ECG"] = int(Config["frontcut_index_ECG"] + datalen)
idxs = where(self.cut_Rpeak < datalen)[0]
self.cut_Rpeak = self.cut_Rpeak[idxs]
Config["offset_correct"] = off
self.cut_Jpeak = []
peaks, _ = find_peaks(self.res_BCG)
for i in self.cut_Rpeak:
@ -2066,22 +2080,11 @@ class Data:
self.cut_Jpeak.append(peaks[idx])
self.cut_Jpeak = asarray(self.cut_Jpeak).astype(int)
frontcut_index_BCG = int(
(self.argmax_BCG - np_argmax(self.res_BCG) / Config["InputConfig"]["UseFreq"] * Config["orgfs"]))
backcut_index_BCG = int(len(self.res_BCG) / Config["InputConfig"]["UseFreq"] * Config["orgfs"] + np_argmax(
self.raw_BCG) - np_argmax(self.res_BCG) / Config["InputConfig"]["UseFreq"] * Config["orgfs"])
frontcut_index_ECG = self.argmax_ECG - np_argmax(self.cut_ECG)
backcut_index_ECG = len(self.cut_ECG) + self.argmax_ECG - np_argmax(self.cut_ECG)
Config["frontcut_index_BCG"] = frontcut_index_BCG
Config["backcut_index_BCG"] = backcut_index_BCG
Config["frontcut_index_ECG"] = frontcut_index_ECG
Config["backcut_index_ECG"] = backcut_index_ECG
except Exception as e:
return Result().failure(info=Constants.PRECISELY_ALIGN_POSTPROCESS_VIEW_FAILURE +
Constants.FAILURE_REASON["PostProcess_Align_Exception"] + "\n" + format_exc())
info = f"{Constants.PRECISELY_ALIGN_POSTPROCESS_VIEW_FINISHED}BCG前后段被切割的坐标值为[{frontcut_index_BCG}, {backcut_index_BCG}]ECG前后段被切割的坐标值为[{frontcut_index_ECG}, {backcut_index_ECG}]"
info = f"{Constants.PRECISELY_ALIGN_POSTPROCESS_VIEW_FINISHED}BCG前后段被切割的坐标值为[{Config['frontcut_index_BCG']}, {Config['backcut_index_BCG']}]ECG前后段被切割的坐标值为[{Config['frontcut_index_ECG']}, {Config['backcut_index_ECG']}]"
return Result().success(info=info)
def save_alignInfo(self):

View File

@ -191,6 +191,9 @@ class MainWindow_preprocess(QMainWindow):
self.gs = None
self.ax0 = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -254,6 +257,7 @@ class MainWindow_preprocess(QMainWindow):
self.ax0.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -331,6 +335,7 @@ class MainWindow_preprocess(QMainWindow):
else:
PublicFunc.text_output(self.ui, "(2/2)" + result.info, Constants.TIPS_TYPE_INFO)
self.setting.close()
ButtonState["Current"]["pushButton_input_setting"] = False
ButtonState["Current"]["pushButton_input"] = False
ButtonState["Current"]["pushButton_view"] = True

View File

@ -225,6 +225,9 @@ class MainWindow_resp_quality_label(QMainWindow):
self.cid1 = None
self.cid2 = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -348,6 +351,7 @@ class MainWindow_resp_quality_label(QMainWindow):
self.ax1_spectrum.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -588,6 +592,7 @@ class MainWindow_resp_quality_label(QMainWindow):
else:
PublicFunc.text_output(self.ui, "(3/3)" + result.info, Constants.TIPS_TYPE_INFO)
self.setting.close()
ButtonState["Current"]["pushButton_input_setting"] = False
ButtonState["Current"]["pushButton_input_and_calculate_peaks"] = False
ButtonState["Current"]["pushButton_calculate_peaks"] = True
@ -756,6 +761,7 @@ class MainWindow_resp_quality_label(QMainWindow):
Config["CurrentPartNum"] = 1
self.update_info()
self.update_tableWidget()
self.setting.close()
ButtonState["Current"]["pushButton_input_setting"] = False
ButtonState["Current"]["pushButton_input_and_calculate_peaks"] = False
ButtonState["Current"]["pushButton_calculate_peaks"] = False

View File

@ -14,6 +14,8 @@ class Constants:
MAINWINDOW_ROOT_PATH_NOT_EXIST: str = "根目录路径输入错误"
MAINWINDOW_SAMPID_EMPTY: str = "样本ID为空"
MAINWINDOW_MSGBOX_TITLE: str = "消息"
MAINWINDOW_GET_DARKMODE_FAILURE: str = "获取深浅色状态失败,不影响标注工作,可忽略"
MAINWINDOW_DARKMODE_FAILURE: str = "切换深浅色模式失败,不影响标注工作,可忽略"
INPUTTING_DATA: str = "正在导入数据"
INPUT_FINISHED: str = "导入完成"
@ -70,11 +72,6 @@ class Constants:
PLOT_COLOR_PINK: str = "#ff00ff"
PLOT_COLOR_PURPLE: str = "m"
PLOT_COLOR_GRAY: str = "gray"
PLOT_COLOR_DEEP_YELLOW: str = "#ffa500"
PLOT_COLOR_YELLOW: str = "#ffff00"
PLOT_COLOR_AQUA: str = "#00ffff"
PLOT_COLOR_PURPLE_PINK: str = "#ee82ee"
PLOT_COLOR_DEEP_GREY: str = "#808080"
PROGRESSBAR_STYLE: str = """
QProgressBar {
@ -84,7 +81,7 @@ class Constants:
color: black;
text-align: center;
height: 20px;
background: #E5E4E4;
background: rgba(245, 245, 220, 128);
}
QProgressBar::chunk {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #9AFF99, stop:1 #9A9AFE);
@ -92,6 +89,35 @@ class Constants:
}
"""
LABELBTN_STYLE_NORMAL: str = """
QPushButton:hover {
background-color: rgba(255, 0, 0, 128); /* 鼠标悬停时的背景颜色 */
}"""
CHECKBOX_STYLE_NORMAL: str = '''
QCheckBox {
border: 2px solid rgb(128, 128, 128);
border-radius: 11px;
}
QCheckBox::indicator{
width: 20px;
height: 20px;
border-radius: 10px;
}
QCheckBox::indicator:checked {
background-color: rgba(0, 255, 0, 192);
image: url(./image/correct.svg);
}
QCheckBox::indicator:unchecked {
background-color: rgba(255, 0, 0, 128);
}
QCheckBox::indicator:disabled {
background-color: rgba(119, 136, 153, 128);
}'''
FAILURE_REASON: dict = {
"Path_Not_Exist": "(路径不存在)",
"File_Not_Exist": "(数据文件不存在)",
@ -358,55 +384,60 @@ class Constants:
ARTIFACT_LABEL_DELETE_ARTIFACT_FAILURE: str = "需要被删除的体动不存在"
ARTIFACT_LABEL_ACTION_LABEL: str = f"标注体动({Params.ARTIFACT_LABEL_ACTION_LABEL_ARTIFACT_SHORTCUT_KEY})"
# 橙色orange
ARTIFACT_LABEL_LABELBTN_STYLE_1: str = """
QPushButton {
background-color: #ffa500; /* 设置背景颜色 */
background-color: rgba(255, 165, 0, 128); /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: #00ff00; /* 鼠标悬停时的背景颜色 */
background-color: rgba(255, 0, 0, 128); /* 鼠标悬停时的背景颜色 */
}"""
# 黄色yellow
ARTIFACT_LABEL_LABELBTN_STYLE_2: str = """
QPushButton {
background-color: #ffff00; /* 设置背景颜色 */
background-color: rgba(255, 255, 0, 128); /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: #00ff00; /* 鼠标悬停时的背景颜色 */
background-color: rgba(255, 0, 0, 128); /* 鼠标悬停时的背景颜色 */
}"""
# 草绿色limegreen
ARTIFACT_LABEL_LABELBTN_STYLE_3: str = """
QPushButton {
background-color: #00ffff; /* 设置背景颜色 */
background-color: rgba(50, 205, 50, 128); /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: #00ff00; /* 鼠标悬停时的背景颜色 */
background-color: rgba(255, 0, 0, 128); /* 鼠标悬停时的背景颜色 */
}"""
# 青色cyan
ARTIFACT_LABEL_LABELBTN_STYLE_4: str = """
QPushButton {
background-color: #ee82ee; /* 设置背景颜色 */
background-color: rgba(0, 255, 255, 128); /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: #00ff00; /* 鼠标悬停时的背景颜色 */
background-color: rgba(255, 0, 0, 128); /* 鼠标悬停时的背景颜色 */
}"""
# 品红色magenta
ARTIFACT_LABEL_LABELBTN_STYLE_5: str = """
QPushButton {
background-color: #808080; /* 设置背景颜色 */
background-color: rgba(255, 0, 255, 128); /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: #00ff00; /* 鼠标悬停时的背景颜色 */
background-color: rgba(255, 0, 0, 128); /* 鼠标悬停时的背景颜色 */
}"""
# BCG的质量标注
@ -435,13 +466,13 @@ class Constants:
BCG_QUALITY_LABEL_LABEL_ARTIFACT_TO_TYPE_C_QUESTION_CONTENT: str = "你确定要将所有带有体动的片段标记为类型C"
BCG_QUALITY_LABEL_LABELBTN_STYLE: str = """
QPushButton {
background-color: orange; /* 设置背景颜色 */
background-color: rgba(255, 165, 0, 128); /* 设置背景颜色 */
padding: 10px; /* 设置内边距 */
border: 2px solid darkblue; /* 设置边框 */
border-radius: 10px; /* 设置圆角 */
}
QPushButton:hover {
background-color: yellow; /* 鼠标悬停时的背景颜色 */
background-color: rgba(255, 0, 0, 128); /* 鼠标悬停时的背景颜色 */
}"""

View File

@ -2,7 +2,7 @@ from datetime import datetime
from logging import error, info
from pathlib import Path
from PySide6.QtWidgets import QMessageBox, QWidget, QPushButton, QProgressBar, QApplication, QRadioButton
from PySide6.QtWidgets import QMessageBox, QWidget, QPushButton, QProgressBar, QApplication, QRadioButton, QCheckBox
from func.utils.Constants import Constants
from func.utils.CustomException import TipsTypeValueNotExistError, MsgBoxTypeValueNotExistError
@ -142,6 +142,19 @@ class PublicFunc:
if widget.objectName() in buttonState["Default"].keys():
widget.setEnabled(buttonState["Default"][widget.objectName()])
@staticmethod
def __styleAllButton__(mainWindow, buttonState):
# 启用按钮
all_widgets = mainWindow.centralWidget().findChildren(QWidget)
# 迭代所有部件,查找按钮并启用它们
for widget in all_widgets:
if isinstance(widget, QPushButton):
if widget.objectName() in buttonState["Default"].keys():
widget.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL)
if isinstance(widget, QCheckBox):
widget.setStyleSheet(Constants.CHECKBOX_STYLE_NORMAL)
@staticmethod
def add_progressbar(mainWindow):
mainWindow.progressbar = QProgressBar()

2
image/correct.svg Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" ?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 200 200" data-name="Layer 1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"><title/><path d="M100,15a85,85,0,1,0,85,85A84.93,84.93,0,0,0,100,15Zm0,150a65,65,0,1,1,65-65A64.87,64.87,0,0,1,100,165Zm25-91.5-29,35L76,94c-4.5-3.5-10.5-2.5-14,2s-2.5,10.5,2,14c6,4.5,12.5,9,18.5,13.5,4.5,3,8.5,7.5,14,8,1.5,0,3.5,0,5-1l3-3,22.5-27c4-5,8-9.5,12-14.5,3-4,4-9,.5-13L138,71.5c-3.5-2.5-9.5-2-13,2Z"/></svg>

After

Width:  |  Height:  |  Size: 560 B

6
run.py
View File

@ -1,3 +1,4 @@
from importlib.util import find_spec
from logging import getLogger, NOTSET, FileHandler, Formatter, StreamHandler, info
from os import environ
from pathlib import Path
@ -6,7 +7,6 @@ from time import strftime, localtime, time
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication
from func.Module_mainwindow import MainWindow
import importlib.util
if __name__ == '__main__':
# 设置日志
@ -28,7 +28,7 @@ if __name__ == '__main__':
info("程序启动")
# 解决 Could not find the Qt platform plugin "windows"
spec = importlib.util.find_spec("PySide6")
spec = find_spec("PySide6")
if spec and spec.origin:
dirname = Path(spec.origin).parent
plugin_path = dirname / 'plugins' / 'platforms'
@ -39,7 +39,7 @@ if __name__ == '__main__':
QApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
app = QApplication(argv)
app.styleHints().setColorScheme(Qt.ColorScheme.Light) # 强制使用浅色模式
app.setStyle("Fusion")
mainWindow = MainWindow()
mainWindow.show()
exit(app.exec())

View File

@ -3,7 +3,7 @@
################################################################################
## Form generated from reading UI file 'MainWindow_approximately_align.ui'
##
## Created by: Qt User Interface Compiler version 6.7.0
## Created by: Qt User Interface Compiler version 6.8.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
@ -547,23 +547,23 @@ class Ui_MainWindow_approximately_align(object):
self.groupBox_left.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u6570\u636e\u7c97\u540c\u6b65", None))
self.pushButton_input_setting.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5bfc\u5165\u8bbe\u7f6e", None))
self.pushButton_input.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5f00\u59cb\u5bfc\u5165", None))
self.label_3.setText(QCoreApplication.translate("MainWindow_approximately_align", u"orgBcg\u65f6\u957f(\u79d2)\uff1a", None))
self.label_3.setText(QCoreApplication.translate("MainWindow_approximately_align", u"OrgBCG\u65f6\u957f(\u79d2)\uff1a", None))
self.label_orgBcg_length.setText(QCoreApplication.translate("MainWindow_approximately_align", u"0", None))
self.label_6.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG\u65f6\u957f(\u79d2)\uff1a", None))
self.label_PSG_length.setText(QCoreApplication.translate("MainWindow_approximately_align", u"0", None))
self.groupBox_standardize.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u6807\u51c6\u5316", None))
self.checkBox_orgBcgDelBase.setText(QCoreApplication.translate("MainWindow_approximately_align", u"orgBcg\u53bb\u57fa\u7ebf", None))
self.checkBox_orgBcgDelBase.setText(QCoreApplication.translate("MainWindow_approximately_align", u"OrgBCG\u53bb\u57fa\u7ebf", None))
self.checkBox_PSGDelBase.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG\u53bb\u57fa\u7ebf", None))
self.checkBox_RawSignal.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u539f\u59cb\u4fe1\u53f7", None))
self.checkBox_orgBcgZScore.setText(QCoreApplication.translate("MainWindow_approximately_align", u"orgBcg\u6807\u51c6\u5316", None))
self.checkBox_orgBcgZScore.setText(QCoreApplication.translate("MainWindow_approximately_align", u"OrgBCG\u6807\u51c6\u5316", None))
self.checkBox_PSGZScore.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG\u6807\u51c6\u5316", None))
self.pushButton_Standardize.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5e94\u7528", None))
self.groupBox_get_position.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u622a\u65ad", None))
self.label.setText(QCoreApplication.translate("MainWindow_approximately_align", u"orgBcg_\u8865\u96f6\uff1a", None))
self.label.setText(QCoreApplication.translate("MainWindow_approximately_align", u"OrgBCG_\u8865\u96f6\uff1a", None))
self.label_2.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG_\u8865\u96f6\uff1a", None))
self.label_4.setText(QCoreApplication.translate("MainWindow_approximately_align", u"orgBcg_Pre \uff1a", None))
self.label_4.setText(QCoreApplication.translate("MainWindow_approximately_align", u"OrgBCG_Pre \uff1a", None))
self.label_5.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG_Pre \uff1a", None))
self.label_7.setText(QCoreApplication.translate("MainWindow_approximately_align", u"orgBcg_Post\uff1a", None))
self.label_7.setText(QCoreApplication.translate("MainWindow_approximately_align", u"OrgBCG_Post\uff1a", None))
self.label_8.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG_Post\uff1a", None))
self.pushButton_CutOff.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5e94\u7528", None))
self.groupBox_align_position.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u5bf9\u9f50\u8d77\u59cb\u4f4d\u7f6e", None))

View File

@ -76,7 +76,7 @@
</font>
</property>
<property name="text">
<string>orgBcg时长(秒)</string>
<string>OrgBCG时长(秒)</string>
</property>
</widget>
</item>
@ -147,7 +147,7 @@
</font>
</property>
<property name="text">
<string>orgBcg去基线</string>
<string>OrgBCG去基线</string>
</property>
<property name="checked">
<bool>true</bool>
@ -206,7 +206,7 @@
</font>
</property>
<property name="text">
<string>orgBcg标准化</string>
<string>OrgBCG标准化</string>
</property>
<property name="checked">
<bool>true</bool>
@ -274,7 +274,7 @@
</font>
</property>
<property name="text">
<string>orgBcg_补零</string>
<string>OrgBCG_补零</string>
</property>
</widget>
</item>
@ -350,7 +350,7 @@
</font>
</property>
<property name="text">
<string>orgBcg_Pre </string>
<string>OrgBCG_Pre </string>
</property>
</widget>
</item>
@ -414,7 +414,7 @@
</font>
</property>
<property name="text">
<string>orgBcg_Post</string>
<string>OrgBCG_Post</string>
</property>
</widget>
</item>

View File

@ -694,7 +694,7 @@ class Ui_MainWindow_artifact_label(object):
self.groupBox.setTitle(QCoreApplication.translate("MainWindow_artifact_label", u"\u6807\u6ce8\u53c2\u6570", None))
self.label_3.setText(QCoreApplication.translate("MainWindow_artifact_label", u"\u8d77\u59cb\u65f6\u95f4(ms)", None))
self.label_4.setText(QCoreApplication.translate("MainWindow_artifact_label", u"\u7ec8\u6b62\u65f6\u95f4(ms)", None))
self.label.setText(QCoreApplication.translate("MainWindow_artifact_label", u"orgBcg 20Hz\u4ee5\u4e0a\u80fd\u91cf\u5360\u6bd4", None))
self.label.setText(QCoreApplication.translate("MainWindow_artifact_label", u"OrgBCG 20Hz\u4ee5\u4e0a\u80fd\u91cf\u5360\u6bd4", None))
self.label_5.setText(QCoreApplication.translate("MainWindow_artifact_label", u"\u4f53\u52a8\u65f6\u957f(ms)", None))
self.label_2.setText(QCoreApplication.translate("MainWindow_artifact_label", u"BCG 20Hz\u4ee5\u4e0a\u80fd\u91cf\u5360\u6bd4", None))
self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow_artifact_label", u"\u81ea\u52a8\u64ad\u653e", None))

View File

@ -152,7 +152,7 @@
</font>
</property>
<property name="text">
<string>orgBcg 20Hz以上能量占比</string>
<string>OrgBCG 20Hz以上能量占比</string>
</property>
</widget>
</item>

View File

@ -15,10 +15,10 @@ 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, QComboBox, QGridLayout, QHBoxLayout,
QLabel, QMainWindow, QPlainTextEdit, QPushButton,
QSizePolicy, QSpacerItem, QStatusBar, QVBoxLayout,
QWidget)
from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox, QGridLayout,
QHBoxLayout, QLabel, QMainWindow, QPlainTextEdit,
QPushButton, QSizePolicy, QSpacerItem, QStatusBar,
QVBoxLayout, QWidget)
class Ui_Signal_Label(object):
def setupUi(self, Signal_Label):
@ -51,12 +51,38 @@ class Ui_Signal_Label(object):
self.plainTextEdit_root_path = QPlainTextEdit(self.centralwidget)
self.plainTextEdit_root_path.setObjectName(u"plainTextEdit_root_path")
self.plainTextEdit_root_path.setEnabled(False)
sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
sizePolicy1.setHorizontalStretch(0)
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.plainTextEdit_root_path.sizePolicy().hasHeightForWidth())
self.plainTextEdit_root_path.setSizePolicy(sizePolicy1)
self.verticalLayout_3.addWidget(self.plainTextEdit_root_path)
self.horizontalLayout_5 = QHBoxLayout()
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.horizontalLayout_5.addItem(self.horizontalSpacer)
self.checkBox_darkmode = QCheckBox(self.centralwidget)
self.checkBox_darkmode.setObjectName(u"checkBox_darkmode")
font1 = QFont()
font1.setPointSize(12)
self.checkBox_darkmode.setFont(font1)
self.horizontalLayout_5.addWidget(self.checkBox_darkmode)
self.verticalLayout_3.addLayout(self.horizontalLayout_5)
self.horizontalLayout.addLayout(self.verticalLayout_3)
self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.horizontalLayout.addItem(self.horizontalSpacer_2)
self.verticalLayout_2 = QVBoxLayout()
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
@ -71,25 +97,32 @@ class Ui_Signal_Label(object):
self.pushButton_open = QPushButton(self.centralwidget)
self.pushButton_open.setObjectName(u"pushButton_open")
sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred)
sizePolicy1.setHorizontalStretch(0)
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.pushButton_open.sizePolicy().hasHeightForWidth())
self.pushButton_open.setSizePolicy(sizePolicy1)
sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred)
sizePolicy2.setHorizontalStretch(0)
sizePolicy2.setVerticalStretch(0)
sizePolicy2.setHeightForWidth(self.pushButton_open.sizePolicy().hasHeightForWidth())
self.pushButton_open.setSizePolicy(sizePolicy2)
self.pushButton_open.setFont(font)
self.verticalLayout_2.addWidget(self.pushButton_open)
self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.verticalLayout_2.addItem(self.verticalSpacer_2)
self.horizontalLayout.addLayout(self.verticalLayout_2)
self.horizontalLayout.setStretch(0, 30)
self.horizontalLayout.setStretch(1, 1)
self.horizontalLayout.setStretch(2, 8)
self.verticalLayout.addLayout(self.horizontalLayout)
self.pushButton_approximately_align = QPushButton(self.centralwidget)
self.pushButton_approximately_align.setObjectName(u"pushButton_approximately_align")
sizePolicy1.setHeightForWidth(self.pushButton_approximately_align.sizePolicy().hasHeightForWidth())
self.pushButton_approximately_align.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_approximately_align.sizePolicy().hasHeightForWidth())
self.pushButton_approximately_align.setSizePolicy(sizePolicy2)
self.pushButton_approximately_align.setFont(font)
self.verticalLayout.addWidget(self.pushButton_approximately_align)
@ -98,16 +131,16 @@ class Ui_Signal_Label(object):
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.pushButton_preprocess_BCG = QPushButton(self.centralwidget)
self.pushButton_preprocess_BCG.setObjectName(u"pushButton_preprocess_BCG")
sizePolicy1.setHeightForWidth(self.pushButton_preprocess_BCG.sizePolicy().hasHeightForWidth())
self.pushButton_preprocess_BCG.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_preprocess_BCG.sizePolicy().hasHeightForWidth())
self.pushButton_preprocess_BCG.setSizePolicy(sizePolicy2)
self.pushButton_preprocess_BCG.setFont(font)
self.horizontalLayout_2.addWidget(self.pushButton_preprocess_BCG)
self.pushButton_preprocess_ECG = QPushButton(self.centralwidget)
self.pushButton_preprocess_ECG.setObjectName(u"pushButton_preprocess_ECG")
sizePolicy1.setHeightForWidth(self.pushButton_preprocess_ECG.sizePolicy().hasHeightForWidth())
self.pushButton_preprocess_ECG.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_preprocess_ECG.sizePolicy().hasHeightForWidth())
self.pushButton_preprocess_ECG.setSizePolicy(sizePolicy2)
self.pushButton_preprocess_ECG.setFont(font)
self.horizontalLayout_2.addWidget(self.pushButton_preprocess_ECG)
@ -119,16 +152,16 @@ class Ui_Signal_Label(object):
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.pushButton_detect_Jpeak = QPushButton(self.centralwidget)
self.pushButton_detect_Jpeak.setObjectName(u"pushButton_detect_Jpeak")
sizePolicy1.setHeightForWidth(self.pushButton_detect_Jpeak.sizePolicy().hasHeightForWidth())
self.pushButton_detect_Jpeak.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_detect_Jpeak.sizePolicy().hasHeightForWidth())
self.pushButton_detect_Jpeak.setSizePolicy(sizePolicy2)
self.pushButton_detect_Jpeak.setFont(font)
self.horizontalLayout_3.addWidget(self.pushButton_detect_Jpeak)
self.pushButton_detect_Rpeak = QPushButton(self.centralwidget)
self.pushButton_detect_Rpeak.setObjectName(u"pushButton_detect_Rpeak")
sizePolicy1.setHeightForWidth(self.pushButton_detect_Rpeak.sizePolicy().hasHeightForWidth())
self.pushButton_detect_Rpeak.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_detect_Rpeak.sizePolicy().hasHeightForWidth())
self.pushButton_detect_Rpeak.setSizePolicy(sizePolicy2)
self.pushButton_detect_Rpeak.setFont(font)
self.horizontalLayout_3.addWidget(self.pushButton_detect_Rpeak)
@ -140,16 +173,16 @@ class Ui_Signal_Label(object):
self.horizontalLayout_6.setObjectName(u"horizontalLayout_6")
self.pushButton_label_check_BCG = QPushButton(self.centralwidget)
self.pushButton_label_check_BCG.setObjectName(u"pushButton_label_check_BCG")
sizePolicy1.setHeightForWidth(self.pushButton_label_check_BCG.sizePolicy().hasHeightForWidth())
self.pushButton_label_check_BCG.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_label_check_BCG.sizePolicy().hasHeightForWidth())
self.pushButton_label_check_BCG.setSizePolicy(sizePolicy2)
self.pushButton_label_check_BCG.setFont(font)
self.horizontalLayout_6.addWidget(self.pushButton_label_check_BCG)
self.pushButton_label_check_ECG = QPushButton(self.centralwidget)
self.pushButton_label_check_ECG.setObjectName(u"pushButton_label_check_ECG")
sizePolicy1.setHeightForWidth(self.pushButton_label_check_ECG.sizePolicy().hasHeightForWidth())
self.pushButton_label_check_ECG.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_label_check_ECG.sizePolicy().hasHeightForWidth())
self.pushButton_label_check_ECG.setSizePolicy(sizePolicy2)
self.pushButton_label_check_ECG.setFont(font)
self.horizontalLayout_6.addWidget(self.pushButton_label_check_ECG)
@ -161,16 +194,16 @@ class Ui_Signal_Label(object):
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
self.pushButton_precisely_align = QPushButton(self.centralwidget)
self.pushButton_precisely_align.setObjectName(u"pushButton_precisely_align")
sizePolicy1.setHeightForWidth(self.pushButton_precisely_align.sizePolicy().hasHeightForWidth())
self.pushButton_precisely_align.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_precisely_align.sizePolicy().hasHeightForWidth())
self.pushButton_precisely_align.setSizePolicy(sizePolicy2)
self.pushButton_precisely_align.setFont(font)
self.horizontalLayout_4.addWidget(self.pushButton_precisely_align)
self.pushButton_cut_PSG = QPushButton(self.centralwidget)
self.pushButton_cut_PSG.setObjectName(u"pushButton_cut_PSG")
sizePolicy1.setHeightForWidth(self.pushButton_cut_PSG.sizePolicy().hasHeightForWidth())
self.pushButton_cut_PSG.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_cut_PSG.sizePolicy().hasHeightForWidth())
self.pushButton_cut_PSG.setSizePolicy(sizePolicy2)
self.pushButton_cut_PSG.setFont(font)
self.horizontalLayout_4.addWidget(self.pushButton_cut_PSG)
@ -182,32 +215,32 @@ class Ui_Signal_Label(object):
self.pushButton_artifact_label = QPushButton(self.centralwidget)
self.pushButton_artifact_label.setObjectName(u"pushButton_artifact_label")
sizePolicy1.setHeightForWidth(self.pushButton_artifact_label.sizePolicy().hasHeightForWidth())
self.pushButton_artifact_label.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_artifact_label.sizePolicy().hasHeightForWidth())
self.pushButton_artifact_label.setSizePolicy(sizePolicy2)
self.pushButton_artifact_label.setFont(font)
self.verticalLayout.addWidget(self.pushButton_artifact_label)
self.pushButton_bcg_quality_label = QPushButton(self.centralwidget)
self.pushButton_bcg_quality_label.setObjectName(u"pushButton_bcg_quality_label")
sizePolicy1.setHeightForWidth(self.pushButton_bcg_quality_label.sizePolicy().hasHeightForWidth())
self.pushButton_bcg_quality_label.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_bcg_quality_label.sizePolicy().hasHeightForWidth())
self.pushButton_bcg_quality_label.setSizePolicy(sizePolicy2)
self.pushButton_bcg_quality_label.setFont(font)
self.verticalLayout.addWidget(self.pushButton_bcg_quality_label)
self.pushButton_resp_quality_label = QPushButton(self.centralwidget)
self.pushButton_resp_quality_label.setObjectName(u"pushButton_resp_quality_label")
sizePolicy1.setHeightForWidth(self.pushButton_resp_quality_label.sizePolicy().hasHeightForWidth())
self.pushButton_resp_quality_label.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_resp_quality_label.sizePolicy().hasHeightForWidth())
self.pushButton_resp_quality_label.setSizePolicy(sizePolicy2)
self.pushButton_resp_quality_label.setFont(font)
self.verticalLayout.addWidget(self.pushButton_resp_quality_label)
self.pushButton_SA_label = QPushButton(self.centralwidget)
self.pushButton_SA_label.setObjectName(u"pushButton_SA_label")
sizePolicy1.setHeightForWidth(self.pushButton_SA_label.sizePolicy().hasHeightForWidth())
self.pushButton_SA_label.setSizePolicy(sizePolicy1)
sizePolicy2.setHeightForWidth(self.pushButton_SA_label.sizePolicy().hasHeightForWidth())
self.pushButton_SA_label.setSizePolicy(sizePolicy2)
self.pushButton_SA_label.setFont(font)
self.verticalLayout.addWidget(self.pushButton_SA_label)
@ -238,6 +271,7 @@ class Ui_Signal_Label(object):
def retranslateUi(self, Signal_Label):
Signal_Label.setWindowTitle(QCoreApplication.translate("Signal_Label", u"Signal_Label", None))
self.label.setText(QCoreApplication.translate("Signal_Label", u"\u6570\u636e\u6839\u76ee\u5f55\uff1a", None))
self.checkBox_darkmode.setText(QCoreApplication.translate("Signal_Label", u"\u6df1\u8272\u6a21\u5f0f\u5f00\u5173", None))
self.pushButton_open.setText(QCoreApplication.translate("Signal_Label", u"\u6253\u5f00", None))
self.pushButton_approximately_align.setText(QCoreApplication.translate("Signal_Label", u"\u6570\u636e\u7c97\u540c\u6b65", None))
self.pushButton_preprocess_BCG.setText(QCoreApplication.translate("Signal_Label", u"BCG\u7684\u9884\u5904\u7406", None))

View File

@ -24,9 +24,9 @@
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,1,1,1,1,1,1,1,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="30,1,8">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,0">
<item>
<widget class="QLabel" name="label">
<property name="font">
@ -44,10 +44,58 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBox_darkmode">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>深色模式开关</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -90,6 +138,19 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>