为<BCG的J峰算法定位>、<ECG的R峰算法定位>、<人工纠正>增加了不做滤波的选项

This commit is contained in:
Yorusora
2025-06-28 20:35:10 +08:00
parent aa0d59f925
commit c9202174fb
11 changed files with 292 additions and 133 deletions

View File

@ -207,6 +207,8 @@ class MainWindow_detect_Jpeak(QMainWindow):
self.ui.spinBox_intervalHigh.editingFinished.connect(self.__update_config__)
self.ui.checkBox_useCPU.stateChanged.connect(self.__update_config__)
self.ui.comboBox_model.currentTextChanged.connect(self.__update_config__)
self.ui.radioButton_skip_process.toggled.connect(self.__update_config__)
self.ui.radioButton_bandpass_process.toggled.connect(self.__update_config__)
@overrides
def closeEvent(self, event):
@ -262,6 +264,7 @@ class MainWindow_detect_Jpeak(QMainWindow):
return Result().failure(info=Constants.DRAW_FAILURE)
def __update_config__(self):
sender = self.sender()
Config["Filter"]["BandPassLow"] = self.ui.doubleSpinBox_bandPassLow.value()
Config["Filter"]["BandPassHigh"] = self.ui.doubleSpinBox_bandPassHigh.value()
Config["PeaksValue"] = self.ui.spinBox_peaksValue.value()
@ -270,6 +273,10 @@ class MainWindow_detect_Jpeak(QMainWindow):
Config["IntervalHigh"] = self.ui.spinBox_intervalHigh.value()
Config["UseCPU"] = self.ui.checkBox_useCPU.isChecked()
Config["DetectMethod"] = self.ui.comboBox_model.currentText()
if sender == self.ui.radioButton_skip_process:
Config["Filter"]["Mode"] = "skip"
elif sender == self.ui.radioButton_bandpass_process:
Config["Filter"]["Mode"] = "bandpass"
def __slot_btn_input__(self):
PublicFunc.__disableAllButton__(self, ButtonState)
@ -444,21 +451,24 @@ class Data:
Constants.FAILURE_REASON["Data_Not_Exist"])
try:
if ((Config["Filter"]["BandPassLow"] >= Config["Filter"]["BandPassHigh"]) or
(Config["Filter"]["BandPassLow"] <= 0) or (Config["Filter"]["BandPassHigh"] <= 0)):
return Result().failure(
info=Constants.PREPROCESS_FAILURE + Constants.FAILURE_REASON["Filter_Args_Not_Correct"])
self.processed_data = preprocess(self.raw_data,
Config["InputConfig"]["Freq"],
Config["Filter"]["BandPassLow"],
Config["Filter"]["BandPassHigh"],
Config["AmpValue"])
if Config["Filter"]["Mode"] == "skip":
self.processed_data = self.raw_data[:len(self.raw_data) // (Config["InputConfig"]["Freq"] * 10) * Config["InputConfig"]["Freq"] * 10]
return Result().success(info=Constants.PREPROCESS_NO_NEED)
elif Config["Filter"]["Mode"] == "bandpass":
if ((Config["Filter"]["BandPassLow"] >= Config["Filter"]["BandPassHigh"]) or
(Config["Filter"]["BandPassLow"] <= 0) or (Config["Filter"]["BandPassHigh"] <= 0)):
return Result().failure(
info=Constants.PREPROCESS_FAILURE + Constants.FAILURE_REASON["Filter_Args_Not_Correct"])
self.processed_data = preprocess(self.raw_data,
Config["InputConfig"]["Freq"],
Config["Filter"]["BandPassLow"],
Config["Filter"]["BandPassHigh"],
Config["AmpValue"])
return Result().success(info=Constants.PREPROCESS_FINISHED)
except Exception as e:
return Result().failure(info=Constants.PREPROCESS_FAILURE +
Constants.FAILURE_REASON["Preprocess_Exception"] + "\n" + format_exc())
return Result().success(info=Constants.PREPROCESS_FINISHED)
def predict_Jpeak(self, model):
if not (Path(model.model_folder_path) / Path(model.selected_model)).exists():
return Result().failure(info=Constants.DETECT_JPEAK_PREDICT_FAILURE +