更新UI布局,新增样本编号标签和添加zscore限幅选项,调整窗口大小和字体设置

This commit is contained in:
2025-12-15 21:39:34 +08:00
parent 8546ea730a
commit 20ad915760
3 changed files with 259 additions and 177 deletions

View File

@ -212,11 +212,13 @@ class SettingWindow(QMainWindow):
Config["InputConfig"]["orgBcgFreq"] = result.data["freq"]
else:
PublicFunc.msgbox_output(self, Filename.ORGBCG_RAW + Constants.FAILURE_REASON["Get_Freq_Not_Correct"], Constants.MSGBOX_TYPE_ERROR)
result = PublicFunc.examine_file(Config["Path"]["Input_Tho"], Filename.THO_RAW, Params.ENDSWITH_TXT)
if result.status:
Config["InputConfig"]["ThoFreq"] = result.data["freq"]
else:
PublicFunc.msgbox_output(self, Filename.THO_RAW + Constants.FAILURE_REASON["Get_Freq_Not_Correct"], Constants.MSGBOX_TYPE_ERROR)
result = PublicFunc.examine_file(Config["Path"]["Input_Abd"], Filename.ABD_RAW, Params.ENDSWITH_TXT)
if result.status:
Config["InputConfig"]["AbdFreq"] = result.data["freq"]
@ -272,6 +274,8 @@ class MainWindow_approximately_align(QMainWindow):
self.ui.verticalLayout_canvas.addWidget(self.canvas)
self.ui.verticalLayout_canvas.addWidget(self.figToolbar)
self.ui.label_sampno.setText(str(self.sampID))
PublicFunc.__resetAllButton__(self, ButtonState)
self.ui.pushButton_input.clicked.connect(self.__slot_btn_input__)
@ -446,13 +450,16 @@ class MainWindow_approximately_align(QMainWindow):
Config["RawSignal"] = self.ui.checkBox_RawSignal.isChecked()
Config["orgBcgConfig"].update({
"orgBcgDelBase": self.ui.checkBox_orgBcgDelBase.isChecked(),
"orgBcgZScore": self.ui.checkBox_orgBcgZScore.isChecked()
"orgBcgZScore": self.ui.checkBox_orgBcgZScore.isChecked(),
"orgBcgZScoreLimit": self.ui.checkBox_orgBcgZScoreLimit.isChecked(),
})
Config["PSGConfig"].update({
"PSGDelBase": self.ui.checkBox_PSGDelBase.isChecked(),
"PSGZScore": self.ui.checkBox_PSGZScore.isChecked()
"PSGZScore": self.ui.checkBox_PSGZScore.isChecked(),
"PSGZScoreLimit": self.ui.checkBox_PSGZScoreLimit.isChecked(),
})
if Config["RawSignal"]:
# 仅重采样
PublicFunc.progressbar_update(self, 1, 1, Constants.APPROXIMATELY_ONLY_ALIGN_RESAMPLING, 0)
@ -1116,6 +1123,7 @@ class Data:
int(Config["orgBcg_seconds"] * Config["ApplyFrequency"]))
self.processed_Tho = resample(self.raw_Tho, int(Config["PSG_seconds"] * Config["ApplyFrequency"]))
self.processed_Abd = resample(self.raw_Abd, int(Config["PSG_seconds"] * Config["ApplyFrequency"]))
self.processed_downsample_orgBcg = self.processed_orgBcg.copy()
self.processed_downsample_Tho = self.processed_Tho.copy()
self.processed_downsample_Abd = self.processed_Abd.copy()
@ -1211,9 +1219,20 @@ class Data:
if Config["PSGConfig"]["PSGZScore"]:
self.processed_Tho = (self.processed_Tho - mean(self.processed_Tho)) / std(self.processed_Tho)
self.processed_Abd = (self.processed_Abd - mean(self.processed_Abd)) / std(self.processed_Abd)
if Config["PSGConfig"]["PSGZScoreLimit"]:
limit = 6
self.processed_Tho[self.processed_Tho > limit] = limit
self.processed_Tho[self.processed_Tho < -limit] = -limit
self.processed_Abd[self.processed_Abd > limit] = limit
self.processed_Abd[self.processed_Abd < -limit] = -limit
if Config["orgBcgConfig"]["orgBcgZScore"]:
self.processed_orgBcg = (self.processed_orgBcg - mean(self.processed_orgBcg)) / std(
self.processed_orgBcg)
if Config["orgBcgConfig"]["orgBcgZScoreLimit"]:
limit = 6
self.processed_orgBcg[self.processed_orgBcg > limit] = limit
self.processed_orgBcg[self.processed_orgBcg < -limit] = -limit
except Exception as e:
return Result().failure(
info=Constants.APPROXIMATELY_STANDARDIZE_FAILURE + Constants.FAILURE_REASON[

View File

@ -3,7 +3,7 @@
################################################################################
## Form generated from reading UI file 'MainWindow_approximately_align.ui'
##
## Created by: Qt User Interface Compiler version 6.8.2
## Created by: Qt User Interface Compiler version 6.9.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
@ -25,7 +25,7 @@ class Ui_MainWindow_approximately_align(object):
def setupUi(self, MainWindow_approximately_align):
if not MainWindow_approximately_align.objectName():
MainWindow_approximately_align.setObjectName(u"MainWindow_approximately_align")
MainWindow_approximately_align.resize(1920, 1080)
MainWindow_approximately_align.resize(1928, 1099)
self.centralwidget = QWidget(MainWindow_approximately_align)
self.centralwidget.setObjectName(u"centralwidget")
self.gridLayout = QGridLayout(self.centralwidget)
@ -65,9 +65,23 @@ class Ui_MainWindow_approximately_align(object):
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.label_12 = QLabel(self.groupBox_left)
self.label_12.setObjectName(u"label_12")
self.horizontalLayout_2.addWidget(self.label_12)
self.label_sampno = QLabel(self.groupBox_left)
self.label_sampno.setObjectName(u"label_sampno")
self.horizontalLayout_2.addWidget(self.label_sampno)
self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.horizontalLayout_2.addItem(self.horizontalSpacer_2)
self.label_3 = QLabel(self.groupBox_left)
self.label_3.setObjectName(u"label_3")
self.label_3.setFont(font1)
self.label_3.setFont(font)
self.horizontalLayout_2.addWidget(self.label_3)
@ -83,7 +97,7 @@ class Ui_MainWindow_approximately_align(object):
self.label_6 = QLabel(self.groupBox_left)
self.label_6.setObjectName(u"label_6")
self.label_6.setFont(font1)
self.label_6.setFont(font)
self.horizontalLayout_2.addWidget(self.label_6)
@ -98,69 +112,75 @@ class Ui_MainWindow_approximately_align(object):
self.groupBox_standardize = QGroupBox(self.groupBox_left)
self.groupBox_standardize.setObjectName(u"groupBox_standardize")
self.verticalLayout_5 = QVBoxLayout(self.groupBox_standardize)
self.verticalLayout_5.setObjectName(u"verticalLayout_5")
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.checkBox_orgBcgDelBase = QCheckBox(self.groupBox_standardize)
self.checkBox_orgBcgDelBase.setObjectName(u"checkBox_orgBcgDelBase")
self.checkBox_orgBcgDelBase.setFont(font1)
self.checkBox_orgBcgDelBase.setChecked(True)
self.gridLayoutWidget = QWidget(self.groupBox_standardize)
self.gridLayoutWidget.setObjectName(u"gridLayoutWidget")
self.gridLayoutWidget.setGeometry(QRect(0, 20, 421, 80))
self.gridLayout_4 = QGridLayout(self.gridLayoutWidget)
self.gridLayout_4.setObjectName(u"gridLayout_4")
self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
self.checkBox_PSGZScoreLimit = QCheckBox(self.gridLayoutWidget)
self.checkBox_PSGZScoreLimit.setObjectName(u"checkBox_PSGZScoreLimit")
self.horizontalLayout.addWidget(self.checkBox_orgBcgDelBase)
self.gridLayout_4.addWidget(self.checkBox_PSGZScoreLimit, 1, 3, 1, 1)
self.checkBox_PSGDelBase = QCheckBox(self.groupBox_standardize)
self.checkBox_PSGDelBase.setObjectName(u"checkBox_PSGDelBase")
self.checkBox_PSGDelBase.setFont(font1)
self.checkBox_PSGDelBase.setChecked(True)
self.label_11 = QLabel(self.gridLayoutWidget)
self.label_11.setObjectName(u"label_11")
self.label_11.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.horizontalLayout.addWidget(self.checkBox_PSGDelBase)
self.gridLayout_4.addWidget(self.label_11, 1, 0, 1, 1)
self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.horizontalLayout.addItem(self.horizontalSpacer_2)
self.checkBox_RawSignal = QCheckBox(self.groupBox_standardize)
self.checkBox_RawSignal.setObjectName(u"checkBox_RawSignal")
self.checkBox_RawSignal.setFont(font1)
self.horizontalLayout.addWidget(self.checkBox_RawSignal)
self.verticalLayout_5.addLayout(self.horizontalLayout)
self.horizontalLayout_5 = QHBoxLayout()
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
self.checkBox_orgBcgZScore = QCheckBox(self.groupBox_standardize)
self.checkBox_orgBcgZScore = QCheckBox(self.gridLayoutWidget)
self.checkBox_orgBcgZScore.setObjectName(u"checkBox_orgBcgZScore")
self.checkBox_orgBcgZScore.setFont(font1)
self.checkBox_orgBcgZScore.setChecked(True)
self.horizontalLayout_5.addWidget(self.checkBox_orgBcgZScore)
self.gridLayout_4.addWidget(self.checkBox_orgBcgZScore, 0, 2, 1, 1)
self.checkBox_PSGZScore = QCheckBox(self.groupBox_standardize)
self.label_10 = QLabel(self.gridLayoutWidget)
self.label_10.setObjectName(u"label_10")
self.label_10.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.gridLayout_4.addWidget(self.label_10, 0, 0, 1, 1)
self.checkBox_PSGZScore = QCheckBox(self.gridLayoutWidget)
self.checkBox_PSGZScore.setObjectName(u"checkBox_PSGZScore")
self.checkBox_PSGZScore.setFont(font1)
self.checkBox_PSGZScore.setChecked(True)
self.horizontalLayout_5.addWidget(self.checkBox_PSGZScore)
self.gridLayout_4.addWidget(self.checkBox_PSGZScore, 1, 2, 1, 1)
self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.checkBox_PSGDelBase = QCheckBox(self.gridLayoutWidget)
self.checkBox_PSGDelBase.setObjectName(u"checkBox_PSGDelBase")
self.checkBox_PSGDelBase.setFont(font1)
self.checkBox_PSGDelBase.setChecked(True)
self.horizontalLayout_5.addItem(self.horizontalSpacer_3)
self.gridLayout_4.addWidget(self.checkBox_PSGDelBase, 1, 1, 1, 1)
self.pushButton_Standardize = QPushButton(self.groupBox_standardize)
self.checkBox_orgBcgDelBase = QCheckBox(self.gridLayoutWidget)
self.checkBox_orgBcgDelBase.setObjectName(u"checkBox_orgBcgDelBase")
self.checkBox_orgBcgDelBase.setFont(font1)
self.checkBox_orgBcgDelBase.setChecked(True)
self.gridLayout_4.addWidget(self.checkBox_orgBcgDelBase, 0, 1, 1, 1)
self.checkBox_orgBcgZScoreLimit = QCheckBox(self.gridLayoutWidget)
self.checkBox_orgBcgZScoreLimit.setObjectName(u"checkBox_orgBcgZScoreLimit")
self.gridLayout_4.addWidget(self.checkBox_orgBcgZScoreLimit, 0, 3, 1, 1)
self.checkBox_RawSignal = QCheckBox(self.gridLayoutWidget)
self.checkBox_RawSignal.setObjectName(u"checkBox_RawSignal")
self.checkBox_RawSignal.setFont(font)
self.gridLayout_4.addWidget(self.checkBox_RawSignal, 0, 4, 1, 1)
self.pushButton_Standardize = QPushButton(self.gridLayoutWidget)
self.pushButton_Standardize.setObjectName(u"pushButton_Standardize")
self.pushButton_Standardize.setFont(font1)
self.pushButton_Standardize.setFont(font)
self.horizontalLayout_5.addWidget(self.pushButton_Standardize)
self.gridLayout_4.addWidget(self.pushButton_Standardize, 1, 4, 1, 1)
self.verticalLayout_5.addLayout(self.horizontalLayout_5)
self.verticalLayout_5.setStretch(0, 1)
self.verticalLayout_5.setStretch(1, 1)
self.verticalLayout.addWidget(self.groupBox_standardize)
self.groupBox_get_position = QGroupBox(self.groupBox_left)
@ -547,16 +567,22 @@ 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_12.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u7f16\u53f7\uff1a", None))
self.label_sampno.setText(QCoreApplication.translate("MainWindow_approximately_align", u"None", 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_PSGDelBase.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG\u53bb\u57fa\u7ebf", None))
self.checkBox_PSGZScoreLimit.setText(QCoreApplication.translate("MainWindow_approximately_align", u"Z-Score\u9650\u5e45", None))
self.label_11.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG", None))
self.checkBox_orgBcgZScore.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u6807\u51c6\u5316", None))
self.label_10.setText(QCoreApplication.translate("MainWindow_approximately_align", u"OrgBCG", None))
self.checkBox_PSGZScore.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u6807\u51c6\u5316", None))
self.checkBox_PSGDelBase.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u53bb\u57fa\u7ebf", None))
self.checkBox_orgBcgDelBase.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u53bb\u57fa\u7ebf", None))
self.checkBox_orgBcgZScoreLimit.setText(QCoreApplication.translate("MainWindow_approximately_align", u"Z-Score\u9650\u5e45", 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_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))

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>1080</height>
<width>1928</width>
<height>1099</height>
</rect>
</property>
<property name="windowTitle">
@ -68,11 +68,38 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>编号:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_sampno">
<property name="text">
<string>None</string>
</property>
</widget>
</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>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
@ -109,7 +136,7 @@
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
@ -136,126 +163,136 @@
<property name="title">
<string>标准化</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="1,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0">
<item>
<widget class="QCheckBox" name="checkBox_orgBcgDelBase">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>OrgBCG去基线</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_PSGDelBase">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>PSG去基线</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</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>
<widget class="QCheckBox" name="checkBox_RawSignal">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>原始信号</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,0,0">
<item>
<widget class="QCheckBox" name="checkBox_orgBcgZScore">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>OrgBCG标准化</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_PSGZScore">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>PSG标准化</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<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="QPushButton" name="pushButton_Standardize">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>应用</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>421</width>
<height>80</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="3">
<widget class="QCheckBox" name="checkBox_PSGZScoreLimit">
<property name="text">
<string>Z-Score限幅</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>PSG</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="checkBox_orgBcgZScore">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>标准化</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>OrgBCG</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="checkBox_PSGZScore">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>标准化</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBox_PSGDelBase">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>去基线</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBox_orgBcgDelBase">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>去基线</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="checkBox_orgBcgZScoreLimit">
<property name="text">
<string>Z-Score限幅</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QCheckBox" name="checkBox_RawSignal">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>原始信号</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="pushButton_Standardize">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>应用</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>