完善了<体动标注>的体动合并规则
This commit is contained in:
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
~~7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹~~
|
~~7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹~~
|
||||||
|
|
||||||
|
8、将导入设置中的采样率修改为自动获取数据文件名中的采样率
|
||||||
|
|
||||||
## 1、主菜单
|
## 1、主菜单
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@ -711,117 +711,202 @@ class MainWindow_artifact_label(QMainWindow):
|
|||||||
(0 < (int(self.ui.lineEdit_start_time.text()) - value_endTime) <= (2 * Config["InputConfig"]["UseFreq"])) or
|
(0 < (int(self.ui.lineEdit_start_time.text()) - value_endTime) <= (2 * Config["InputConfig"]["UseFreq"])) or
|
||||||
(0 < (value_startTime - int(self.ui.lineEdit_end_time.text())) <= (2 * Config["InputConfig"]["UseFreq"]))):
|
(0 < (value_startTime - int(self.ui.lineEdit_end_time.text())) <= (2 * Config["InputConfig"]["UseFreq"]))):
|
||||||
select_row.append(row.to_dict())
|
select_row.append(row.to_dict())
|
||||||
if row['type'] == 1:
|
if value_type == 1:
|
||||||
select_type[0] = select_type[0] + 1
|
select_type[0] = select_type[0] + 1
|
||||||
elif row['type'] == 2:
|
elif value_type == 2:
|
||||||
select_type[1] = select_type[1] + 1
|
select_type[1] = select_type[1] + 1
|
||||||
elif row['type'] == 3:
|
elif value_type == 3:
|
||||||
select_type[2] = select_type[2] + 1
|
select_type[2] = select_type[2] + 1
|
||||||
elif row['type'] == 4:
|
elif value_type == 4:
|
||||||
select_type[3] = select_type[3] + 1
|
select_type[3] = select_type[3] + 1
|
||||||
elif row['type'] == 5:
|
elif value_type == 5:
|
||||||
select_type[4] = select_type[4] + 1
|
select_type[4] = select_type[4] + 1
|
||||||
if (0 < (int(self.ui.lineEdit_start_time.text()) - value_endTime) <= (2 * Config["InputConfig"]["UseFreq"])) and (value_type == type):
|
if (0 < (int(self.ui.lineEdit_start_time.text()) - value_endTime) <= (2 * Config["InputConfig"]["UseFreq"])):
|
||||||
flagf = True
|
flagf = True
|
||||||
if (0 < (value_startTime - int(self.ui.lineEdit_end_time.text())) <= (2 * Config["InputConfig"]["UseFreq"])) and (value_type == type):
|
if (0 < (value_startTime - int(self.ui.lineEdit_end_time.text())) <= (2 * Config["InputConfig"]["UseFreq"])):
|
||||||
flagb = True
|
flagb = True
|
||||||
|
|
||||||
count = np_sum(select_type >= 1)
|
# 按照括注的体动的数量来进行条件判断
|
||||||
if count >= 2 or (count == 1 and nonzero(select_type)[0][0] + 1 == type):
|
if len(select_row) >= 1:
|
||||||
if count >= 2:
|
|
||||||
reply = QMessageBox.question(self, '确认',
|
|
||||||
'{}{}'.format(Constants.ARTIFACT_LABEL_MULTIPLE_ARTIFACT_COVER_OR_DELETE, [d["number"] for d in select_row]),
|
|
||||||
QMessageBox.Yes | QMessageBox.No,
|
|
||||||
QMessageBox.No)
|
|
||||||
if reply == QMessageBox.No:
|
|
||||||
return
|
|
||||||
|
|
||||||
if flagf == True and flagb == False:
|
if flagf == True and flagb == False:
|
||||||
if type == 1 or type == 2 or type == 3:
|
|
||||||
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE,
|
|
||||||
Constants.MSGBOX_TYPE_INFO)
|
|
||||||
start_time = select_row[0]['startTime']
|
start_time = select_row[0]['startTime']
|
||||||
end_time = int(self.ui.lineEdit_end_time.text())
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
elif type == 4 or type == 5:
|
typef = select_row[0]['type']
|
||||||
|
if typef == 1 or typef == 2 or typef == 3:
|
||||||
|
if type == 1:
|
||||||
|
type = 1
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
elif type == 2:
|
||||||
|
if typef == 1:
|
||||||
|
type = 1
|
||||||
|
elif typef == 2:
|
||||||
|
type = 3
|
||||||
|
elif typef == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
elif type == 3:
|
||||||
|
if typef == 1:
|
||||||
|
type = 1
|
||||||
|
elif typef == 2:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
elif typef == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
else:
|
||||||
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_WARNING,
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_WARNING,
|
||||||
Constants.MSGBOX_TYPE_INFO)
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
select_row = select_row[1:]
|
select_row = select_row[1:]
|
||||||
start_time = int(self.ui.lineEdit_start_time.text())
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
end_time = int(self.ui.lineEdit_end_time.text())
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
if flagf == False and flagb == True:
|
elif typef == 4 or typef == 5:
|
||||||
if type == 1 or type == 2 or type == 3:
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_TWO_SECONDS_WARNING,
|
||||||
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE,
|
|
||||||
Constants.MSGBOX_TYPE_INFO)
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
select_row = select_row[1:]
|
||||||
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
|
elif flagf == False and flagb == True:
|
||||||
start_time = int(self.ui.lineEdit_start_time.text())
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
end_time = select_row[-1]['endTime']
|
end_time = select_row[-1]['endTime']
|
||||||
elif type == 4 or type == 5:
|
typeb = select_row[-1]['type']
|
||||||
|
if typeb == 1 or typeb == 2 or typeb == 3:
|
||||||
|
if type == 1:
|
||||||
|
type = 1
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
elif type == 2:
|
||||||
|
if typeb == 1:
|
||||||
|
type = 1
|
||||||
|
elif typeb == 2:
|
||||||
|
type = 3
|
||||||
|
elif typeb == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
elif type == 3:
|
||||||
|
if typeb == 1:
|
||||||
|
type = 1
|
||||||
|
elif typeb == 2:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
elif typeb == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
else:
|
||||||
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_WARNING,
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_WARNING,
|
||||||
Constants.MSGBOX_TYPE_INFO)
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
select_row = select_row[:-1]
|
select_row = select_row[:-1]
|
||||||
start_time = int(self.ui.lineEdit_start_time.text())
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
end_time = int(self.ui.lineEdit_end_time.text())
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
if flagf == True and flagb == True:
|
elif typeb == 4 or typeb == 5:
|
||||||
if type == 1 or type == 2 or type == 3:
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_BACK_TWO_SECONDS_WARNING,
|
||||||
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE,
|
|
||||||
Constants.MSGBOX_TYPE_INFO)
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
select_row = select_row[:-1]
|
||||||
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
|
elif flagf == True and flagb == True:
|
||||||
start_time = select_row[0]['startTime']
|
start_time = select_row[0]['startTime']
|
||||||
end_time = select_row[-1]['endTime']
|
end_time = select_row[-1]['endTime']
|
||||||
elif type == 4 or type == 5:
|
typef = select_row[0]['type']
|
||||||
|
typeb = select_row[-1]['type']
|
||||||
|
if typef == 1 or typef == 2 or typef == 3:
|
||||||
|
if type == 1:
|
||||||
|
type = 1
|
||||||
|
elif type == 2:
|
||||||
|
if typef == 1:
|
||||||
|
type = 1
|
||||||
|
elif typef == 2:
|
||||||
|
type = 3
|
||||||
|
elif typef == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
elif type == 3:
|
||||||
|
if typef == 1:
|
||||||
|
type = 1
|
||||||
|
elif typef == 2:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
elif typef == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
if type == 1:
|
||||||
|
type = 1
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
elif type == 2:
|
||||||
|
if typeb == 1:
|
||||||
|
type = 1
|
||||||
|
elif typeb == 2:
|
||||||
|
type = 3
|
||||||
|
elif typeb == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
elif type == 3:
|
||||||
|
if typeb == 1:
|
||||||
|
type = 1
|
||||||
|
elif typeb == 2:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
elif typeb == 3:
|
||||||
|
if end_time - start_time >= (5 * Config["InputConfig"]["UseFreq"]):
|
||||||
|
type = 1
|
||||||
|
else:
|
||||||
|
type = 3
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
else:
|
||||||
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_WARNING,
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_WARNING,
|
||||||
Constants.MSGBOX_TYPE_INFO)
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
select_row = select_row[1:-1]
|
select_row = select_row[1:-1]
|
||||||
start_time = int(self.ui.lineEdit_start_time.text())
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
end_time = int(self.ui.lineEdit_end_time.text())
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
if flagf == False and flagb == False:
|
elif typef == 4 or typef == 5:
|
||||||
|
PublicFunc.msgbox_output(self, Constants.ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_WARNING,
|
||||||
|
Constants.MSGBOX_TYPE_INFO)
|
||||||
|
select_row = select_row[1:-1]
|
||||||
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
|
elif flagf == False and flagb == False:
|
||||||
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
|
else:
|
||||||
start_time = int(self.ui.lineEdit_start_time.text())
|
start_time = int(self.ui.lineEdit_start_time.text())
|
||||||
end_time = int(self.ui.lineEdit_end_time.text())
|
end_time = int(self.ui.lineEdit_end_time.text())
|
||||||
|
|
||||||
for select_each_row in select_row:
|
for select_each_row in select_row:
|
||||||
self.data.df_Artifact_a = self.data.df_Artifact_a[self.data.df_Artifact_a['number'] != select_each_row["number"]]
|
self.data.df_Artifact_a = self.data.df_Artifact_a[self.data.df_Artifact_a['number'] != select_each_row["number"]]
|
||||||
else:
|
|
||||||
select_row = []
|
|
||||||
select_type = array([0, 0, 0, 0, 0])
|
|
||||||
for index, row in self.data.df_Artifact_a.iterrows():
|
|
||||||
value_startTime = row['startTime']
|
|
||||||
value_endTime = row['endTime']
|
|
||||||
value_type = row['type']
|
|
||||||
if ((value_startTime <= int(self.ui.lineEdit_end_time.text()) <= value_endTime) or
|
|
||||||
(value_startTime <= int(self.ui.lineEdit_start_time.text()) <= value_endTime) or
|
|
||||||
(value_startTime >= int(self.ui.lineEdit_start_time.text()) and value_endTime <= int(
|
|
||||||
self.ui.lineEdit_end_time.text()))):
|
|
||||||
select_row.append(row.to_dict())
|
|
||||||
if row['type'] == 1:
|
|
||||||
select_type[0] = select_type[0] + 1
|
|
||||||
elif row['type'] == 2:
|
|
||||||
select_type[1] = select_type[1] + 1
|
|
||||||
elif row['type'] == 3:
|
|
||||||
select_type[2] = select_type[2] + 1
|
|
||||||
elif row['type'] == 4:
|
|
||||||
select_type[3] = select_type[3] + 1
|
|
||||||
elif row['type'] == 5:
|
|
||||||
select_type[4] = select_type[4] + 1
|
|
||||||
|
|
||||||
count = np_sum(select_type >= 1)
|
|
||||||
|
|
||||||
if (count == 1 and nonzero(select_type)[0][0] + 1 != type):
|
|
||||||
reply = QMessageBox.question(self, '确认',
|
|
||||||
'{}{}'.format(Constants.ARTIFACT_LABEL_SINGLE_TYPE_NOT_EQUAL,
|
|
||||||
[d["number"] for d in select_row]),
|
|
||||||
QMessageBox.Yes | QMessageBox.No,
|
|
||||||
QMessageBox.No)
|
|
||||||
if reply == QMessageBox.No:
|
|
||||||
return
|
|
||||||
|
|
||||||
start_time = int(self.ui.lineEdit_start_time.text())
|
|
||||||
end_time = int(self.ui.lineEdit_end_time.text())
|
|
||||||
|
|
||||||
for select_each_row in select_row:
|
|
||||||
self.data.df_Artifact_a = self.data.df_Artifact_a[self.data.df_Artifact_a['number'] != select_each_row["number"]]
|
|
||||||
elif count == 0:
|
|
||||||
start_time = int(self.ui.lineEdit_start_time.text())
|
|
||||||
end_time = int(self.ui.lineEdit_end_time.text())
|
|
||||||
else:
|
|
||||||
raise ValueError("count值不存在")
|
|
||||||
|
|
||||||
new_row = {
|
new_row = {
|
||||||
'number': 1,
|
'number': 1,
|
||||||
|
|||||||
@ -347,14 +347,12 @@ class Constants:
|
|||||||
ARTIFACT_LABEL_JUMP_ARTIFACT: str = "跳转到体动"
|
ARTIFACT_LABEL_JUMP_ARTIFACT: str = "跳转到体动"
|
||||||
ARTIFACT_LABEL_RECOVER_SCALE: str = "尺度恢复"
|
ARTIFACT_LABEL_RECOVER_SCALE: str = "尺度恢复"
|
||||||
ARTIFACT_LABEL_MISS_ARGS: str = "打标参数未填写"
|
ARTIFACT_LABEL_MISS_ARGS: str = "打标参数未填写"
|
||||||
ARTIFACT_LABEL_MULTIPLE_ARTIFACT_COVER_OR_DELETE: str = "所选区域包含多种类型的体动,是否需要删除它们并使用新标注进行覆盖?所选区域中含有的体动序号:"
|
ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE: str = "所选区域前2秒内有体动,将根据规则执行合并"
|
||||||
ARTIFACT_LABEL_FRONT_TWO_SECONDS_MERGE: str = "所选区域前2秒内有与当前标注相同类型的体动,将执行合并"
|
ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE: str = "所选区域后2秒内有体动,将根据规则执行合并"
|
||||||
ARTIFACT_LABEL_BACK_TWO_SECONDS_MERGE: str = "所选区域后2秒内有与当前标注相同类型的体动,将执行合并"
|
ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE: str = "所选区域前后2秒内都有体动,将根据规则执行合并"
|
||||||
ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_MERGE: str = "所选区域前后2秒内都有与当前标注相同类型的体动,将执行合并"
|
ARTIFACT_LABEL_FRONT_TWO_SECONDS_WARNING: str = "所选区域前2秒内有体动,仅进行提示"
|
||||||
ARTIFACT_LABEL_FRONT_TWO_SECONDS_WARNING: str = "所选区域前2秒内有与当前标注相同类型的体动,仅进行提示"
|
ARTIFACT_LABEL_BACK_TWO_SECONDS_WARNING: str = "所选区域后2秒内有体动,仅进行提示"
|
||||||
ARTIFACT_LABEL_BACK_TWO_SECONDS_WARNING: str = "所选区域后2秒内有与当前标注相同类型的体动,仅进行提示"
|
ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_WARNING: str = "所选区域前后2秒内都有体动,仅进行提示"
|
||||||
ARTIFACT_LABEL_FRONT_AND_BACK_TWO_SECONDS_WARNING: str = "所选区域前后2秒内都有与当前标注相同类型的体动,仅进行提示"
|
|
||||||
ARTIFACT_LABEL_SINGLE_TYPE_NOT_EQUAL: str = "所选区域仅包含一种类型的体动,但其类型与当前标注的类型不匹配,是否需要删除它们并使用新标注覆盖?所选区域中含有的体动序号:"
|
|
||||||
ARTIFACT_LABEL_DELETE_ARTIFACT_SUCCESSFULLY: str = "体动被删除"
|
ARTIFACT_LABEL_DELETE_ARTIFACT_SUCCESSFULLY: str = "体动被删除"
|
||||||
ARTIFACT_LABEL_DELETE_ARTIFACT_FAILURE: str = "需要被删除的体动不存在"
|
ARTIFACT_LABEL_DELETE_ARTIFACT_FAILURE: str = "需要被删除的体动不存在"
|
||||||
ARTIFACT_LABEL_ACTION_LABEL: str = f"标注体动({Params.ARTIFACT_LABEL_ACTION_LABEL_ARTIFACT_SHORTCUT_KEY})"
|
ARTIFACT_LABEL_ACTION_LABEL: str = f"标注体动({Params.ARTIFACT_LABEL_ACTION_LABEL_ARTIFACT_SHORTCUT_KEY})"
|
||||||
|
|||||||
Reference in New Issue
Block a user