Compare commits

..

11 Commits

9 changed files with 697 additions and 196 deletions

View File

@ -12,6 +12,7 @@ from overrides import overrides
from pandas import read_csv, DataFrame from pandas import read_csv, DataFrame
from scipy.signal import find_peaks, resample, butter, sosfiltfilt, correlate from scipy.signal import find_peaks, resample, butter, sosfiltfilt, correlate
from yaml import dump, load, FullLoader from yaml import dump, load, FullLoader
from sklearn.linear_model import TheilSenRegressor
from func.utils.ConfigParams import Filename, Params from func.utils.ConfigParams import Filename, Params
from func.utils.PublicFunc import PublicFunc from func.utils.PublicFunc import PublicFunc
@ -45,7 +46,9 @@ ButtonState = {
"radioButton_PABD": False, "radioButton_PABD": False,
"radioButton_NTHO": False, "radioButton_NTHO": False,
"radioButton_NABD": False, "radioButton_NABD": False,
"radioButton_custom": False "radioButton_custom": False,
"radioButton_freqTHO": False,
"radioButton_freqABD": False,
}, },
"Current": { "Current": {
"pushButton_input_setting": True, "pushButton_input_setting": True,
@ -66,7 +69,9 @@ ButtonState = {
"radioButton_PABD": False, "radioButton_PABD": False,
"radioButton_NTHO": False, "radioButton_NTHO": False,
"radioButton_NABD": False, "radioButton_NABD": False,
"radioButton_custom": False "radioButton_custom": False,
"radioButton_freqTHO": False,
"radioButton_freqABD": False,
} }
} }
@ -254,6 +259,8 @@ class MainWindow_approximately_align(QMainWindow):
self.ui.radioButton_PABD.clicked.connect(self.__enableAlign__) self.ui.radioButton_PABD.clicked.connect(self.__enableAlign__)
self.ui.radioButton_NABD.clicked.connect(self.__enableAlign__) self.ui.radioButton_NABD.clicked.connect(self.__enableAlign__)
self.ui.radioButton_custom.clicked.connect(self.__enableAlign__) self.ui.radioButton_custom.clicked.connect(self.__enableAlign__)
self.ui.radioButton_freqTHO.clicked.connect(self.__EstimateFrequencySelect__)
self.ui.radioButton_freqABD.clicked.connect(self.__EstimateFrequencySelect__)
@overrides @overrides
@ -300,6 +307,11 @@ class MainWindow_approximately_align(QMainWindow):
self.ui.radioButton_NABD.setText("备选4") self.ui.radioButton_NABD.setText("备选4")
self.ui.radioButton_NTHO.setText("备选2") self.ui.radioButton_NTHO.setText("备选2")
self.ui.spinBox_SelectEpoch.setMinimum(0) self.ui.spinBox_SelectEpoch.setMinimum(0)
self.ui.radioButton_freqABD.setChecked(False)
self.ui.radioButton_freqTHO.setChecked(False)
self.ui.radioButton_freqTHO.setText("备选1")
self.ui.radioButton_freqABD.setText("备选2")
def __plot__(self, *args, **kwargs): def __plot__(self, *args, **kwargs):
sender = self.sender() sender = self.sender()
@ -323,7 +335,7 @@ class MainWindow_approximately_align(QMainWindow):
elif sender == self.ui.radioButton_custom: elif sender == self.ui.radioButton_custom:
result = self.DrawPicTryAlign() result = self.DrawPicTryAlign()
elif sender == self.ui.pushButton_ChangeView: elif sender == self.ui.pushButton_ChangeView:
result = self.DrawAlignScatter() result = self.DrawAlignScatter(*args, **kwargs)
elif sender == self.ui.pushButton_JUMP: elif sender == self.ui.pushButton_JUMP:
result = self.DrawPicByEpoch(*args, **kwargs) result = self.DrawPicByEpoch(*args, **kwargs)
elif sender == self.ui.pushButton_EM1: elif sender == self.ui.pushButton_EM1:
@ -572,7 +584,39 @@ class MainWindow_approximately_align(QMainWindow):
# 绘图 # 绘图
PublicFunc.progressbar_update(self, 1, 1, Constants.DRAWING_DATA, 0) PublicFunc.progressbar_update(self, 1, 1, Constants.DRAWING_DATA, 0)
result = self.__plot__() response = self.data.get_corr_by_epoch()
epoch_min = response.data["epoch_min"]
epoch_max = response.data["epoch_max"]
tho_bias_list = response.data["tho_bias_list"]
abd_bias_list = response.data["abd_bias_list"]
response = self.data.estimate_frequency(tho_bias_list)
tho_y = response.data["estimate_y"]
tho_frequency = response.data["frequency"]
tho_slope = response.data["slope"]
tho_intercept = response.data["intercept"]
response = self.data.estimate_frequency(abd_bias_list)
abd_y = response.data["estimate_y"]
abd_frequency = response.data["frequency"]
abd_slope = response.data["slope"]
abd_intercept = response.data["intercept"]
result = self.__plot__(epoch_min, epoch_max, tho_bias_list, abd_bias_list, tho_y, abd_y,
tho_frequency, abd_frequency)
Config["estimate"] = {}
Config["estimate"]["tho_frequency"] = tho_frequency
Config["estimate"]["tho_slope"] = tho_slope
Config["estimate"]["tho_intercept"] = tho_intercept
Config["estimate"]["abd_frequency"] = abd_frequency
Config["estimate"]["abd_slope"] = abd_slope
Config["estimate"]["abd_intercept"] = abd_intercept
self.ui.radioButton_freqTHO.setText(str(Config["estimate"]["tho_frequency"]))
self.ui.radioButton_freqABD.setText(str(Config["estimate"]["abd_frequency"]))
ButtonState["Current"]["radioButton_freqTHO"] = True
ButtonState["Current"]["radioButton_freqABD"] = True
if not result.status: if not result.status:
PublicFunc.text_output(self.ui, "(1/1)" + result.info, Constants.TIPS_TYPE_ERROR) PublicFunc.text_output(self.ui, "(1/1)" + result.info, Constants.TIPS_TYPE_ERROR)
PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR) PublicFunc.msgbox_output(self, result.info, Constants.MSGBOX_TYPE_ERROR)
@ -601,6 +645,25 @@ class MainWindow_approximately_align(QMainWindow):
PublicFunc.finish_operation(self, ButtonState) PublicFunc.finish_operation(self, ButtonState)
def __EstimateFrequencySelect__(self):
PublicFunc.__disableAllButton__(self, ButtonState)
if self.ui.radioButton_freqTHO.isChecked():
frequency = Config["estimate"]["tho_frequency"]
Config["estimate_freq"] = frequency
Config["estimate_slope"] = Config["estimate"]["tho_slope"]
Config["estimate_intercept"] = Config["estimate"]["tho_intercept"]
elif self.ui.radioButton_freqABD.isChecked():
frequency = Config["estimate"]["abd_frequency"]
Config["estimate_freq"] = frequency
Config["estimate_slope"] = Config["estimate"]["abd_slope"]
Config["estimate_intercept"] = Config["estimate"]["abd_intercept"]
else:
return
ButtonState["Current"]["pushButton_save"] = True
PublicFunc.finish_operation(self, ButtonState)
def __EpochChange__(self): def __EpochChange__(self):
# 获取当前值 # 获取当前值
value = self.ui.spinBox_SelectEpoch.value() value = self.ui.spinBox_SelectEpoch.value()
@ -684,7 +747,6 @@ class MainWindow_approximately_align(QMainWindow):
ButtonState["Current"]["pushButton_EP1"] = True ButtonState["Current"]["pushButton_EP1"] = True
ButtonState["Current"]["pushButton_EP10"] = True ButtonState["Current"]["pushButton_EP10"] = True
ButtonState["Current"]["pushButton_EP100"] = True ButtonState["Current"]["pushButton_EP100"] = True
ButtonState["Current"]["pushButton_save"] = True
ButtonState["Current"]["pushButton_ChangeView"] = True ButtonState["Current"]["pushButton_ChangeView"] = True
PublicFunc.finish_operation(self, ButtonState) PublicFunc.finish_operation(self, ButtonState)
@ -888,21 +950,26 @@ class MainWindow_approximately_align(QMainWindow):
# 返回图片以便存到QPixImage # 返回图片以便存到QPixImage
return Result().success(info=Constants.DRAW_FINISHED) return Result().success(info=Constants.DRAW_FINISHED)
def DrawAlignScatter(self): def DrawAlignScatter(self, epoch_min, epoch_max, tho_bias_list, abd_bias_list, tho_y, abd_y,
tho_frequency, abd_frequency):
try: try:
response = self.data.get_corr_by_epoch()
epoch_min = response.data["epoch_min"]
epoch_max = response.data["epoch_max"]
tho_bias_list = response.data["tho_bias_list"]
abd_bias_list = response.data["abd_bias_list"]
ax1 = self.fig.add_subplot(211) ax1 = self.fig.add_subplot(211)
ax1.scatter(linspace(epoch_min, epoch_max, len(tho_bias_list)), tho_bias_list, alpha=0.2) ax1.scatter(linspace(epoch_min, epoch_max, len(tho_bias_list)), tho_bias_list, alpha=0.2)
ax1.plot(linspace(epoch_min, epoch_max, len(tho_bias_list)), tho_y, color='orange', label=f"THO Frequency: {tho_frequency} Hz")
ax1.axhline(y=0, color='red', linestyle='--', alpha=0.3)
ax1.set_xlabel("Epoch")
ax1.set_ylabel("Tho Bias / s")
ax1.set_title("THO") ax1.set_title("THO")
ax1.legend()
ax2 = self.fig.add_subplot(212) ax2 = self.fig.add_subplot(212)
ax2.scatter(linspace(epoch_min, epoch_max, len(abd_bias_list)), abd_bias_list, alpha=0.2) ax2.scatter(linspace(epoch_min, epoch_max, len(abd_bias_list)), abd_bias_list, alpha=0.2)
ax2.plot(linspace(epoch_min, epoch_max, len(abd_bias_list)), abd_y, color='orange', label=f"ABD Frequency: {abd_frequency} Hz")
ax2.axhline(y=0, color='red', linestyle='--', alpha=0.3)
ax2.set_xlabel("Epoch")
ax2.set_ylabel("Abd Bias / s")
ax2.set_title("ABD") ax2.set_title("ABD")
ax2.legend()
self.fig.canvas.draw() self.fig.canvas.draw()
return Result().success(info=Constants.DRAW_FINISHED) return Result().success(info=Constants.DRAW_FINISHED)
@ -924,8 +991,7 @@ class Data:
self.processed_downsample_orgBcg = None self.processed_downsample_orgBcg = None
self.processed_downsample_Tho = None self.processed_downsample_Tho = None
self.processed_downsample_Abd = None self.processed_downsample_Abd = None
self.relate_list = None
self.relate_point = None
def open_file(self): def open_file(self):
if Path(Config["Path"]["Input_orgBcg"]).is_file(): if Path(Config["Path"]["Input_orgBcg"]).is_file():
@ -974,8 +1040,18 @@ class Data:
try: try:
pos = Config["pos"] pos = Config["pos"]
ApplyFrequency = Config["ApplyFrequency"] ApplyFrequency = Config["ApplyFrequency"]
estimate_freq = Config["estimate_freq"]
estimate_slope = Config["estimate_slope"]
estimate_intercept = Config["estimate_intercept"]
# 保存到csv中 # 保存到csv中
df = DataFrame({"pos": [pos], "epoch": [epoch], "ApplyFrequency": [ApplyFrequency]}) df = DataFrame({"pos": [pos],
"epoch": [epoch],
"ApplyFrequency": [ApplyFrequency],
"estimate_freq": [estimate_freq],
"estimate_slope": [estimate_slope],
"estimate_intercept": [estimate_intercept]
})
df.to_csv(Path(Config["Path"]["Save"]), mode="w", header=True, index=False) df.to_csv(Path(Config["Path"]["Save"]), mode="w", header=True, index=False)
except PermissionError as e: except PermissionError as e:
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Save_Permission_Denied"]) return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Save_Permission_Denied"])
@ -1217,6 +1293,7 @@ class Data:
epoch_min = response.data["epoch_min"] epoch_min = response.data["epoch_min"]
epoch_max = response.data["epoch_max"] epoch_max = response.data["epoch_max"]
epoch_second = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["Second_PerEpoch"]
temp_freq = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["TempFrequency"] temp_freq = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["TempFrequency"]
window_epoch = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["CorrByEpoch"]["window_epoch"] window_epoch = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["CorrByEpoch"]["window_epoch"]
@ -1227,8 +1304,8 @@ class Data:
pos = Config["pos"] * temp_freq // Config["ApplyFrequency"] pos = Config["pos"] * temp_freq // Config["ApplyFrequency"]
for epoch in range(epoch_min, epoch_max): for epoch in range(epoch_min, epoch_max):
SP = epoch * 30 * temp_freq SP = epoch * epoch_second * temp_freq
EP = (epoch + window_epoch) * 30 * temp_freq EP = (epoch + window_epoch) * epoch_second * temp_freq
tho_seg = self.processed_Tho[SP:EP] tho_seg = self.processed_Tho[SP:EP]
abd_seg = self.processed_Abd[SP:EP] abd_seg = self.processed_Abd[SP:EP]
@ -1238,8 +1315,8 @@ class Data:
tho_seg_pos = argmax(tho_relate_seg) - len(orgBcg_seg) tho_seg_pos = argmax(tho_relate_seg) - len(orgBcg_seg)
abd_seg_pos = argmax(abd_relate_seg) - len(orgBcg_seg) abd_seg_pos = argmax(abd_relate_seg) - len(orgBcg_seg)
tho_bias_list.append(tho_seg_pos // temp_freq) tho_bias_list.append(tho_seg_pos / temp_freq)
abd_bias_list.append(abd_seg_pos // temp_freq) abd_bias_list.append(abd_seg_pos / temp_freq)
result = { result = {
"tho_bias_list": tho_bias_list, "tho_bias_list": tho_bias_list,
@ -1254,3 +1331,32 @@ class Data:
"Get_Corr_By_Epoch_Exception"] + "\n" + format_exc()) "Get_Corr_By_Epoch_Exception"] + "\n" + format_exc())
return Result().success(info=Constants.APPROXIMATELY_EPOCH_GET_FINISHED, data=result) return Result().success(info=Constants.APPROXIMATELY_EPOCH_GET_FINISHED, data=result)
@staticmethod
def estimate_frequency(bias_list):
try:
epoch_second = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["Second_PerEpoch"]
temp_freq = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["TempFrequency"]
# 生成线性数据
X = linspace(0, len(bias_list), len(bias_list)).reshape(-1, 1)
y = bias_list
theilsen = TheilSenRegressor()
theilsen.fit(X, y)
slope = theilsen.coef_[0]
frequency = 1 - slope / epoch_second / temp_freq if slope != 0 else float('inf')
theilsen_y = theilsen.predict(X)
return Result().success(info=Constants.APPROXIMATELY_ESTIMATE_FREQUENCY_FINISHED,
data={"estimate_y": theilsen_y,
"frequency": frequency,
"slope": slope,
"intercept": theilsen.intercept_},
)
except Exception as e:
return Result().failure(
info=Constants.APPROXIMATELY_ESTIMATE_FREQUENCY_FAILURE + Constants.FAILURE_REASON[
"Estimate_Frequency_Exception"] + "\n" + format_exc())

View File

@ -283,6 +283,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
sub_folders = [item.name for item in Path(path).iterdir() if item.is_dir()] sub_folders = [item.name for item in Path(path).iterdir() if item.is_dir()]
self.ui.comboBox_sampID.clear() self.ui.comboBox_sampID.clear()
self.ui.comboBox_sampID.addItems(sub_folders) self.ui.comboBox_sampID.addItems(sub_folders)
self.ui.comboBox_sampID.setCurrentIndex(0)
def check_root_path(self): def check_root_path(self):
if self.ui.plainTextEdit_root_path.toPlainText() == Constants.STRING_IS_EMPTY: if self.ui.plainTextEdit_root_path.toPlainText() == Constants.STRING_IS_EMPTY:

View File

@ -9,7 +9,8 @@ from PySide6.QtWidgets import QMessageBox, QMainWindow, QApplication, QButtonGro
from matplotlib import gridspec, patches from matplotlib import gridspec, patches
from matplotlib.backends.backend_qt import NavigationToolbar2QT from matplotlib.backends.backend_qt import NavigationToolbar2QT
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
from numpy import (diff, where, correlate, corrcoef, sum as np_sum, max as np_max, min as np_min, arange, array, from numpy import (diff, where, correlate, corrcoef, searchsorted, sum as np_sum, max as np_max, min as np_min, arange,
array,
append, delete, abs as np_abs, argmin as np_argmin, argmax as np_argmax, asarray) append, delete, abs as np_abs, argmin as np_argmin, argmax as np_argmax, asarray)
from overrides import overrides from overrides import overrides
from pandas import read_csv, DataFrame from pandas import read_csv, DataFrame
@ -25,7 +26,6 @@ from func.utils.Result import Result
from ui.MainWindow.MainWindow_precisely_align import Ui_MainWindow_precisely_align from ui.MainWindow.MainWindow_precisely_align import Ui_MainWindow_precisely_align
from ui.setting.precisely_align_input_setting import Ui_MainWindow_precisely_align_input_setting from ui.setting.precisely_align_input_setting import Ui_MainWindow_precisely_align_input_setting
Config = { Config = {
} }
@ -191,7 +191,8 @@ class SettingWindow(QMainWindow):
self.ui.plainTextEdit_file_path_input_Jpeak.setPlainText(Config["Path"]["Input_Jpeak"]) self.ui.plainTextEdit_file_path_input_Jpeak.setPlainText(Config["Path"]["Input_Jpeak"])
self.ui.plainTextEdit_file_path_input_ECG.setPlainText(Config["Path"]["Input_ECG"]) self.ui.plainTextEdit_file_path_input_ECG.setPlainText(Config["Path"]["Input_ECG"])
self.ui.plainTextEdit_file_path_input_Rpeak.setPlainText(Config["Path"]["Input_Rpeak"]) self.ui.plainTextEdit_file_path_input_Rpeak.setPlainText(Config["Path"]["Input_Rpeak"])
self.ui.plainTextEdit_file_path_input_approximately_align.setPlainText(Config["Path"]["Input_Approximately_Align"]) self.ui.plainTextEdit_file_path_input_approximately_align.setPlainText(
Config["Path"]["Input_Approximately_Align"])
self.ui.plainTextEdit_file_path_save_AlignInfo.setPlainText(Config["Path"]["Save_AlignInfo"]) self.ui.plainTextEdit_file_path_save_AlignInfo.setPlainText(Config["Path"]["Save_AlignInfo"])
self.ui.plainTextEdit_file_path_save_orgBcg.setPlainText(Config["Path"]["Save_OrgBCG"]) self.ui.plainTextEdit_file_path_save_orgBcg.setPlainText(Config["Path"]["Save_OrgBCG"])
self.ui.plainTextEdit_file_path_save_BCG.setPlainText(Config["Path"]["Save_BCG"]) self.ui.plainTextEdit_file_path_save_BCG.setPlainText(Config["Path"]["Save_BCG"])
@ -209,7 +210,8 @@ class SettingWindow(QMainWindow):
Config["Path"]["Input_Jpeak"] = self.ui.plainTextEdit_file_path_input_Jpeak.toPlainText() Config["Path"]["Input_Jpeak"] = self.ui.plainTextEdit_file_path_input_Jpeak.toPlainText()
Config["Path"]["Input_ECG"] = self.ui.plainTextEdit_file_path_input_ECG.toPlainText() Config["Path"]["Input_ECG"] = self.ui.plainTextEdit_file_path_input_ECG.toPlainText()
Config["Path"]["Input_Rpeak"] = self.ui.plainTextEdit_file_path_input_Rpeak.toPlainText() Config["Path"]["Input_Rpeak"] = self.ui.plainTextEdit_file_path_input_Rpeak.toPlainText()
Config["Path"]["Input_Approximately_Align"] = self.ui.plainTextEdit_file_path_input_approximately_align.toPlainText() Config["Path"][
"Input_Approximately_Align"] = self.ui.plainTextEdit_file_path_input_approximately_align.toPlainText()
Config["Path"]["Save_AlignInfo"] = self.ui.plainTextEdit_file_path_save_AlignInfo.toPlainText() Config["Path"]["Save_AlignInfo"] = self.ui.plainTextEdit_file_path_save_AlignInfo.toPlainText()
Config["Path"]["Save_OrgBCG"] = self.ui.plainTextEdit_file_path_save_orgBcg.toPlainText() Config["Path"]["Save_OrgBCG"] = self.ui.plainTextEdit_file_path_save_orgBcg.toPlainText()
Config["Path"]["Save_BCG"] = self.ui.plainTextEdit_file_path_save_BCG.toPlainText() Config["Path"]["Save_BCG"] = self.ui.plainTextEdit_file_path_save_BCG.toPlainText()
@ -453,7 +455,8 @@ class MainWindow_precisely_align(QMainWindow):
self.ax1.axvline(x=self.data.approximately_align_pos, color=Constants.PLOT_COLOR_BLACK, linestyle="--", self.ax1.axvline(x=self.data.approximately_align_pos, color=Constants.PLOT_COLOR_BLACK, linestyle="--",
label="Start Line") label="Start Line")
else: else:
self.ax0.axvline(x=self.data.approximately_align_pos, color=Constants.PLOT_COLOR_BLACK, linestyle="--", label="Start Line") self.ax0.axvline(x=self.data.approximately_align_pos, color=Constants.PLOT_COLOR_BLACK, linestyle="--",
label="Start Line")
self.ax1.axvline(x=self.data.approximately_align_pos, color=Constants.PLOT_COLOR_BLACK, linestyle="--", self.ax1.axvline(x=self.data.approximately_align_pos, color=Constants.PLOT_COLOR_BLACK, linestyle="--",
label="Start Line") label="Start Line")
@ -461,7 +464,8 @@ class MainWindow_precisely_align(QMainWindow):
self.ax1.legend(loc=Constants.PLOT_UPPER_RIGHT) self.ax1.legend(loc=Constants.PLOT_UPPER_RIGHT)
self.canvas.draw() self.canvas.draw()
return Result().success(info=Constants.DRAW_FINISHED) return Result().success(info=Constants.DRAW_FINISHED)
elif sender == self.ui.pushButton_calculate_correlation and plot_element is not None and plot_element["mode"] == "init": elif sender == self.ui.pushButton_calculate_correlation and plot_element is not None and plot_element[
"mode"] == "init":
self.gs = gridspec.GridSpec(2, 2, height_ratios=[1, 1], width_ratios=[1, 1]) self.gs = gridspec.GridSpec(2, 2, height_ratios=[1, 1], width_ratios=[1, 1])
self.fig.subplots_adjust(top=0.88, bottom=0.05, right=0.98, left=0.05, hspace=0.15, wspace=0.15) self.fig.subplots_adjust(top=0.88, bottom=0.05, right=0.98, left=0.05, hspace=0.15, wspace=0.15)
self.ax0 = self.fig.add_subplot(self.gs[0]) self.ax0 = self.fig.add_subplot(self.gs[0])
@ -487,7 +491,8 @@ class MainWindow_precisely_align(QMainWindow):
self.ax0.stem(plot_element["front"]["corre"], markerfmt="C0.", self.ax0.stem(plot_element["front"]["corre"], markerfmt="C0.",
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_CORRE_RRIV_JJIV) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_CORRE_RRIV_JJIV)
self.selected_point0, = self.ax0.plot(plot_element["front"]["shift"], self.selected_point0, = self.ax0.plot(plot_element["front"]["shift"],
plot_element["front"]["corre"][plot_element["front"]["shift"]] + 1, 'v', plot_element["front"]["corre"][plot_element["front"]["shift"]] + 1,
'v',
color=Constants.PLOT_COLOR_RED, picker=True, pickradius=5, color=Constants.PLOT_COLOR_RED, picker=True, pickradius=5,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT)
self.ax0.plot(plot_element["front"]["corre"], 'o', color=Constants.PLOT_COLOR_BLUE, self.ax0.plot(plot_element["front"]["corre"], 'o', color=Constants.PLOT_COLOR_BLUE,
@ -495,8 +500,10 @@ class MainWindow_precisely_align(QMainWindow):
self.ax1.stem(plot_element["front"]["RRIVs"], markerfmt="b.", linefmt=Constants.PLOT_COLOR_ORANGE, self.ax1.stem(plot_element["front"]["RRIVs"], markerfmt="b.", linefmt=Constants.PLOT_COLOR_ORANGE,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RRIV) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RRIV)
self.stem_black0 = self.ax1.stem(arange(plot_element["front"]["shift"], self.stem_black0 = self.ax1.stem(arange(plot_element["front"]["shift"],
plot_element["front"]["shift"] + len(plot_element["front"]["JJIVs"])), plot_element["front"]["shift"] + len(
plot_element["front"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN, plot_element["front"]["JJIVs"])),
plot_element["front"]["JJIVs"], markerfmt="ko",
linefmt=Constants.PLOT_COLOR_GREEN,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
self.ax2.set_title( self.ax2.set_title(
"back\ncorre_IIV: {}, corre_II: {}\nsame_sign_rate:{}, total_time_ratio: {}\nshift: {}, alignment offset: {} seconds\noffset_interval: {}, anchor_J: {}, anchor_R: {}".format( "back\ncorre_IIV: {}, corre_II: {}\nsame_sign_rate:{}, total_time_ratio: {}\nshift: {}, alignment offset: {} seconds\noffset_interval: {}, anchor_J: {}, anchor_R: {}".format(
@ -517,7 +524,8 @@ class MainWindow_precisely_align(QMainWindow):
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RRIV) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RRIV)
self.stem_black1 = self.ax3.stem(arange(plot_element["back"]["shift"], self.stem_black1 = self.ax3.stem(arange(plot_element["back"]["shift"],
plot_element["back"]["shift"] + len(plot_element["back"]["JJIVs"])), plot_element["back"]["shift"] + len(plot_element["back"]["JJIVs"])),
plot_element["back"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN, plot_element["back"]["JJIVs"], markerfmt="ko",
linefmt=Constants.PLOT_COLOR_GREEN,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
self.ax0.legend(loc=Constants.PLOT_UPPER_RIGHT) self.ax0.legend(loc=Constants.PLOT_UPPER_RIGHT)
@ -527,7 +535,8 @@ class MainWindow_precisely_align(QMainWindow):
self.canvas.draw() self.canvas.draw()
return Result().success(info=Constants.DRAW_FINISHED) return Result().success(info=Constants.DRAW_FINISHED)
elif sender == self.ui.pushButton_correlation_align or (plot_element is not None and plot_element["mode"] == "select"): elif sender == self.ui.pushButton_correlation_align or (
plot_element is not None and plot_element["mode"] == "select"):
self.gs = gridspec.GridSpec(1, 1, height_ratios=[1]) self.gs = gridspec.GridSpec(1, 1, height_ratios=[1])
self.fig.subplots_adjust(top=0.95, bottom=0.05, right=0.98, left=0.05, hspace=0, wspace=0) self.fig.subplots_adjust(top=0.95, bottom=0.05, right=0.98, left=0.05, hspace=0, wspace=0)
self.ax4 = self.fig.add_subplot(self.gs[0]) self.ax4 = self.fig.add_subplot(self.gs[0])
@ -535,14 +544,20 @@ class MainWindow_precisely_align(QMainWindow):
self.ax4.xaxis.set_major_formatter(Params.FORMATTER) self.ax4.xaxis.set_major_formatter(Params.FORMATTER)
self.ax4.set_title("offset correct") self.ax4.set_title("offset correct")
self.ax4.plot(plot_element["cut_ECG"], color=Constants.PLOT_COLOR_GREEN, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_ECG) self.ax4.plot(plot_element["cut_ECG"], color=Constants.PLOT_COLOR_GREEN,
self.ax4.plot(plot_element["res_BCG"], color=Constants.PLOT_COLOR_ORANGE, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_BCG) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_ECG)
self.ax4.plot([plot_element["anchor00"], plot_element["anchor00"]], [plot_element["b"], plot_element["a"]], 'k--') self.ax4.plot(plot_element["res_BCG"], color=Constants.PLOT_COLOR_ORANGE,
self.ax4.plot([plot_element["anchor10"], plot_element["anchor10"]], [plot_element["b"], plot_element["a"]], 'k--') label=Constants.PRECISELY_ALIGN_PLOT_LABEL_BCG)
self.ax4.plot([plot_element["anchor00"], plot_element["anchor00"]], [plot_element["b"], plot_element["a"]],
'k--')
self.ax4.plot([plot_element["anchor10"], plot_element["anchor10"]], [plot_element["b"], plot_element["a"]],
'k--')
self.point0, = self.ax4.plot(plot_element["peak_ECG"], plot_element["cut_ECG"][plot_element["peak_ECG"]], self.point0, = self.ax4.plot(plot_element["peak_ECG"], plot_element["cut_ECG"][plot_element["peak_ECG"]],
'o', markersize=3, color=Constants.PLOT_COLOR_BLUE, picker=True, pickradius=5, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RPEAK) 'o', markersize=3, color=Constants.PLOT_COLOR_BLUE, picker=True, pickradius=5,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RPEAK)
self.point1, = self.ax4.plot(plot_element["peak_BCG"], plot_element["res_BCG"][plot_element["peak_BCG"]], self.point1, = self.ax4.plot(plot_element["peak_BCG"], plot_element["res_BCG"][plot_element["peak_BCG"]],
'o', markersize=3, color=Constants.PLOT_COLOR_RED, picker=True, pickradius=5, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JPEAK) 'o', markersize=3, color=Constants.PLOT_COLOR_RED, picker=True, pickradius=5,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JPEAK)
self.ax4.legend(loc=Constants.PLOT_UPPER_RIGHT) self.ax4.legend(loc=Constants.PLOT_UPPER_RIGHT)
@ -556,10 +571,14 @@ class MainWindow_precisely_align(QMainWindow):
self.ax4.xaxis.set_major_formatter(Params.FORMATTER) self.ax4.xaxis.set_major_formatter(Params.FORMATTER)
self.ax4.set_title("result preview") self.ax4.set_title("result preview")
self.ax4.plot(self.data.cut_ECG, color=Constants.PLOT_COLOR_GREEN, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_ECG) self.ax4.plot(self.data.cut_ECG, color=Constants.PLOT_COLOR_GREEN,
self.ax4.plot(self.data.res_BCG, color=Constants.PLOT_COLOR_ORANGE, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_BCG) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_ECG)
self.ax4.plot(self.data.cut_Rpeak, self.data.cut_ECG[self.data.cut_Rpeak], 'v', color=Constants.PLOT_COLOR_BLUE, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RPEAK) self.ax4.plot(self.data.res_BCG, color=Constants.PLOT_COLOR_ORANGE,
self.ax4.plot(self.data.cut_Jpeak, self.data.res_BCG[self.data.cut_Jpeak], 'v', color=Constants.PLOT_COLOR_RED, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JPEAK) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_BCG)
self.ax4.plot(self.data.cut_Rpeak, self.data.cut_ECG[self.data.cut_Rpeak], 'v',
color=Constants.PLOT_COLOR_BLUE, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RPEAK)
self.ax4.plot(self.data.cut_Jpeak, self.data.res_BCG[self.data.cut_Jpeak], 'v',
color=Constants.PLOT_COLOR_RED, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JPEAK)
self.ax4.legend(loc=Constants.PLOT_UPPER_RIGHT) self.ax4.legend(loc=Constants.PLOT_UPPER_RIGHT)
@ -929,7 +948,8 @@ class MainWindow_precisely_align(QMainWindow):
try: try:
if self.data is not None: if self.data is not None:
if self.data.Jpeak is None or self.data.Rpeak is None: if self.data.Jpeak is None or self.data.Rpeak is None:
PublicFunc.msgbox_output(self, Constants.FAILURE_REASON["Data_Not_Exist"], Constants.MSGBOX_TYPE_ERROR) PublicFunc.msgbox_output(self, Constants.FAILURE_REASON["Data_Not_Exist"],
Constants.MSGBOX_TYPE_ERROR)
return return
sender = self.sender() sender = self.sender()
@ -946,6 +966,31 @@ class MainWindow_precisely_align(QMainWindow):
Config["IV_Coordinate"]["BCG_front_2"] = self.ui.spinBox_BCG_front_JJIV_2.value() Config["IV_Coordinate"]["BCG_front_2"] = self.ui.spinBox_BCG_front_JJIV_2.value()
Config["Coordinate"]["BCG_front_2"] = self.data.Jpeak[:-2][self.ui.spinBox_BCG_front_JJIV_2.value()] Config["Coordinate"]["BCG_front_2"] = self.data.Jpeak[:-2][self.ui.spinBox_BCG_front_JJIV_2.value()]
self.ui.spinBox_BCG_front_Signal_2.setValue(Config["Coordinate"]["BCG_front_2"]) self.ui.spinBox_BCG_front_Signal_2.setValue(Config["Coordinate"]["BCG_front_2"])
estimate_ECG_front_1 = self.data.get_corresponding_interval(Config["Coordinate"]["BCG_front_1"]).data[
"new_point"]
estimate_ECG_front_2 = self.data.get_corresponding_interval(Config["Coordinate"]["BCG_front_2"]).data[
"new_point"]
PublicFunc.text_output(self.ui, Constants.CORRESPONDING_INTERVAL_PROMOTE_TEMPLATE.format(
Config["Coordinate"]["BCG_front_1"],
Config["Coordinate"]["BCG_front_2"],
estimate_ECG_front_1, estimate_ECG_front_2
), Constants.TIPS_TYPE_INFO)
if self.ui.checkBox_ECG_autoset.isChecked():
extend_second = int(self.ui.spinBox_ECG_expend_second.value())
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_front_1, extend_second, "right").data
Config["IV_Coordinate"]["ECG_front_1"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_front_1"] = reponse["extend_point"]
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_front_2, extend_second, "left").data
Config["IV_Coordinate"]["ECG_front_2"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_front_2"] = reponse["extend_point"]
elif sender == self.ui.spinBox_BCG_back_JJIV_1: elif sender == self.ui.spinBox_BCG_back_JJIV_1:
if self.ui.spinBox_BCG_back_JJIV_1.value() >= len(self.data.Jpeak[:-2]): if self.ui.spinBox_BCG_back_JJIV_1.value() >= len(self.data.Jpeak[:-2]):
self.ui.spinBox_BCG_back_JJIV_1.setValue(len(self.data.Jpeak[:-2]) - 1) self.ui.spinBox_BCG_back_JJIV_1.setValue(len(self.data.Jpeak[:-2]) - 1)
@ -958,6 +1003,30 @@ class MainWindow_precisely_align(QMainWindow):
Config["IV_Coordinate"]["BCG_back_2"] = self.ui.spinBox_BCG_back_JJIV_2.value() Config["IV_Coordinate"]["BCG_back_2"] = self.ui.spinBox_BCG_back_JJIV_2.value()
Config["Coordinate"]["BCG_back_2"] = self.data.Jpeak[:-2][self.ui.spinBox_BCG_back_JJIV_2.value()] Config["Coordinate"]["BCG_back_2"] = self.data.Jpeak[:-2][self.ui.spinBox_BCG_back_JJIV_2.value()]
self.ui.spinBox_BCG_back_Signal_2.setValue(Config["Coordinate"]["BCG_back_2"]) self.ui.spinBox_BCG_back_Signal_2.setValue(Config["Coordinate"]["BCG_back_2"])
estimate_ECG_back_1 = self.data.get_corresponding_interval(
Config["Coordinate"]["BCG_back_1"]).data["new_point"]
estimate_ECG_back_2 = self.data.get_corresponding_interval(
Config["Coordinate"]["BCG_back_2"]).data["new_point"]
PublicFunc.text_output(self.ui, Constants.CORRESPONDING_INTERVAL_PROMOTE_TEMPLATE.format(
Config["Coordinate"]["BCG_back_1"],
Config["Coordinate"]["BCG_back_2"],
estimate_ECG_back_1, estimate_ECG_back_2
), Constants.TIPS_TYPE_INFO)
if self.ui.checkBox_ECG_autoset.isChecked():
extend_second = int(self.ui.spinBox_ECG_expend_second.value())
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_back_1, extend_second, "right").data
Config["IV_Coordinate"]["ECG_back_1"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_back_1"] = reponse["extend_point"]
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_back_2, extend_second, "left").data
Config["IV_Coordinate"]["ECG_back_2"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_back_2"] = reponse["extend_point"]
elif sender == self.ui.spinBox_ECG_front_RRIV_1: elif sender == self.ui.spinBox_ECG_front_RRIV_1:
if self.ui.spinBox_ECG_front_RRIV_1.value() >= len(self.data.Rpeak[:-2]): if self.ui.spinBox_ECG_front_RRIV_1.value() >= len(self.data.Rpeak[:-2]):
self.ui.spinBox_ECG_front_RRIV_1.setValue(len(self.data.Rpeak[:-2]) - 1) self.ui.spinBox_ECG_front_RRIV_1.setValue(len(self.data.Rpeak[:-2]) - 1)
@ -970,6 +1039,8 @@ class MainWindow_precisely_align(QMainWindow):
Config["IV_Coordinate"]["ECG_front_2"] = self.ui.spinBox_ECG_front_RRIV_2.value() Config["IV_Coordinate"]["ECG_front_2"] = self.ui.spinBox_ECG_front_RRIV_2.value()
Config["Coordinate"]["ECG_front_2"] = self.data.Rpeak[:-2][self.ui.spinBox_ECG_front_RRIV_2.value()] Config["Coordinate"]["ECG_front_2"] = self.data.Rpeak[:-2][self.ui.spinBox_ECG_front_RRIV_2.value()]
self.ui.spinBox_ECG_front_Signal_2.setValue(Config["Coordinate"]["ECG_front_2"]) self.ui.spinBox_ECG_front_Signal_2.setValue(Config["Coordinate"]["ECG_front_2"])
elif sender == self.ui.spinBox_ECG_back_RRIV_1: elif sender == self.ui.spinBox_ECG_back_RRIV_1:
if self.ui.spinBox_ECG_back_RRIV_1.value() >= len(self.data.Rpeak[:-2]): if self.ui.spinBox_ECG_back_RRIV_1.value() >= len(self.data.Rpeak[:-2]):
self.ui.spinBox_ECG_back_RRIV_1.setValue(len(self.data.Rpeak[:-2]) - 1) self.ui.spinBox_ECG_back_RRIV_1.setValue(len(self.data.Rpeak[:-2]) - 1)
@ -982,7 +1053,9 @@ class MainWindow_precisely_align(QMainWindow):
Config["IV_Coordinate"]["ECG_back_2"] = self.ui.spinBox_ECG_back_RRIV_2.value() Config["IV_Coordinate"]["ECG_back_2"] = self.ui.spinBox_ECG_back_RRIV_2.value()
Config["Coordinate"]["ECG_back_2"] = self.data.Rpeak[:-2][self.ui.spinBox_ECG_back_RRIV_2.value()] Config["Coordinate"]["ECG_back_2"] = self.data.Rpeak[:-2][self.ui.spinBox_ECG_back_RRIV_2.value()]
self.ui.spinBox_ECG_back_Signal_2.setValue(Config["Coordinate"]["ECG_back_2"]) self.ui.spinBox_ECG_back_Signal_2.setValue(Config["Coordinate"]["ECG_back_2"])
except AttributeError:
except AttributeError as e:
print(e)
pass pass
def reset_axes(self): def reset_axes(self):
@ -1039,12 +1112,15 @@ class MainWindow_precisely_align(QMainWindow):
plot_element["back"]["offset_interval"], plot_element["back"]["anchor_J"], plot_element["back"]["offset_interval"], plot_element["back"]["anchor_J"],
plot_element["back"]["anchor_R"])) plot_element["back"]["anchor_R"]))
self.selected_point0, = self.ax0.plot(plot_element["front"]["shift"], self.selected_point0, = self.ax0.plot(plot_element["front"]["shift"],
plot_element["front"]["corre"][plot_element["front"]["shift"]] + 1, 'v', plot_element["front"]["corre"][plot_element["front"]["shift"]] + 1,
'v',
color=Constants.PLOT_COLOR_RED, picker=True, pickradius=5, color=Constants.PLOT_COLOR_RED, picker=True, pickradius=5,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT)
self.stem_black0 = self.ax1.stem(arange(plot_element["front"]["shift"], self.stem_black0 = self.ax1.stem(arange(plot_element["front"]["shift"],
plot_element["front"]["shift"] + len(plot_element["front"]["JJIVs"])), plot_element["front"]["shift"] + len(
plot_element["front"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN, plot_element["front"]["JJIVs"])),
plot_element["front"]["JJIVs"], markerfmt="ko",
linefmt=Constants.PLOT_COLOR_GREEN,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
self.selected_point1, = self.ax2.plot(plot_element["back"]["shift"], self.selected_point1, = self.ax2.plot(plot_element["back"]["shift"],
plot_element["back"]["corre"][plot_element["back"]["shift"]] + 1, 'v', plot_element["back"]["corre"][plot_element["back"]["shift"]] + 1, 'v',
@ -1052,7 +1128,8 @@ class MainWindow_precisely_align(QMainWindow):
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT)
self.stem_black1 = self.ax3.stem(arange(plot_element["back"]["shift"], self.stem_black1 = self.ax3.stem(arange(plot_element["back"]["shift"],
plot_element["back"]["shift"] + len(plot_element["back"]["JJIVs"])), plot_element["back"]["shift"] + len(plot_element["back"]["JJIVs"])),
plot_element["back"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN, plot_element["back"]["JJIVs"], markerfmt="ko",
linefmt=Constants.PLOT_COLOR_GREEN,
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV) label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
self.ax0.autoscale(False) self.ax0.autoscale(False)
@ -1084,16 +1161,20 @@ class MainWindow_precisely_align(QMainWindow):
if len(self.data.correlation_align_point_match_ECG) > 0: if len(self.data.correlation_align_point_match_ECG) > 0:
self.selected_point0, = self.ax4.plot( self.selected_point0, = self.ax4.plot(
[self.data.correlation_align_point_match_ECG[0], self.data.correlation_align_point_match_ECG[0]], [plot_element["b"], plot_element["a"]], 'b--') [self.data.correlation_align_point_match_ECG[0], self.data.correlation_align_point_match_ECG[0]],
[plot_element["b"], plot_element["a"]], 'b--')
if len(self.data.correlation_align_point_match_ECG) == 2: if len(self.data.correlation_align_point_match_ECG) == 2:
self.selected_point1, = self.ax4.plot( self.selected_point1, = self.ax4.plot(
[self.data.correlation_align_point_match_ECG[1], self.data.correlation_align_point_match_ECG[1]], [plot_element["b"], plot_element["a"]], 'b--') [self.data.correlation_align_point_match_ECG[1],
self.data.correlation_align_point_match_ECG[1]], [plot_element["b"], plot_element["a"]], 'b--')
if len(self.data.correlation_align_point_match_BCG) > 0: if len(self.data.correlation_align_point_match_BCG) > 0:
self.selected_point2, = self.ax4.plot( self.selected_point2, = self.ax4.plot(
[self.data.correlation_align_point_match_BCG[0], self.data.correlation_align_point_match_BCG[0]], [plot_element["b"], plot_element["a"]], 'r--') [self.data.correlation_align_point_match_BCG[0], self.data.correlation_align_point_match_BCG[0]],
[plot_element["b"], plot_element["a"]], 'r--')
if len(self.data.correlation_align_point_match_BCG) == 2: if len(self.data.correlation_align_point_match_BCG) == 2:
self.selected_point3, = self.ax4.plot( self.selected_point3, = self.ax4.plot(
[self.data.correlation_align_point_match_BCG[1], self.data.correlation_align_point_match_BCG[1]], [plot_element["b"], plot_element["a"]], 'r--') [self.data.correlation_align_point_match_BCG[1],
self.data.correlation_align_point_match_BCG[1]], [plot_element["b"], plot_element["a"]], 'r--')
self.ax4.autoscale(False) self.ax4.autoscale(False)
self.ax4.set_xlim(self.ax4_xlime) self.ax4.set_xlim(self.ax4_xlime)
@ -1243,11 +1324,64 @@ class MainWindow_precisely_align(QMainWindow):
Config["IV_Coordinate"]["BCG_front_2"] = indices[-1] Config["IV_Coordinate"]["BCG_front_2"] = indices[-1]
Config["Coordinate"]["BCG_front_1"] = self.data.Jpeak[:-2][indices[0]] Config["Coordinate"]["BCG_front_1"] = self.data.Jpeak[:-2][indices[0]]
Config["Coordinate"]["BCG_front_2"] = self.data.Jpeak[:-2][indices[-1]] Config["Coordinate"]["BCG_front_2"] = self.data.Jpeak[:-2][indices[-1]]
estimate_ECG_front_1 = self.data.get_corresponding_interval(
Config["Coordinate"]["BCG_front_1"]).data["new_point"]
estimate_ECG_front_2 = self.data.get_corresponding_interval(
Config["Coordinate"]["BCG_front_2"]).data["new_point"]
PublicFunc.text_output(
self.ui,
Constants.CORRESPONDING_INTERVAL_PROMOTE_TEMPLATE.format(
Config["Coordinate"]["BCG_front_1"],
Config["Coordinate"]["BCG_front_2"],
estimate_ECG_front_1, estimate_ECG_front_2
), Constants.TIPS_TYPE_INFO)
if self.ui.checkBox_ECG_autoset.isChecked():
extend_second = int(self.ui.spinBox_ECG_expend_second.value())
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_front_1, extend_second, "right").data
Config["IV_Coordinate"]["ECG_front_1"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_front_1"] = reponse["extend_point"]
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_front_2, extend_second, "left").data
Config["IV_Coordinate"]["ECG_front_2"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_front_2"] = reponse["extend_point"]
elif self.ui.radioButton_BCG_back.isChecked(): elif self.ui.radioButton_BCG_back.isChecked():
Config["IV_Coordinate"]["BCG_back_1"] = indices[0] Config["IV_Coordinate"]["BCG_back_1"] = indices[0]
Config["IV_Coordinate"]["BCG_back_2"] = indices[-1] Config["IV_Coordinate"]["BCG_back_2"] = indices[-1]
Config["Coordinate"]["BCG_back_1"] = self.data.Jpeak[:-2][indices[0]] Config["Coordinate"]["BCG_back_1"] = self.data.Jpeak[:-2][indices[0]]
Config["Coordinate"]["BCG_back_2"] = self.data.Jpeak[:-2][indices[-1]] Config["Coordinate"]["BCG_back_2"] = self.data.Jpeak[:-2][indices[-1]]
estimate_ECG_back_1 = self.data.get_corresponding_interval(
Config["Coordinate"]["BCG_back_1"]).data["new_point"]
estimate_ECG_back_2 = self.data.get_corresponding_interval(
Config["Coordinate"]["BCG_back_2"]).data["new_point"]
PublicFunc.text_output(
self.ui, Constants.CORRESPONDING_INTERVAL_PROMOTE_TEMPLATE.format(
Config["Coordinate"]["BCG_back_1"],
Config["Coordinate"]["BCG_back_2"],
estimate_ECG_back_1, estimate_ECG_back_2
), Constants.TIPS_TYPE_INFO)
if self.ui.checkBox_ECG_autoset.isChecked():
extend_second = int(self.ui.spinBox_ECG_expend_second.value())
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_back_1, extend_second, "right").data
Config["IV_Coordinate"]["ECG_back_1"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_back_1"] = reponse["extend_point"]
reponse = self.data.get_rriv_from_ecg_point(
estimate_ECG_back_2, extend_second, "left").data
Config["IV_Coordinate"]["ECG_back_2"] = reponse["estimate_RRIV"]
Config["Coordinate"]["ECG_back_2"] = reponse["extend_point"]
elif self.ui.radioButton_ECG_front.isChecked() or self.ui.radioButton_ECG_back.isChecked(): elif self.ui.radioButton_ECG_front.isChecked() or self.ui.radioButton_ECG_back.isChecked():
if rect_left < 0: if rect_left < 0:
rect_left = 0 rect_left = 0
@ -1279,6 +1413,7 @@ class MainWindow_precisely_align(QMainWindow):
Config["IV_Coordinate"]["ECG_front_2"] = indices[-1] Config["IV_Coordinate"]["ECG_front_2"] = indices[-1]
Config["Coordinate"]["ECG_front_1"] = self.data.Rpeak[:-2][indices[0]] Config["Coordinate"]["ECG_front_1"] = self.data.Rpeak[:-2][indices[0]]
Config["Coordinate"]["ECG_front_2"] = self.data.Rpeak[:-2][indices[-1]] Config["Coordinate"]["ECG_front_2"] = self.data.Rpeak[:-2][indices[-1]]
elif self.ui.radioButton_ECG_back.isChecked(): elif self.ui.radioButton_ECG_back.isChecked():
Config["IV_Coordinate"]["ECG_back_1"] = indices[0] Config["IV_Coordinate"]["ECG_back_1"] = indices[0]
Config["IV_Coordinate"]["ECG_back_2"] = indices[-1] Config["IV_Coordinate"]["ECG_back_2"] = indices[-1]
@ -1364,15 +1499,21 @@ class MainWindow_precisely_align(QMainWindow):
if this_line == self.point0: if this_line == self.point0:
if nm in self.data.correlation_align_point_match_ECG: if nm in self.data.correlation_align_point_match_ECG:
self.data.correlation_align_point_match_ECG = delete(self.data.correlation_align_point_match_ECG, self.data.correlation_align_point_match_ECG = delete(self.data.correlation_align_point_match_ECG,
where(self.data.correlation_align_point_match_ECG == nm)[0]) where(
self.data.correlation_align_point_match_ECG == nm)[
0])
elif len(self.data.correlation_align_point_match_ECG) < 2: elif len(self.data.correlation_align_point_match_ECG) < 2:
self.data.correlation_align_point_match_ECG = append(self.data.correlation_align_point_match_ECG, nm) self.data.correlation_align_point_match_ECG = append(self.data.correlation_align_point_match_ECG,
nm)
elif this_line == self.point1: elif this_line == self.point1:
if nm in self.data.correlation_align_point_match_BCG: if nm in self.data.correlation_align_point_match_BCG:
self.data.correlation_align_point_match_BCG = delete(self.data.correlation_align_point_match_BCG, self.data.correlation_align_point_match_BCG = delete(self.data.correlation_align_point_match_BCG,
where(self.data.correlation_align_point_match_BCG == nm)[0]) where(
self.data.correlation_align_point_match_BCG == nm)[
0])
elif len(self.data.correlation_align_point_match_BCG) < 2: elif len(self.data.correlation_align_point_match_BCG) < 2:
self.data.correlation_align_point_match_BCG = append(self.data.correlation_align_point_match_BCG, nm) self.data.correlation_align_point_match_BCG = append(self.data.correlation_align_point_match_BCG,
nm)
else: else:
raise ValueError("this_line不存在") raise ValueError("this_line不存在")
self.__slot_btn_correlation_align__() self.__slot_btn_correlation_align__()
@ -1389,6 +1530,9 @@ class Data:
self.Rpeak = None self.Rpeak = None
self.Rpeak_y = None self.Rpeak_y = None
self.approximately_align_pos = None self.approximately_align_pos = None
self.approximately_align_estimated_freq = None
self.approximately_align_slope = None
self.approximately_align_intercept = None
self.BCG_early = None self.BCG_early = None
self.res_orgBcg = None self.res_orgBcg = None
@ -1528,6 +1672,12 @@ class Data:
else: else:
self.approximately_align_pos = 0 self.approximately_align_pos = 0
self.BCG_early = None self.BCG_early = None
self.approximately_align_estimated_freq = df["estimate_freq"].values[-1]
self.approximately_align_slope = df["estimate_slope"].values[-1] / \
Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["Second_PerEpoch"]
self.approximately_align_intercept = df["estimate_intercept"].values[-1] * Config["InputConfig"]["UseFreq"]
except Exception: except Exception:
self.approximately_align_pos = 0 self.approximately_align_pos = 0
@ -1541,7 +1691,8 @@ class Data:
if Config["InputConfig"]["orgBcgFreq"] != Config["InputConfig"]["UseFreq"]: if Config["InputConfig"]["orgBcgFreq"] != Config["InputConfig"]["UseFreq"]:
self.raw_orgBcg = resample(self.raw_orgBcg, self.raw_orgBcg = resample(self.raw_orgBcg,
int(len(self.raw_orgBcg) * int(len(self.raw_orgBcg) *
(Config["InputConfig"]["UseFreq"] / Config["InputConfig"]["orgBcgFreq"]))) (Config["InputConfig"]["UseFreq"] / Config["InputConfig"][
"orgBcgFreq"])))
else: else:
return Result().success(info=Constants.RESAMPLE_NO_NEED) return Result().success(info=Constants.RESAMPLE_NO_NEED)
except Exception as e: except Exception as e:
@ -1581,8 +1732,10 @@ class Data:
try: try:
if mode == "init": if mode == "init":
self.JJIs0_front = self.JJIs[Config["IV_Coordinate"]["BCG_front_1"]:Config["IV_Coordinate"]["BCG_front_2"]] self.JJIs0_front = self.JJIs[
self.RRIs0_front = self.RRIs[Config["IV_Coordinate"]["ECG_front_1"]:Config["IV_Coordinate"]["ECG_front_2"]] Config["IV_Coordinate"]["BCG_front_1"]:Config["IV_Coordinate"]["BCG_front_2"]]
self.RRIs0_front = self.RRIs[
Config["IV_Coordinate"]["ECG_front_1"]:Config["IV_Coordinate"]["ECG_front_2"]]
self.JJIVs_front = diff(self.JJIs0_front) self.JJIVs_front = diff(self.JJIs0_front)
self.RRIVs_front = diff(self.RRIs0_front) self.RRIVs_front = diff(self.RRIs0_front)
self.corre_front = correlate(self.RRIVs_front, self.JJIVs_front, 'valid') self.corre_front = correlate(self.RRIVs_front, self.JJIVs_front, 'valid')
@ -1632,7 +1785,8 @@ class Data:
} }
except Exception as e: except Exception as e:
return Result().failure(info=Constants.PRECISELY_ALIGN_CALCULATE_FAILURE_FRONT + return Result().failure(info=Constants.PRECISELY_ALIGN_CALCULATE_FAILURE_FRONT +
Constants.FAILURE_REASON["Calculate_Correlation_Exception"] + "\n" + format_exc()) Constants.FAILURE_REASON[
"Calculate_Correlation_Exception"] + "\n" + format_exc())
return Result().success(info=Constants.PRECISELY_ALIGN_CALCULATE_FINISHED_FRONT, data=result) return Result().success(info=Constants.PRECISELY_ALIGN_CALCULATE_FINISHED_FRONT, data=result)
@ -1700,7 +1854,8 @@ class Data:
} }
except Exception as e: except Exception as e:
return Result().failure(info=Constants.PRECISELY_ALIGN_CALCULATE_FAILURE_BACK + return Result().failure(info=Constants.PRECISELY_ALIGN_CALCULATE_FAILURE_BACK +
Constants.FAILURE_REASON["Calculate_Correlation_Exception"] + "\n" + format_exc()) Constants.FAILURE_REASON[
"Calculate_Correlation_Exception"] + "\n" + format_exc())
return Result().success(info=Constants.PRECISELY_ALIGN_CALCULATE_FINISHED_BACK, data=result) return Result().success(info=Constants.PRECISELY_ALIGN_CALCULATE_FINISHED_BACK, data=result)
@ -1796,7 +1951,9 @@ class Data:
else: else:
self.correlation_align_point_match_ECG.sort() self.correlation_align_point_match_ECG.sort()
self.correlation_align_point_match_BCG.sort() self.correlation_align_point_match_BCG.sort()
off = 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) off = 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"]] anchor0 = [Config["front"]["anchor_R"], Config["front"]["anchor_J"]]
anchor1 = [Config["back"]["anchor_R"], Config["back"]["anchor_J"]] anchor1 = [Config["back"]["anchor_R"], Config["back"]["anchor_J"]]
@ -1830,8 +1987,10 @@ class Data:
self.cut_Jpeak.append(peaks[idx]) self.cut_Jpeak.append(peaks[idx])
self.cut_Jpeak = asarray(self.cut_Jpeak).astype(int) 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"])) frontcut_index_BCG = int(
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"]) (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) 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) backcut_index_ECG = len(self.cut_ECG) + self.argmax_ECG - np_argmax(self.cut_ECG)
@ -1889,7 +2048,8 @@ class Data:
return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_ALIGNINFO_FINISHED) return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_ALIGNINFO_FINISHED)
def save_res_orgBcg(self, chunk): def save_res_orgBcg(self, chunk):
if (not Path(Config["Path"]["Save_OrgBCG"]).parent.exists()) or (not Path(Config["Path"]["Save_OrgBCG"]).parent.is_dir()): if (not Path(Config["Path"]["Save_OrgBCG"]).parent.exists()) or (
not Path(Config["Path"]["Save_OrgBCG"]).parent.is_dir()):
Path(Config["Path"]["Save_OrgBCG"]).parent.mkdir(parents=True, exist_ok=True) Path(Config["Path"]["Save_OrgBCG"]).parent.mkdir(parents=True, exist_ok=True)
if Config["InputConfig"]["orgBcgFreq"] != Config["InputConfig"]["UseFreq"]: if Config["InputConfig"]["orgBcgFreq"] != Config["InputConfig"]["UseFreq"]:
@ -1912,7 +2072,8 @@ class Data:
return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_RES_ORGBCG_FINISHED) return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_RES_ORGBCG_FINISHED)
def save_res_BCG(self, chunk): def save_res_BCG(self, chunk):
if (not Path(Config["Path"]["Save_BCG"]).parent.exists()) or (not Path(Config["Path"]["Save_BCG"]).parent.is_dir()): if (not Path(Config["Path"]["Save_BCG"]).parent.exists()) or (
not Path(Config["Path"]["Save_BCG"]).parent.is_dir()):
Path(Config["Path"]["Save_BCG"]).parent.mkdir(parents=True, exist_ok=True) Path(Config["Path"]["Save_BCG"]).parent.mkdir(parents=True, exist_ok=True)
if self.res_BCG is None: if self.res_BCG is None:
@ -1930,7 +2091,8 @@ class Data:
return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_RES_BCG_FINISHED) return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_RES_BCG_FINISHED)
def save_cut_ECG(self, chunk): def save_cut_ECG(self, chunk):
if (not Path(Config["Path"]["Save_ECG"]).parent.exists()) or (not Path(Config["Path"]["Save_ECG"]).parent.is_dir()): if (not Path(Config["Path"]["Save_ECG"]).parent.exists()) or (
not Path(Config["Path"]["Save_ECG"]).parent.is_dir()):
Path(Config["Path"]["Save_ECG"]).parent.mkdir(parents=True, exist_ok=True) Path(Config["Path"]["Save_ECG"]).parent.mkdir(parents=True, exist_ok=True)
if self.cut_ECG is None: if self.cut_ECG is None:
@ -1948,7 +2110,8 @@ class Data:
return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_CUT_ECG_FINISHED) return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_CUT_ECG_FINISHED)
def save_Jpeak(self, chunk): def save_Jpeak(self, chunk):
if (not Path(Config["Path"]["Save_ECG"]).parent.exists()) or (not Path(Config["Path"]["Save_ECG"]).parent.is_dir()): if (not Path(Config["Path"]["Save_ECG"]).parent.exists()) or (
not Path(Config["Path"]["Save_ECG"]).parent.is_dir()):
Path(Config["Path"]["Save_ECG"]).parent.mkdir(parents=True, exist_ok=True) Path(Config["Path"]["Save_ECG"]).parent.mkdir(parents=True, exist_ok=True)
if self.cut_Jpeak is None: if self.cut_Jpeak is None:
@ -1966,7 +2129,8 @@ class Data:
return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_CUT_JPEAK_FINISHED) return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_CUT_JPEAK_FINISHED)
def save_Rpeak(self, chunk): def save_Rpeak(self, chunk):
if (not Path(Config["Path"]["Save_Rpeak"]).parent.exists()) or (not Path(Config["Path"]["Save_Rpeak"]).parent.is_dir()): if (not Path(Config["Path"]["Save_Rpeak"]).parent.exists()) or (
not Path(Config["Path"]["Save_Rpeak"]).parent.is_dir()):
Path(Config["Path"]["Save_Rpeak"]).parent.mkdir(parents=True, exist_ok=True) Path(Config["Path"]["Save_Rpeak"]).parent.mkdir(parents=True, exist_ok=True)
if self.cut_Rpeak is None: if self.cut_Rpeak is None:
@ -1983,6 +2147,48 @@ class Data:
return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_CUT_RPEAK_FINISHED) return Result().success(info=Constants.PRECISELY_ALIGN_SAVING_CUT_RPEAK_FINISHED)
def get_corresponding_interval(self, point, bcg2ecg=True):
try:
if self.BCG_early:
pos = -self.approximately_align_pos
else:
pos = self.approximately_align_pos
if bcg2ecg:
new_point = point / self.approximately_align_estimated_freq + pos - self.approximately_align_intercept
else:
new_point = (point - pos + self.approximately_align_intercept) * self.approximately_align_estimated_freq
result = {
"new_point": int(new_point)
}
except Exception as e:
return Result().failure(info=Constants.PRECISELY_ALIGN_GET_CORRESPONDING_INTERVAL_FAILURE +
Constants.FAILURE_REASON[
"Get_Corresponding_Interval_Exception"] + "\n" + format_exc())
return Result().success(info=Constants.PRECISELY_ALIGN_GET_CORRESPONDING_INTERVAL_FINISHED, data=result)
def get_rriv_from_ecg_point(self, point:int, expend_second:int, side="left"):
extend_point = expend_second * Config["InputConfig"]["UseFreq"]
if side == "left":
extend_point = max(point + extend_point, 0)
elif side == "right":
extend_point = min(point - extend_point, max(self.Rpeak))
else:
return Result().failure(info=Constants.PRECISELY_ALIGN_GET_RRIV_FROM_ECG_POINT_FAILURE +
Constants.FAILURE_REASON["Invalid_Side_Parameter"])
extend_estimate_RRIV = searchsorted(self.Rpeak[:-2], extend_point, side)
result = {
"estimate_RRIV": extend_estimate_RRIV,
"extend_point": extend_point
}
return Result().success(info=Constants.PRECISELY_ALIGN_GET_RRIV_FROM_ECG_POINT_FINISHED, data=result)
class CustomNavigationToolbar(NavigationToolbar2QT): class CustomNavigationToolbar(NavigationToolbar2QT):

View File

@ -105,6 +105,7 @@ class Params:
"BandPassHigh": 0.7 "BandPassHigh": 0.7
}, },
"Multiple_Factor":100, "Multiple_Factor":100,
"Second_PerEpoch": 30,
"CorrByEpoch": "CorrByEpoch":
{ {
"window_epoch": 6 "window_epoch": 6

View File

@ -46,6 +46,8 @@ class Constants:
SAVE_FINISHED: str = "保存完成" SAVE_FINISHED: str = "保存完成"
SAVE_FAILURE: str = "保存失败" SAVE_FAILURE: str = "保存失败"
CORRESPONDING_INTERVAL_PROMOTE_TEMPLATE: str = "经粗对齐计算BCG({},{})对应的ECG约区间为({},{})"
OPERATION_FINISHED: str = "操作完成" OPERATION_FINISHED: str = "操作完成"
OPERATION_FAILURE: str = "操作失败" OPERATION_FAILURE: str = "操作失败"
OPERATION_CANCELED: str = "操作取消" OPERATION_CANCELED: str = "操作取消"
@ -126,11 +128,13 @@ class Constants:
"Calculate_Correlation1_Exception": "计算互相关1/2异常", "Calculate_Correlation1_Exception": "计算互相关1/2异常",
"Calculate_Correlation2_Exception": "计算互相关2/2异常", "Calculate_Correlation2_Exception": "计算互相关2/2异常",
"Calculate_Maxvalue_Pos_Exception": "(计算最大值位置异常)", "Calculate_Maxvalue_Pos_Exception": "(计算最大值位置异常)",
"Invalid_Side_Parameter": "(无效的方向参数)",
"Get_Epoch_Exception": "获取epoch异常", "Get_Epoch_Exception": "获取epoch异常",
"Get_Corr_By_Epoch_Exception": "通过epoch获取相关性异常", "Get_Corr_By_Epoch_Exception": "通过epoch获取相关性异常",
"Predict_Exception": "(预测异常,请检查模型文件存放是否正确或检测方法是否正确)", "Predict_Exception": "(预测异常,请检查模型文件存放是否正确或检测方法是否正确)",
"Read_Model_Exception": "(读取模型异常)", "Read_Model_Exception": "(读取模型异常)",
"Calculate_Correlation_Value_Equal": "(计算相关性参数相同)", "Calculate_Correlation_Value_Equal": "(计算相关性参数相同)",
"Get_Corresponding_Interval_Exception": "(获取对应区间异常)",
"Calculate_Correlation_JJIVRange_too_Large": "计算相关性JJIV范围大于RRIV范围", "Calculate_Correlation_JJIVRange_too_Large": "计算相关性JJIV范围大于RRIV范围",
"Calculate_Correlation_Exception": "(计算相关性异常)", "Calculate_Correlation_Exception": "(计算相关性异常)",
"Correlation_Align_Exception": "(处理相关对齐异常)", "Correlation_Align_Exception": "(处理相关对齐异常)",
@ -192,6 +196,10 @@ class Constants:
APPROXIMATELY_EPOCH_GET_FINISHED: str = "获取epoch完成" APPROXIMATELY_EPOCH_GET_FINISHED: str = "获取epoch完成"
APPROXIMATELY_EPOCH_GET_FAILURE: str = "获取epoch失败" APPROXIMATELY_EPOCH_GET_FAILURE: str = "获取epoch失败"
APPROXIMATELY_ESTIMATE_FREQUENCY_CALCULATING: str = "正在估计采样率"
APPROXIMATELY_ESTIMATE_FREQUENCY_FINISHED: str = "估计采样率完成"
APPROXIMATELY_ESTIMATE_FREQUENCY_FAILURE: str = "估计采样率失败"
# 预处理 # 预处理
PREPROCESS_PLOT_LABEL_ORIGINAL_DATA: str = "Original_Data" PREPROCESS_PLOT_LABEL_ORIGINAL_DATA: str = "Original_Data"
PREPROCESS_PLOT_LABEL_PROCESSED_DATA: str = "Processed_Data" PREPROCESS_PLOT_LABEL_PROCESSED_DATA: str = "Processed_Data"
@ -253,6 +261,11 @@ class Constants:
PRECISELY_ALIGN_PROCESS_FINISHED: str = "处理完成" PRECISELY_ALIGN_PROCESS_FINISHED: str = "处理完成"
PRECISELY_ALIGN_PROCESS_FAILURE: str = "处理失败" PRECISELY_ALIGN_PROCESS_FAILURE: str = "处理失败"
#
PRECISELY_ALIGN_GET_RRIV_FROM_ECG_POINT_FAILURE: str = "从ECG点获取RRIV失败"
PRECISELY_ALIGN_GET_RRIV_FROM_ECG_POINT_FINISHED: str = "从ECG点获取RRIV完成"
PRECISELY_ALIGN_CALCULATING_CORRELATION_FRONT: str = "正在计算前段相关性" PRECISELY_ALIGN_CALCULATING_CORRELATION_FRONT: str = "正在计算前段相关性"
PRECISELY_ALIGN_CALCULATE_FINISHED_FRONT: str = "计算前段相关性完成" PRECISELY_ALIGN_CALCULATE_FINISHED_FRONT: str = "计算前段相关性完成"
PRECISELY_ALIGN_CALCULATE_FAILURE_FRONT: str = "计算前段相关性失败" PRECISELY_ALIGN_CALCULATE_FAILURE_FRONT: str = "计算前段相关性失败"
@ -260,6 +273,10 @@ class Constants:
PRECISELY_ALIGN_CALCULATE_FINISHED_BACK: str = "计算后段相关性完成" PRECISELY_ALIGN_CALCULATE_FINISHED_BACK: str = "计算后段相关性完成"
PRECISELY_ALIGN_CALCULATE_FAILURE_BACK: str = "计算后段相关性失败" PRECISELY_ALIGN_CALCULATE_FAILURE_BACK: str = "计算后段相关性失败"
PRECISELY_ALIGN_GET_CORRESPONDING_INTERVAL : str = "正在获取对应区间"
PRECISELY_ALIGN_GET_CORRESPONDING_INTERVAL_FAILURE : str = "获取对应区间失败"
PRECISELY_ALIGN_GET_CORRESPONDING_INTERVAL_FINISHED : str = "获取对应区间完成"
PRECISELY_ALIGN_ALIGNING_CORRELATION: str = "正在处理相关对齐" PRECISELY_ALIGN_ALIGNING_CORRELATION: str = "正在处理相关对齐"
PRECISELY_ALIGN_ALIGN_CORRELATION_FINISHED: str = "处理相关对齐完成" PRECISELY_ALIGN_ALIGN_CORRELATION_FINISHED: str = "处理相关对齐完成"
PRECISELY_ALIGN_ALIGN_CORRELATION_FAILURE: str = "处理相关对齐失败" PRECISELY_ALIGN_ALIGN_CORRELATION_FAILURE: str = "处理相关对齐失败"

View File

@ -317,11 +317,12 @@ class Ui_MainWindow_approximately_align(object):
self.groupBox_align_position.setObjectName(u"groupBox_align_position") self.groupBox_align_position.setObjectName(u"groupBox_align_position")
self.gridLayout_2 = QGridLayout(self.groupBox_align_position) self.gridLayout_2 = QGridLayout(self.groupBox_align_position)
self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setObjectName(u"gridLayout_2")
self.radioButton_PABD = QRadioButton(self.groupBox_align_position) self.pushButton_ChangeView = QPushButton(self.groupBox_align_position)
self.radioButton_PABD.setObjectName(u"radioButton_PABD") self.pushButton_ChangeView.setObjectName(u"pushButton_ChangeView")
self.radioButton_PABD.setFont(font1) self.pushButton_ChangeView.setMinimumSize(QSize(0, 30))
self.pushButton_ChangeView.setFont(font1)
self.gridLayout_2.addWidget(self.radioButton_PABD, 1, 2, 1, 1) self.gridLayout_2.addWidget(self.pushButton_ChangeView, 0, 2, 1, 1)
self.radioButton_NTHO = QRadioButton(self.groupBox_align_position) self.radioButton_NTHO = QRadioButton(self.groupBox_align_position)
self.radioButton_NTHO.setObjectName(u"radioButton_NTHO") self.radioButton_NTHO.setObjectName(u"radioButton_NTHO")
@ -329,12 +330,37 @@ class Ui_MainWindow_approximately_align(object):
self.gridLayout_2.addWidget(self.radioButton_NTHO, 1, 1, 1, 1) self.gridLayout_2.addWidget(self.radioButton_NTHO, 1, 1, 1, 1)
self.radioButton_PTHO = QRadioButton(self.groupBox_align_position)
self.radioButton_PTHO.setObjectName(u"radioButton_PTHO")
self.radioButton_PTHO.setFont(font1)
self.gridLayout_2.addWidget(self.radioButton_PTHO, 1, 0, 1, 1)
self.radioButton_custom = QRadioButton(self.groupBox_align_position) self.radioButton_custom = QRadioButton(self.groupBox_align_position)
self.radioButton_custom.setObjectName(u"radioButton_custom") self.radioButton_custom.setObjectName(u"radioButton_custom")
self.radioButton_custom.setFont(font1) self.radioButton_custom.setFont(font1)
self.gridLayout_2.addWidget(self.radioButton_custom, 2, 1, 1, 1) self.gridLayout_2.addWidget(self.radioButton_custom, 2, 1, 1, 1)
self.radioButton_PABD = QRadioButton(self.groupBox_align_position)
self.radioButton_PABD.setObjectName(u"radioButton_PABD")
self.radioButton_PABD.setFont(font1)
self.gridLayout_2.addWidget(self.radioButton_PABD, 1, 2, 1, 1)
self.pushButton_GetPos = QPushButton(self.groupBox_align_position)
self.pushButton_GetPos.setObjectName(u"pushButton_GetPos")
self.pushButton_GetPos.setMinimumSize(QSize(0, 30))
self.pushButton_GetPos.setFont(font1)
self.gridLayout_2.addWidget(self.pushButton_GetPos, 0, 0, 1, 1)
self.radioButton_NABD = QRadioButton(self.groupBox_align_position)
self.radioButton_NABD.setObjectName(u"radioButton_NABD")
self.radioButton_NABD.setFont(font1)
self.gridLayout_2.addWidget(self.radioButton_NABD, 2, 0, 1, 1)
self.spinBox_custom = QSpinBox(self.groupBox_align_position) self.spinBox_custom = QSpinBox(self.groupBox_align_position)
self.spinBox_custom.setObjectName(u"spinBox_custom") self.spinBox_custom.setObjectName(u"spinBox_custom")
self.spinBox_custom.setMinimumSize(QSize(90, 0)) self.spinBox_custom.setMinimumSize(QSize(90, 0))
@ -346,35 +372,38 @@ class Ui_MainWindow_approximately_align(object):
self.gridLayout_2.addWidget(self.spinBox_custom, 2, 2, 1, 1) self.gridLayout_2.addWidget(self.spinBox_custom, 2, 2, 1, 1)
self.radioButton_PTHO = QRadioButton(self.groupBox_align_position)
self.radioButton_PTHO.setObjectName(u"radioButton_PTHO")
self.radioButton_PTHO.setFont(font1)
self.gridLayout_2.addWidget(self.radioButton_PTHO, 1, 0, 1, 1)
self.radioButton_NABD = QRadioButton(self.groupBox_align_position)
self.radioButton_NABD.setObjectName(u"radioButton_NABD")
self.radioButton_NABD.setFont(font1)
self.gridLayout_2.addWidget(self.radioButton_NABD, 2, 0, 1, 1)
self.pushButton_GetPos = QPushButton(self.groupBox_align_position)
self.pushButton_GetPos.setObjectName(u"pushButton_GetPos")
self.pushButton_GetPos.setMinimumSize(QSize(0, 30))
self.pushButton_GetPos.setFont(font1)
self.gridLayout_2.addWidget(self.pushButton_GetPos, 0, 0, 1, 1)
self.pushButton_ChangeView = QPushButton(self.groupBox_align_position)
self.pushButton_ChangeView.setObjectName(u"pushButton_ChangeView")
self.pushButton_ChangeView.setMinimumSize(QSize(0, 30))
self.pushButton_ChangeView.setFont(font1)
self.gridLayout_2.addWidget(self.pushButton_ChangeView, 0, 2, 1, 1)
self.verticalLayout.addWidget(self.groupBox_align_position) self.verticalLayout.addWidget(self.groupBox_align_position)
self.groupBox_2 = QGroupBox(self.groupBox_left)
self.groupBox_2.setObjectName(u"groupBox_2")
self.groupBox_2.setMinimumSize(QSize(0, 0))
self.layoutWidget = QWidget(self.groupBox_2)
self.layoutWidget.setObjectName(u"layoutWidget")
self.layoutWidget.setGeometry(QRect(11, 18, 401, 41))
self.verticalLayout_3 = QVBoxLayout(self.layoutWidget)
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3 = QHBoxLayout()
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.radioButton_freqTHO = QRadioButton(self.layoutWidget)
self.radioButton_freqTHO.setObjectName(u"radioButton_freqTHO")
self.radioButton_freqTHO.setFont(font1)
self.horizontalLayout_3.addWidget(self.radioButton_freqTHO)
self.radioButton_freqABD = QRadioButton(self.layoutWidget)
self.radioButton_freqABD.setObjectName(u"radioButton_freqABD")
self.radioButton_freqABD.setFont(font1)
self.horizontalLayout_3.addWidget(self.radioButton_freqABD)
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
self.verticalLayout.addWidget(self.groupBox_2)
self.groupBox_view_partially = QGroupBox(self.groupBox_left) self.groupBox_view_partially = QGroupBox(self.groupBox_left)
self.groupBox_view_partially.setObjectName(u"groupBox_view_partially") self.groupBox_view_partially.setObjectName(u"groupBox_view_partially")
self.verticalLayout_2 = QVBoxLayout(self.groupBox_view_partially) self.verticalLayout_2 = QVBoxLayout(self.groupBox_view_partially)
@ -456,10 +485,6 @@ class Ui_MainWindow_approximately_align(object):
self.verticalLayout.addWidget(self.groupBox_view_partially) self.verticalLayout.addWidget(self.groupBox_view_partially)
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.verticalLayout.addItem(self.verticalSpacer)
self.pushButton_save = QPushButton(self.groupBox_left) self.pushButton_save = QPushButton(self.groupBox_left)
self.pushButton_save.setObjectName(u"pushButton_save") self.pushButton_save.setObjectName(u"pushButton_save")
sizePolicy.setHeightForWidth(self.pushButton_save.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.pushButton_save.sizePolicy().hasHeightForWidth())
@ -483,11 +508,12 @@ class Ui_MainWindow_approximately_align(object):
self.verticalLayout.setStretch(0, 1) self.verticalLayout.setStretch(0, 1)
self.verticalLayout.setStretch(1, 1) self.verticalLayout.setStretch(1, 1)
self.verticalLayout.setStretch(2, 3) self.verticalLayout.setStretch(2, 3)
self.verticalLayout.setStretch(4, 2) self.verticalLayout.setStretch(3, 4)
self.verticalLayout.setStretch(5, 4) self.verticalLayout.setStretch(4, 3)
self.verticalLayout.setStretch(6, 1) self.verticalLayout.setStretch(5, 2)
self.verticalLayout.setStretch(6, 4)
self.verticalLayout.setStretch(7, 1) self.verticalLayout.setStretch(7, 1)
self.verticalLayout.setStretch(8, 4) self.verticalLayout.setStretch(8, 6)
self.gridLayout.addWidget(self.groupBox_left, 0, 0, 1, 1) self.gridLayout.addWidget(self.groupBox_left, 0, 0, 1, 1)
@ -541,13 +567,16 @@ class Ui_MainWindow_approximately_align(object):
self.label_8.setText(QCoreApplication.translate("MainWindow_approximately_align", u"PSG_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.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)) self.groupBox_align_position.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u5bf9\u9f50\u8d77\u59cb\u4f4d\u7f6e", None))
self.radioButton_PABD.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90093", None)) self.pushButton_ChangeView.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u4f30\u8ba1\u91c7\u6837\u7387", None))
self.radioButton_NTHO.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90092", None)) self.radioButton_NTHO.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90092", None))
self.radioButton_custom.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u81ea\u5b9a\u4e49", None))
self.radioButton_PTHO.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90091", None)) self.radioButton_PTHO.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90091", None))
self.radioButton_NABD.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90094", None)) self.radioButton_custom.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u81ea\u5b9a\u4e49", None))
self.radioButton_PABD.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90093", None))
self.pushButton_GetPos.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u8ba1\u7b97\u5bf9\u9f50", None)) self.pushButton_GetPos.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u8ba1\u7b97\u5bf9\u9f50", None))
self.pushButton_ChangeView.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5207\u6362\u89c6\u56fe", None)) self.radioButton_NABD.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90094", None))
self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u91c7\u6837\u7387\u4f30\u8ba1", None))
self.radioButton_freqTHO.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90091", None))
self.radioButton_freqABD.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u5907\u90092", None))
self.groupBox_view_partially.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u5c40\u90e8\u89c2\u6d4b", None)) self.groupBox_view_partially.setTitle(QCoreApplication.translate("MainWindow_approximately_align", u"\u5c40\u90e8\u89c2\u6d4b", None))
self.label_9.setText(QCoreApplication.translate("MainWindow_approximately_align", u"Epoch\uff1a", None)) self.label_9.setText(QCoreApplication.translate("MainWindow_approximately_align", u"Epoch\uff1a", None))
self.pushButton_JUMP.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u8df3\u8f6c", None)) self.pushButton_JUMP.setText(QCoreApplication.translate("MainWindow_approximately_align", u"\u8df3\u8f6c", None))

View File

@ -25,7 +25,7 @@
<property name="title"> <property name="title">
<string>数据粗同步</string> <string>数据粗同步</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,3,0,2,4,1,1,4"> <layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,3,4,3,2,4,1,6">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
@ -531,15 +531,21 @@
<string>对齐起始位置</string> <string>对齐起始位置</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2"> <item row="0" column="2">
<widget class="QRadioButton" name="radioButton_PABD"> <widget class="QPushButton" name="pushButton_ChangeView">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>备选3</string> <string>估计采样率</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -555,6 +561,18 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QRadioButton" name="radioButton_PTHO">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>备选1</string>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QRadioButton" name="radioButton_custom"> <widget class="QRadioButton" name="radioButton_custom">
<property name="font"> <property name="font">
@ -567,6 +585,48 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QRadioButton" name="radioButton_PABD">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>备选3</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_GetPos">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>计算对齐</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_NABD">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>备选4</string>
</property>
</widget>
</item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QSpinBox" name="spinBox_custom"> <widget class="QSpinBox" name="spinBox_custom">
<property name="minimumSize"> <property name="minimumSize">
@ -594,8 +654,34 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> </layout>
<widget class="QRadioButton" name="radioButton_PTHO"> </widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>采样率估计</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>11</x>
<y>18</y>
<width>401</width>
<height>41</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QRadioButton" name="radioButton_freqTHO">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
@ -606,55 +692,22 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item>
<widget class="QRadioButton" name="radioButton_NABD"> <widget class="QRadioButton" name="radioButton_freqABD">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>备选4</string> <string>备选2</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_GetPos">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>计算对齐</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_ChangeView">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>切换视图</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item> <item>
@ -807,19 +860,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer">
<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>
<item> <item>
<widget class="QPushButton" name="pushButton_save"> <widget class="QPushButton" name="pushButton_save">
<property name="sizePolicy"> <property name="sizePolicy">

View File

@ -3,7 +3,7 @@
################################################################################ ################################################################################
## Form generated from reading UI file 'MainWindow_precisely_align.ui' ## Form generated from reading UI file 'MainWindow_precisely_align.ui'
## ##
## Created by: Qt User Interface Compiler version 6.8.2 ## Created by: Qt User Interface Compiler version 6.7.0
## ##
## WARNING! All changes made in this file will be lost when recompiling UI file! ## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################ ################################################################################
@ -16,10 +16,11 @@ from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
QIcon, QImage, QKeySequence, QLinearGradient, QIcon, QImage, QKeySequence, QLinearGradient,
QPainter, QPalette, QPixmap, QRadialGradient, QPainter, QPalette, QPixmap, QRadialGradient,
QTransform) QTransform)
from PySide6.QtWidgets import (QAbstractSpinBox, QApplication, QGridLayout, QGroupBox, from PySide6.QtWidgets import (QAbstractSpinBox, QApplication, QCheckBox, QGridLayout,
QHBoxLayout, QLabel, QMainWindow, QPushButton, QGroupBox, QHBoxLayout, QLabel, QMainWindow,
QRadioButton, QSizePolicy, QSpacerItem, QSpinBox, QPushButton, QRadioButton, QSizePolicy, QSpacerItem,
QStatusBar, QTextBrowser, QVBoxLayout, QWidget) QSpinBox, QStatusBar, QTextBrowser, QVBoxLayout,
QWidget)
class Ui_MainWindow_precisely_align(object): class Ui_MainWindow_precisely_align(object):
def setupUi(self, MainWindow_precisely_align): def setupUi(self, MainWindow_precisely_align):
@ -96,6 +97,38 @@ class Ui_MainWindow_precisely_align(object):
self.groupBox_args.setObjectName(u"groupBox_args") self.groupBox_args.setObjectName(u"groupBox_args")
self.verticalLayout_5 = QVBoxLayout(self.groupBox_args) self.verticalLayout_5 = QVBoxLayout(self.groupBox_args)
self.verticalLayout_5.setObjectName(u"verticalLayout_5") self.verticalLayout_5.setObjectName(u"verticalLayout_5")
self.groupBox_6 = QGroupBox(self.groupBox_args)
self.groupBox_6.setObjectName(u"groupBox_6")
self.horizontalLayout = QHBoxLayout(self.groupBox_6)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.checkBox_ECG_autoset = QCheckBox(self.groupBox_6)
self.checkBox_ECG_autoset.setObjectName(u"checkBox_ECG_autoset")
self.checkBox_ECG_autoset.setChecked(True)
self.horizontalLayout.addWidget(self.checkBox_ECG_autoset)
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Minimum)
self.horizontalLayout.addItem(self.horizontalSpacer)
self.label_17 = QLabel(self.groupBox_6)
self.label_17.setObjectName(u"label_17")
self.label_17.setAlignment(Qt.AlignmentFlag.AlignRight|Qt.AlignmentFlag.AlignTrailing|Qt.AlignmentFlag.AlignVCenter)
self.horizontalLayout.addWidget(self.label_17)
self.spinBox_ECG_expend_second = QSpinBox(self.groupBox_6)
self.spinBox_ECG_expend_second.setObjectName(u"spinBox_ECG_expend_second")
self.spinBox_ECG_expend_second.setAlignment(Qt.AlignmentFlag.AlignRight|Qt.AlignmentFlag.AlignTrailing|Qt.AlignmentFlag.AlignVCenter)
self.spinBox_ECG_expend_second.setButtonSymbols(QAbstractSpinBox.ButtonSymbols.NoButtons)
self.spinBox_ECG_expend_second.setMaximum(1000000)
self.spinBox_ECG_expend_second.setValue(30)
self.horizontalLayout.addWidget(self.spinBox_ECG_expend_second)
self.verticalLayout_5.addWidget(self.groupBox_6)
self.groupBox_2 = QGroupBox(self.groupBox_args) self.groupBox_2 = QGroupBox(self.groupBox_args)
self.groupBox_2.setObjectName(u"groupBox_2") self.groupBox_2.setObjectName(u"groupBox_2")
self.verticalLayout_2 = QVBoxLayout(self.groupBox_2) self.verticalLayout_2 = QVBoxLayout(self.groupBox_2)
@ -426,6 +459,11 @@ class Ui_MainWindow_precisely_align(object):
self.verticalLayout_5.addWidget(self.groupBox_5) self.verticalLayout_5.addWidget(self.groupBox_5)
self.verticalLayout_5.setStretch(0, 2)
self.verticalLayout_5.setStretch(1, 2)
self.verticalLayout_5.setStretch(2, 2)
self.verticalLayout_5.setStretch(3, 2)
self.verticalLayout_5.setStretch(4, 2)
self.verticalLayout.addWidget(self.groupBox_args) self.verticalLayout.addWidget(self.groupBox_args)
@ -489,7 +527,6 @@ class Ui_MainWindow_precisely_align(object):
self.verticalLayout.setStretch(0, 1) self.verticalLayout.setStretch(0, 1)
self.verticalLayout.setStretch(1, 7) self.verticalLayout.setStretch(1, 7)
self.verticalLayout.setStretch(2, 2)
self.verticalLayout.setStretch(3, 1) self.verticalLayout.setStretch(3, 1)
self.verticalLayout.setStretch(4, 1) self.verticalLayout.setStretch(4, 1)
self.verticalLayout.setStretch(5, 5) self.verticalLayout.setStretch(5, 5)
@ -517,6 +554,9 @@ class Ui_MainWindow_precisely_align(object):
self.pushButton_input_setting.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u5bfc\u5165\u8bbe\u7f6e", None)) self.pushButton_input_setting.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u5bfc\u5165\u8bbe\u7f6e", None))
self.pushButton_input.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u5f00\u59cb\u5bfc\u5165", None)) self.pushButton_input.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u5f00\u59cb\u5bfc\u5165", None))
self.groupBox_args.setTitle(QCoreApplication.translate("MainWindow_precisely_align", u"\u53c2\u6570\u8f93\u5165", None)) self.groupBox_args.setTitle(QCoreApplication.translate("MainWindow_precisely_align", u"\u53c2\u6570\u8f93\u5165", None))
self.groupBox_6.setTitle(QCoreApplication.translate("MainWindow_precisely_align", u"ECG\u81ea\u52a8\u83b7\u53d6\u533a\u95f4", None))
self.checkBox_ECG_autoset.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u81ea\u52a8\u83b7\u53d6ECG\u533a\u95f4", None))
self.label_17.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u62d3\u5c55\u79d2\u6570\uff1a", None))
self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow_precisely_align", u"\u524d\u6bb5BCG\u533a\u95f4\u5750\u6807\u53d6\u503c", None)) self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow_precisely_align", u"\u524d\u6bb5BCG\u533a\u95f4\u5750\u6807\u53d6\u503c", None))
self.radioButton_BCG_front.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u524d\u6bb5BCG", None)) self.radioButton_BCG_front.setText(QCoreApplication.translate("MainWindow_precisely_align", u"\u524d\u6bb5BCG", None))
self.label_4.setText(QCoreApplication.translate("MainWindow_precisely_align", u"~", None)) self.label_4.setText(QCoreApplication.translate("MainWindow_precisely_align", u"~", None))

View File

@ -56,7 +56,7 @@
<property name="title"> <property name="title">
<string>数据精同步</string> <string>数据精同步</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,7,2,1,1,5"> <layout class="QVBoxLayout" name="verticalLayout" stretch="1,7,0,1,1,5">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
@ -102,7 +102,68 @@
<property name="title"> <property name="title">
<string>参数输入</string> <string>参数输入</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0,0"> <layout class="QVBoxLayout" name="verticalLayout_5" stretch="2,2,2,2,2">
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>ECG自动获取区间</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="checkBox_ECG_autoset">
<property name="text">
<string>自动获取ECG区间</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>拓展秒数:</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_ECG_expend_second">
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">