refactor(gui): 重命名面板序号 step4-11,采样点布设移至 step4,ML 建模移至 step9

This commit is contained in:
DXC
2026-06-11 11:13:16 +08:00
parent 184f5fe9f4
commit 3c4d4081a4
16 changed files with 1538 additions and 1939 deletions

View File

@ -117,15 +117,17 @@ from src.gui.components.custom_widgets import FileSelectWidget
from src.gui.panels.step1_panel import Step1Panel
from src.gui.panels.step2_panel import Step2Panel
from src.gui.panels.step3_panel import Step3Panel
from src.gui.panels.step4_panel import Step4Panel
from src.gui.panels.step5_panel import Step5Panel
from src.gui.panels.step6_panel import Step6Panel # was step8_panel
from src.gui.panels.step7_panel import Step7Panel # was step6_panel
from src.gui.panels.step8_waterindex_panel import Step8WaterIndexPanel # 水色指数反演
from src.gui.panels.step9_concentration_panel import Step9ConcentrationPanel # 浓度反演
from src.gui.panels.step10_panel import Step10Panel # was step7_panel
from src.gui.panels.step11_ml_panel import Step11MlPanel # ML prediction (step11_ml)
from src.gui.panels.step14_panel import Step14Panel # was step9_panel
from src.gui.panels.step4_sampling_panel import Step4SamplingPanel # 采样点布设原step10→新step4
from src.gui.panels.step5_panel import Step5Panel # 数据清洗原step4→新step5
from src.gui.panels.step6_panel import Step6Panel # 光谱特征原step5→新step6
from src.gui.panels.step7_panel import Step7Panel # 水质光谱指数原step6→新step7
from src.gui.panels.step8_panel import Step8Panel # 水质参数指数原step7→新step8
from src.gui.panels.step8_waterindex_panel import Step9WaterColorPanel # 水色指数反演
from src.gui.panels.step9_concentration_panel import Step10ConcentrationPanel # 浓度反演
from src.gui.panels.step9_panel import Step9Panel # 机器学习建模原step8→新step9
from src.gui.panels.step10_ml_panel import Step10MlPanel # 机器学习预测原step11_ml→新step10
from src.gui.panels.step11_panel import Step11NonEmpiricalPanel # 非经验模型预测
from src.gui.panels.step14_panel import Step14Panel
from src.gui.dialogs import BandConfirmDialog, AISettingsDialog
from src.gui.panels.visualization_panel import VisualizationPanel
from src.gui.panels.report_generation_panel import ReportGenerationPanel
@ -1846,23 +1848,22 @@ class WaterQualityGUI(QMainWindow):
("step3", "3. 耀斑去除与修复"),
],
"阶段二:样本数据准备 ": [
("step4", "4. 数据标准化处理"),
("step5", "5. 光谱特征提取"),
("step6", "6. 水质参数指数计算"),
("step4", "4. 采样点布设"),
("step5", "5. 数据清洗"),
("step6", "6. 光谱特征"),
("step7", "7. 水质光谱指数计算"),
("step8", "8. 水质参数指数计算"),
],
"阶段三:模型构建与训练": [
("step7", "7. 机器学习模型训练"),
("step8_non_empirical_modeling", "8. 回归模型训练"),
("step9", "9. 自定义回归模型训练"),
("step9", "9. 机器学习"),
("step8_non_empirical_modeling", "8b. 回归模型训练"),
],
"阶段四:预测与成果输出 ": [
("step10", "10. 采样点布设"),
("step11_ml", "11. 机器学习预测"),
("step11", "12. 回归预测"),
("step12", "13. 自定义回归预测"),
("step14", "14. 专题图生成"),
("step9_viz", "15. 可视化分析"),
("step_report", "16. 分析报告生成"),
("step10", "10. 机器学习预测"),
("step11", "11. 回归预测"),
("step14", "12. 专题图生成"),
("step9_viz", "13. 可视化分析"),
("step_report", "14. 分析报告生成"),
]
}
@ -1882,7 +1883,7 @@ class WaterQualityGUI(QMainWindow):
self.step_list.addItem(stage_item)
# 添加该阶段的所有步骤
HIDDEN_STEP_IDS = {"step8_non_empirical_modeling", "step9", "step11", "step12"}
HIDDEN_STEP_IDS = {"step8_non_empirical_modeling"}
for step_id, step_display in steps:
if step_id in HIDDEN_STEP_IDS:
continue
@ -1956,29 +1957,35 @@ class WaterQualityGUI(QMainWindow):
self.step3_panel = Step3Panel()
self.step_stack.addTab(self.create_scroll_area(self.step3_panel), QIcon(self.get_icon_path("3.png")), "耀斑去除")
self.step4_panel = Step4Panel()
self.step_stack.addTab(self.create_scroll_area(self.step4_panel), QIcon(self.get_icon_path("4.png")), "数据清洗")
self.step4_panel = Step4SamplingPanel()
self.step_stack.addTab(self.create_scroll_area(self.step4_panel), QIcon(self.get_icon_path("4.png")), "采样点布设")
self.step5_panel = Step5Panel()
self.step_stack.addTab(self.create_scroll_area(self.step5_panel), QIcon(self.get_icon_path("5.png")), "特征构建")
self.step_stack.addTab(self.create_scroll_area(self.step5_panel), QIcon(self.get_icon_path("5.png")), "数据清洗")
self.step6_panel = Step6Panel()
self.step_stack.addTab(self.create_scroll_area(self.step6_panel), QIcon(self.get_icon_path("6.png")), "水质光谱指数计算")
self.step_stack.addTab(self.create_scroll_area(self.step6_panel), QIcon(self.get_icon_path("6.png")), "光谱特征")
self.step7_panel = Step7Panel()
self.step_stack.addTab(self.create_scroll_area(self.step7_panel), QIcon(self.get_icon_path("7.png")), "监督建模")
self.step_stack.addTab(self.create_scroll_area(self.step7_panel), QIcon(self.get_icon_path("7.png")), "水质光谱指数计算")
self.step8_waterindex_panel = Step8WaterIndexPanel()
self.step_stack.addTab(self.create_scroll_area(self.step8_waterindex_panel), QIcon(self.get_icon_path("6.png")), "色指数反演")
self.step8_panel = Step8Panel()
self.step_stack.addTab(self.create_scroll_area(self.step8_panel), QIcon(self.get_icon_path("7.png")), "质参数指数计算")
self.step9_concentration_panel = Step9ConcentrationPanel()
self.step_stack.addTab(self.create_scroll_area(self.step9_concentration_panel), QIcon(self.get_icon_path("6.png")), "浓度反演")
self.step9_panel = Step9Panel()
self.step_stack.addTab(self.create_scroll_area(self.step9_panel), QIcon(self.get_icon_path("8.png")), "机器学习建模")
self.step10_panel = Step10Panel()
self.step_stack.addTab(self.create_scroll_area(self.step10_panel), QIcon(self.get_icon_path("7.png")), "采样点布设")
self.step8_waterindex_panel = Step9WaterColorPanel()
self.step_stack.addTab(self.create_scroll_area(self.step8_waterindex_panel), QIcon(self.get_icon_path("8.png")), "水色指数反演")
self.step11_ml_panel = Step11MlPanel() # ML prediction panel (step11_ml)
self.step_stack.addTab(self.create_scroll_area(self.step11_ml_panel), QIcon(self.get_icon_path("8.png")), "监督预测")
self.step9_concentration_panel = Step10ConcentrationPanel()
self.step_stack.addTab(self.create_scroll_area(self.step9_concentration_panel), QIcon(self.get_icon_path("9.png")), "浓度反演")
self.step10_ml_panel = Step10MlPanel()
self.step_stack.addTab(self.create_scroll_area(self.step10_ml_panel), QIcon(self.get_icon_path("10.png")), "机器学习预测")
self.step11_non_empirical_panel = Step11NonEmpiricalPanel()
self.step_stack.addTab(self.create_scroll_area(self.step11_non_empirical_panel), QIcon(self.get_icon_path("11.png")), "回归预测")
self.step14_panel = Step14Panel()
self.step_stack.addTab(self.create_scroll_area(self.step14_panel), QIcon(self.get_icon_path("10.png")), "专题图生成")
@ -2133,12 +2140,12 @@ class WaterQualityGUI(QMainWindow):
'step5': 4,
'step6': 5,
'step7': 6,
'step8_non_empirical_modeling': 7,
'step8': 7,
'step9': 8,
'step10': 9,
'step11_ml': 10,
'step11': 11,
'step12': 12,
'step8_non_empirical_modeling': 9,
'step9_concentration': 10,
'step10': 11,
'step11': 12,
'step14': 13,
'step9_viz': 14,
'step_report': 15,
@ -2164,12 +2171,12 @@ class WaterQualityGUI(QMainWindow):
4: 'step5',
5: 'step6',
6: 'step7',
7: 'step8_non_empirical_modeling',
7: 'step8',
8: 'step9',
9: 'step10',
10: 'step11_ml',
11: 'step11',
12: 'step12',
9: 'step8_non_empirical_modeling',
10: 'step9_concentration',
11: 'step10',
12: 'step11',
13: 'step14',
14: 'step9_viz',
15: 'step_report',
@ -2199,44 +2206,48 @@ class WaterQualityGUI(QMainWindow):
elif index == 2:
self.step3_panel.update_from_config(work_dir=self.work_dir)
# Step4 切换时自动填充输出路径
# Step4(采样点布设)切换时自动填充输出路径
elif index == 3:
self.step4_panel.update_from_config(work_dir=self.work_dir)
# Step5 切换时自动填充数据流转路径
# Step5(数据清洗)切换时自动填充数据流转路径
elif index == 4:
self.step5_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step6水质光谱指数)切换时自动填充输出路径
# Step6光谱特征)切换时自动填充输出路径
elif index == 5:
self.step6_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step7监督建模)切换时自动填充训练数据和输出路径
# Step7水质光谱指数计算)切换时自动填充水质参数 CSV
elif index == 6:
self.step7_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step8 水色指数反演切换时自动填充光谱数据和输出路径
# Step8(水质参数指数计算)切换时自动填充水质参数 CSV
elif index == 7:
self.step8_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step9机器学习建模切换时自动填充训练数据和输出路径
elif index == 8:
self.step9_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step8b水色指数反演切换时自动填充光谱数据和输出路径
elif index == 9:
self.step8_waterindex_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step9 浓度反演切换时自动填充 QAA 结果和输出路径
elif index == 8:
# Step10浓度反演切换时自动填充 QAA 结果和输出路径
elif index == 10:
self.step9_concentration_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step10采样点布设切换时自动填充掩膜和输出路径
elif index == 9:
self.step10_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step11机器学习预测切换时自动填充采样光谱和模型目录
elif index == 10:
self.step11_ml_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
elif index == 11:
self.step10_ml_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# Step14专题图生成切换时自动填充预测结果目录
elif index == 11:
elif index == 13:
self.step14_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
# 可视化分析面板切换时自动推断图像目录并加载目录树
elif index == 12:
elif index == 14:
self.viz_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
def apply_stylesheet(self):
@ -2285,9 +2296,9 @@ class WaterQualityGUI(QMainWindow):
if 'step7' in config:
self.step7_panel.set_config(config['step7'])
if 'step10' in config:
self.step10_panel.set_config(config['step10'])
self.step4_panel.set_config(config['step10'])
if 'step11_ml' in config:
self.step11_ml_panel.set_config(config['step11_ml'])
self.step10_ml_panel.set_config(config['step11_ml'])
if 'step14' in config:
self.step14_panel.set_config(config['step14'])
if 'visualization' in config:
@ -2334,8 +2345,8 @@ class WaterQualityGUI(QMainWindow):
'step5': self.step5_panel.get_config(),
'step6': self.step6_panel.get_config(),
'step7': self.step7_panel.get_config(),
'step10': self.step10_panel.get_config(),
'step11_ml': self.step11_ml_panel.get_config(),
'step10': self.step4_panel.get_config(),
'step11_ml': self.step10_ml_panel.get_config(),
'step14': self.step14_panel.get_config(),
'visualization': self.viz_panel.get_config(),
'report_generation': self.report_panel.get_config(),
@ -2389,8 +2400,8 @@ class WaterQualityGUI(QMainWindow):
'step5': self.step5_panel,
'step6': self.step6_panel,
'step7': self.step7_panel,
'step10': self.step10_panel,
'step11_ml': self.step11_ml_panel,
'step10': self.step4_panel,
'step11_ml': self.step10_ml_panel,
'step14': self.step14_panel,
}
return panel_map.get(step_id)
@ -2591,8 +2602,8 @@ class WaterQualityGUI(QMainWindow):
('step5', self.step5_panel),
('step6', self.step6_panel),
('step7', self.step7_panel),
('step10', self.step10_panel),
('step11_ml', self.step11_ml_panel),
('step10', self.step4_panel),
('step11_ml', self.step10_ml_panel),
('step14', self.step14_panel)
]
@ -3219,14 +3230,14 @@ class WaterQualityGUI(QMainWindow):
def update_ui_for_training_mode(self):
"""根据训练数据模式更新UI状态"""
# 需要禁用的步骤ID对应无训练数据模式下需要禁用的步骤
disabled_step_ids = ['step4', 'step5', 'step6', 'step7', 'step8_non_empirical_modeling', 'step9']
disabled_step_ids = ['step4', 'step5', 'step6', 'step7', 'step8', 'step8_non_empirical_modeling', 'step9']
# 更新标签页的启用/禁用状态
step_id_to_tab = {
'step1': 0, 'step2': 1, 'step3': 2, 'step4': 3,
'step5': 4, 'step6': 5, 'step7': 6, 'step8_non_empirical_modeling': 7,
'step9': 8, 'step10': 9, 'step11_ml': 10, 'step11': 11,
'step12': 12, 'step14': 13, 'step9_viz': 14
'step5': 4, 'step6': 5, 'step7': 6, 'step8': 7,
'step9': 8, 'step8_non_empirical_modeling': 9, 'step9_concentration': 10,
'step10': 11, 'step11': 12, 'step14': 13, 'step9_viz': 14
}
for step_id in disabled_step_ids: