Step5: 强制锁死GUI路由字典,替换全部旧step_id为新命名
This commit is contained in:
@ -118,19 +118,16 @@ 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_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.step5_clean_panel import Step5CleanPanel # 数据清洗
|
||||
from src.gui.panels.step6_feature_panel import Step6FeaturePanel # 光谱特征
|
||||
from src.gui.panels.step7_index_panel import Step7IndexPanel # 水质光谱指数
|
||||
from src.gui.panels.step10_map_panel import Step10MapPanel # 水色指数反演
|
||||
from src.gui.panels.step8_ml_train_panel import Step8MlTrainPanel # 机器学习建模
|
||||
from src.gui.panels.step9_ml_predict_panel import Step9MlPredictPanel # 机器学习预测
|
||||
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
|
||||
from src.gui.panels.step11_viz_panel import Step11VizPanel # 可视化(覆盖旧 step11_viz_panel.py)
|
||||
from src.gui.panels.step12_report_panel import Step12ReportPanel # 报告生成
|
||||
|
||||
# Pipeline 核心异常(用于预检弹窗)
|
||||
from src.core.pipeline.runner import PipelineHalt
|
||||
@ -1382,93 +1379,64 @@ class WaterQualityGUI(QMainWindow):
|
||||
'deglint_goodman': '3_deglint/deglint_goodman.bsq',
|
||||
'deglint_hedley': '3_deglint/deglint_hedley.bsq',
|
||||
'deglint_sugar': '3_deglint/deglint_sugar.bsq',
|
||||
'deglint_interpolated': '3_deglint/interpolated_*.bsq' # * = interpolation_method
|
||||
'deglint_interpolated': '3_deglint/interpolated_*.bsq'
|
||||
},
|
||||
'step4': {
|
||||
'step5_clean': {
|
||||
'processed_data': '4_processed_data/processed_data.csv'
|
||||
},
|
||||
'step5': {
|
||||
'step6_feature': {
|
||||
'training_spectra': '5_training_spectra/training_spectra.csv'
|
||||
},
|
||||
'step6': {
|
||||
'step7_index': {
|
||||
'water_indices': '6_water_quality_indices/water_quality_indices.csv'
|
||||
},
|
||||
'step7': {
|
||||
'models': '7_Supervised_Model_Training/' # 目录,包含各参数子目录
|
||||
'step8_ml_train': {
|
||||
'models': '7_Supervised_Model_Training/'
|
||||
},
|
||||
'step8_non_empirical_modeling': {
|
||||
'regression_models': '8_Regression_Modeling/' # 目录,包含各参数子目录
|
||||
},
|
||||
'step9': {
|
||||
'custom_regression_models': '9_Custom_Regression_Modeling/' # 目录
|
||||
},
|
||||
'step10': {
|
||||
'step4_sampling': {
|
||||
'sampling_points': '10_sampling/sampling_spectra.csv'
|
||||
},
|
||||
'step11_ml': {
|
||||
'predictions': '11_12_13_predictions/Machine_Learning_Prediction/' # 目录,包含机器学习预测结果
|
||||
'step9_ml_predict': {
|
||||
'predictions': '11_12_13_predictions/Machine_Learning_Prediction/'
|
||||
},
|
||||
'step11': {
|
||||
'regression_predictions': '11_12_13_predictions/Non_Empirical_Prediction/' # 目录,包含非经验模型预测结果
|
||||
},
|
||||
'step12': {
|
||||
'custom_predictions': '11_12_13_predictions/Custom_Regression_Prediction/' # 目录,包含自定义回归预测结果
|
||||
},
|
||||
'step14': {
|
||||
'distribution_maps': '14_visualization/' # 目录,包含专题图
|
||||
'step10_map': {
|
||||
'distribution_maps': '14_visualization/'
|
||||
}
|
||||
}
|
||||
|
||||
# 定义步骤间的依赖关系:{当前步骤: {输入字段: (依赖步骤, 输出类型, 面板属性名)}}
|
||||
self.step_dependencies = {
|
||||
'step2': {
|
||||
'img_path': ('step1', 'reference_img', 'img_file'), # 步骤2需要参考影像
|
||||
'water_mask_path': ('step1', 'water_mask', 'water_mask_file') # 步骤2可选水域掩膜
|
||||
'img_path': ('step1', 'reference_img', 'img_file'),
|
||||
'water_mask_path': ('step1', 'water_mask', 'water_mask_file')
|
||||
},
|
||||
'step3': {
|
||||
'img_path': ('step1', 'reference_img', 'img_file'), # 步骤3需要参考影像
|
||||
'water_mask': ('step1', 'water_mask', 'water_mask_file'), # 步骤3需要水域掩膜
|
||||
'img_path': ('step1', 'reference_img', 'img_file'),
|
||||
'water_mask': ('step1', 'water_mask', 'water_mask_file'),
|
||||
},
|
||||
'step4': {
|
||||
# 步骤4主要处理CSV文件,一般不依赖前面步骤的输出
|
||||
'step6_feature': {
|
||||
'deglint_img_path': ('step3', 'deglint_image', 'deglint_img_file'),
|
||||
'csv_path': ('step5_clean', 'processed_data', 'csv_file'),
|
||||
'boundary_mask_path': ('step1', 'water_mask', 'boundary_mask_file'),
|
||||
'glint_mask_path': ('step2', 'glint_mask', 'glint_mask_file')
|
||||
},
|
||||
'step5': {
|
||||
'deglint_img_path': ('step3', 'deglint_image', 'deglint_img_file'), # 步骤5需要去耀斑影像
|
||||
'csv_path': ('step4', 'processed_data', 'csv_file'), # 步骤5需要处理后的CSV
|
||||
'boundary_mask_path': ('step1', 'water_mask', 'boundary_mask_file'), # 步骤5可选水体掩膜
|
||||
'glint_mask_path': ('step2', 'glint_mask', 'glint_mask_file') # 步骤5可选耀斑掩膜
|
||||
'step7_index': {
|
||||
'training_csv_path': ('step6_feature', 'training_spectra', 'output_file')
|
||||
},
|
||||
'step6': {
|
||||
'training_csv_path': ('step5', 'training_spectra', 'output_file') # 步骤6需要步骤5输出的训练光谱
|
||||
'step8_ml_train': {
|
||||
'training_csv_path': ('step7_index', 'water_indices', 'csv_file')
|
||||
},
|
||||
'step7': {
|
||||
'csv_path': ('step5', 'training_spectra', 'csv_file') # 步骤7需要训练光谱数据
|
||||
'step4_sampling': {
|
||||
'deglint_img_path': ('step3', 'deglint_image', 'deglint_img_file'),
|
||||
'water_mask_path': ('step1', 'water_mask', 'water_mask_file'),
|
||||
'glint_mask_path': ('step2', 'glint_mask', 'glint_mask_file')
|
||||
},
|
||||
'step8_non_empirical_modeling': {
|
||||
'csv_path': ('step5', 'training_spectra', 'csv_file') # 步骤8非经验建模需要训练光谱数据
|
||||
'step9_ml_predict': {
|
||||
'sampling_csv_path': ('step4_sampling', 'sampling_points', 'sampling_csv_file'),
|
||||
'models_dir': ('step8_ml_train', 'models', 'models_dir_file')
|
||||
},
|
||||
'step9': {
|
||||
'csv_path': ('step5', 'training_spectra', 'csv_file') # 步骤9需要训练光谱数据
|
||||
},
|
||||
'step10': {
|
||||
'deglint_img_path': ('step3', 'deglint_image', 'deglint_img_file'), # 步骤10需要去耀斑影像
|
||||
'water_mask_path': ('step1', 'water_mask', 'water_mask_file'), # 步骤10需要水域掩膜
|
||||
'glint_mask_path': ('step2', 'glint_mask', 'glint_mask_file') # 步骤10可选耀斑掩膜
|
||||
},
|
||||
'step11_ml': {
|
||||
'sampling_csv_path': ('step10', 'sampling_points', 'sampling_csv_file'), # 步骤11ML需要采样点
|
||||
'models_dir': ('step7', 'models', 'models_dir_file') # 步骤11ML需要训练好的模型
|
||||
},
|
||||
'step11': {
|
||||
'sampling_csv_path': ('step10', 'sampling_points', 'sampling_csv_file'), # 步骤11需要采样点
|
||||
'models_dir': ('step8_non_empirical_modeling', 'regression_models', 'models_dir') # 步骤11需要回归模型
|
||||
},
|
||||
'step12': {
|
||||
'sampling_csv_path': ('step10', 'sampling_points', 'sampling_csv_file'), # 步骤12需要采样点
|
||||
'models_dir': ('step9', 'custom_regression_models', 'models_dir') # 步骤12需要自定义回归模型
|
||||
},
|
||||
'step14': {
|
||||
'prediction_csv_path': ('step11_ml', 'predictions', 'prediction_csv_file') # 步骤14需要预测结果CSV
|
||||
'step10_map': {
|
||||
'prediction_csv_path': ('step9_ml_predict', 'predictions', 'prediction_csv_file')
|
||||
}
|
||||
}
|
||||
|
||||
@ -1845,25 +1813,22 @@ class WaterQualityGUI(QMainWindow):
|
||||
"阶段一:影像预处理": [
|
||||
("step1", "1. 水域掩膜生成"),
|
||||
("step2", "2. 耀斑区域识别"),
|
||||
("step3", "3. 耀斑去除与修复"),
|
||||
("step3", "3. 耀斑去除与修复")
|
||||
],
|
||||
"阶段二:样本数据准备": [
|
||||
("step4", "4. 采样点布设"),
|
||||
("step5", "5. 数据清洗"),
|
||||
("step6", "6. 光谱特征"),
|
||||
("step7", "7. 水质光谱指数计算"),
|
||||
("step8", "8. 水质参数指数计算"),
|
||||
("step4_sampling", "4. 采样点布设"),
|
||||
("step5_clean", "5. 数据清洗"),
|
||||
("step6_feature", "6. 光谱特征提取"),
|
||||
("step7_index", "7. 水质指数计算")
|
||||
],
|
||||
"阶段三:模型构建与训练": [
|
||||
("step9", "9. 机器学习建模"),
|
||||
("step8_ml_train", "8. 机器学习建模")
|
||||
],
|
||||
"阶段四:预测与成果输出": [
|
||||
("step10", "10. 机器学习预测"),
|
||||
("step8_non_empirical_modeling", "11. 水色指数反演"),
|
||||
("step9_concentration", "12. 浓度反演"),
|
||||
("step14", "14. 专题图生成"),
|
||||
("step9_viz", "15. 可视化分析"),
|
||||
("step_report", "16. 分析报告生成"),
|
||||
("step9_ml_predict", "9. 机器学习预测"),
|
||||
("step10_map", "10. 专题图生成"),
|
||||
("step11_viz", "11. 可视化展示"),
|
||||
("step12_report", "12. 分析报告生成")
|
||||
]
|
||||
}
|
||||
|
||||
@ -1883,11 +1848,7 @@ class WaterQualityGUI(QMainWindow):
|
||||
self.step_list.addItem(stage_item)
|
||||
|
||||
# 添加该阶段的所有步骤
|
||||
HIDDEN_STEP_IDS = {"step8_non_empirical_modeling"}
|
||||
for step_id, step_display in steps:
|
||||
if step_id in HIDDEN_STEP_IDS:
|
||||
continue
|
||||
|
||||
item = QListWidgetItem(f" └─ {step_display}")
|
||||
item.setData(Qt.UserRole, step_id)
|
||||
|
||||
@ -1960,38 +1921,32 @@ class WaterQualityGUI(QMainWindow):
|
||||
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.step5_clean_panel = Step5CleanPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step5_clean_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.step6_feature_panel = Step6FeaturePanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step6_feature_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.step7_index_panel = Step7IndexPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step7_index_panel), QIcon(self.get_icon_path("7.png")), "水质光谱指数计算")
|
||||
|
||||
self.step8_panel = Step8Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step8_panel), QIcon(self.get_icon_path("7.png")), "水质参数指数计算")
|
||||
self.step8_ml_train_panel = Step8MlTrainPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step8_ml_train_panel), QIcon(self.get_icon_path("8.png")), "机器学习建模")
|
||||
|
||||
self.step9_panel = Step9Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step9_panel), QIcon(self.get_icon_path("8.png")), "机器学习建模")
|
||||
self.step9_ml_predict_panel = Step9MlPredictPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step9_ml_predict_panel), QIcon(self.get_icon_path("10.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.step10_ml_panel = Step10MlPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step10_ml_panel), QIcon(self.get_icon_path("10.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_map_panel = Step10MapPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step10_map_panel), QIcon(self.get_icon_path("10.png")), "专题图生成")
|
||||
|
||||
self.step14_panel = Step14Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step14_panel), QIcon(self.get_icon_path("10.png")), "专题图生成")
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step14_panel), QIcon(self.get_icon_path("11.png")), "专题图生成")
|
||||
|
||||
self.viz_panel = VisualizationPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.viz_panel), QIcon(self.get_icon_path("9.png")), "可视化")
|
||||
self.step11_viz_panel = Step11VizPanel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step11_viz_panel), QIcon(self.get_icon_path("9.png")), "可视化")
|
||||
|
||||
self.report_panel = ReportGenerationPanel(main_window=self)
|
||||
self.step_stack.addTab(self.create_scroll_area(self.report_panel), QIcon(self.get_icon_path("10.png")), "报告生成")
|
||||
self.step12_report_panel = Step12ReportPanel(main_window=self)
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step12_report_panel), QIcon(self.get_icon_path("10.png")), "报告生成")
|
||||
|
||||
# 连接Tab切换信号,实现双向同步(必须在step_stack创建后)
|
||||
self.step_stack.currentChanged.connect(self.on_tab_changed)
|
||||
@ -2133,18 +2088,15 @@ class WaterQualityGUI(QMainWindow):
|
||||
'step1': 0,
|
||||
'step2': 1,
|
||||
'step3': 2,
|
||||
'step4': 3,
|
||||
'step5': 4,
|
||||
'step6': 5,
|
||||
'step7': 6,
|
||||
'step8': 7,
|
||||
'step9': 8,
|
||||
'step10': 9,
|
||||
'step8_non_empirical_modeling': 10,
|
||||
'step9_concentration': 11,
|
||||
'step14': 12,
|
||||
'step9_viz': 13,
|
||||
'step_report': 14,
|
||||
'step4_sampling': 3,
|
||||
'step5_clean': 4,
|
||||
'step6_feature': 5,
|
||||
'step7_index': 6,
|
||||
'step8_ml_train': 7,
|
||||
'step9_ml_predict': 8,
|
||||
'step10_map': 9,
|
||||
'step11_viz': 11,
|
||||
'step12_report': 12,
|
||||
}
|
||||
|
||||
if item_data in step_id_to_tab:
|
||||
@ -2163,18 +2115,16 @@ class WaterQualityGUI(QMainWindow):
|
||||
0: 'step1',
|
||||
1: 'step2',
|
||||
2: 'step3',
|
||||
3: 'step4',
|
||||
4: 'step5',
|
||||
5: 'step6',
|
||||
6: 'step7',
|
||||
7: 'step8',
|
||||
8: 'step9',
|
||||
9: 'step10',
|
||||
10: 'step8_non_empirical_modeling',
|
||||
11: 'step9_concentration',
|
||||
12: 'step14',
|
||||
13: 'step9_viz',
|
||||
14: 'step_report',
|
||||
3: 'step4_sampling',
|
||||
4: 'step5_clean',
|
||||
5: 'step6_feature',
|
||||
6: 'step7_index',
|
||||
7: 'step8_ml_train',
|
||||
8: 'step9_ml_predict',
|
||||
9: 'step10_map',
|
||||
10: None, # 遗留 step14_panel,保留 tab 但不加入 process_stages
|
||||
11: 'step11_viz',
|
||||
12: 'step12_report',
|
||||
}
|
||||
|
||||
if index not in tab_to_step_id:
|
||||
@ -2207,43 +2157,35 @@ class WaterQualityGUI(QMainWindow):
|
||||
|
||||
# Step5(数据清洗)切换时自动填充数据流转路径
|
||||
elif index == 4:
|
||||
self.step5_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
self.step5_clean_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step6(光谱特征)切换时自动填充输出路径
|
||||
elif index == 5:
|
||||
self.step6_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
self.step6_feature_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step7(水质光谱指数计算)切换时自动填充水质参数 CSV
|
||||
elif index == 6:
|
||||
self.step7_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
self.step7_index_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step8(水质参数指数计算)切换时自动填充水质参数 CSV
|
||||
# Step8(机器学习建模)切换时自动填充训练数据和输出路径
|
||||
elif index == 7:
|
||||
self.step8_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
self.step8_ml_train_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step9(机器学习建模)切换时自动填充训练数据和输出路径
|
||||
# Step9(机器学习预测)切换时自动填充采样光谱和模型目录
|
||||
elif index == 8:
|
||||
self.step9_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
self.step9_ml_predict_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step10(机器学习预测)切换时自动填充采样光谱和模型目录
|
||||
# Step10(水色指数反演)切换时自动填充光谱数据和输出路径
|
||||
elif index == 9:
|
||||
self.step10_ml_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
self.step10_map_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step11(水色指数反演)切换时自动填充光谱数据和输出路径
|
||||
# Step12(专题图生成)切换时自动填充预测结果目录
|
||||
elif index == 10:
|
||||
self.step8_waterindex_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step12(浓度反演)切换时自动填充 QAA 结果和输出路径
|
||||
elif index == 11:
|
||||
self.step9_concentration_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step14(专题图生成)切换时自动填充预测结果目录
|
||||
elif index == 12:
|
||||
self.step14_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
# Step15(可视化分析)切换时自动推断图像目录并加载目录树
|
||||
elif index == 13:
|
||||
self.viz_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
# Step13(可视化分析)切换时自动推断图像目录并加载目录树
|
||||
elif index == 11:
|
||||
self.step11_viz_panel.update_from_config(work_dir=self.work_dir, pipeline=self.pipeline)
|
||||
|
||||
def apply_stylesheet(self):
|
||||
"""应用样式表 - 应用现代化设计风格"""
|
||||
@ -2282,24 +2224,22 @@ class WaterQualityGUI(QMainWindow):
|
||||
self.step2_panel.set_config(config['step2'])
|
||||
if 'step3' in config:
|
||||
self.step3_panel.set_config(config['step3'])
|
||||
if 'step4' in config:
|
||||
self.step4_panel.set_config(config['step4'])
|
||||
if 'step5' in config:
|
||||
self.step5_panel.set_config(config['step5'])
|
||||
if 'step6' in config:
|
||||
self.step6_panel.set_config(config['step6'])
|
||||
if 'step7' in config:
|
||||
self.step7_panel.set_config(config['step7'])
|
||||
if 'step10' in config:
|
||||
self.step4_panel.set_config(config['step10'])
|
||||
if 'step11_ml' in config:
|
||||
self.step10_ml_panel.set_config(config['step11_ml'])
|
||||
if 'step4_sampling' in config:
|
||||
self.step4_sampling_panel.set_config(config['step4_sampling'])
|
||||
if 'step5_clean' in config:
|
||||
self.step5_clean_panel.set_config(config['step5_clean'])
|
||||
if 'step6_feature' in config:
|
||||
self.step6_feature_panel.set_config(config['step6_feature'])
|
||||
if 'step7_index' in config:
|
||||
self.step7_index_panel.set_config(config['step7_index'])
|
||||
if 'step9_ml_predict' in config:
|
||||
self.step9_ml_predict_panel.set_config(config['step9_ml_predict'])
|
||||
if 'step14' in config:
|
||||
self.step14_panel.set_config(config['step14'])
|
||||
if 'visualization' in config:
|
||||
self.viz_panel.set_config(config['visualization'])
|
||||
if 'report_generation' in config:
|
||||
self.report_panel.set_config(config['report_generation'])
|
||||
if 'step11_viz' in config:
|
||||
self.step11_viz_panel.set_config(config['step11_viz'])
|
||||
if 'step12_report' in config:
|
||||
self.step12_report_panel.set_config(config['step12_report'])
|
||||
|
||||
self.config_file = file_path
|
||||
self.log_message(f"已加载配置: {file_path}", "info")
|
||||
@ -2336,15 +2276,16 @@ class WaterQualityGUI(QMainWindow):
|
||||
'step1': self.step1_panel.get_config(),
|
||||
'step2': self.step2_panel.get_config(),
|
||||
'step3': self.step3_panel.get_config(),
|
||||
'step4': self.step4_panel.get_config(),
|
||||
'step5': self.step5_panel.get_config(),
|
||||
'step6': self.step6_panel.get_config(),
|
||||
'step7': self.step7_panel.get_config(),
|
||||
'step10': self.step4_panel.get_config(),
|
||||
'step11_ml': self.step10_ml_panel.get_config(),
|
||||
'step4_sampling': self.step4_sampling_panel.get_config(),
|
||||
'step5_clean': self.step5_clean_panel.get_config(),
|
||||
'step6_feature': self.step6_feature_panel.get_config(),
|
||||
'step7_index': self.step7_index_panel.get_config(),
|
||||
'step8_ml_train': self.step8_ml_train_panel.get_config(),
|
||||
'step9_ml_predict': self.step9_ml_predict_panel.get_config(),
|
||||
'step10_map': self.step10_map_panel.get_config(),
|
||||
'step11_viz': self.step11_viz_panel.get_config(),
|
||||
'step12_report': self.step12_report_panel.get_config(),
|
||||
'step14': self.step14_panel.get_config(),
|
||||
'visualization': self.viz_panel.get_config(),
|
||||
'report_generation': self.report_panel.get_config(),
|
||||
}
|
||||
return config
|
||||
|
||||
@ -2391,12 +2332,15 @@ class WaterQualityGUI(QMainWindow):
|
||||
'step1': self.step1_panel,
|
||||
'step2': self.step2_panel,
|
||||
'step3': self.step3_panel,
|
||||
'step4': self.step4_panel,
|
||||
'step5': self.step5_panel,
|
||||
'step6': self.step6_panel,
|
||||
'step7': self.step7_panel,
|
||||
'step10': self.step4_panel,
|
||||
'step11_ml': self.step10_ml_panel,
|
||||
'step4_sampling': self.step4_sampling_panel,
|
||||
'step5_clean': self.step5_clean_panel,
|
||||
'step6_feature': self.step6_feature_panel,
|
||||
'step7_index': self.step7_index_panel,
|
||||
'step8_ml_train': self.step8_ml_train_panel,
|
||||
'step9_ml_predict': self.step9_ml_predict_panel,
|
||||
'step10_map': self.step10_map_panel,
|
||||
'step11_viz': self.step11_viz_panel,
|
||||
'step12_report': self.step12_report_panel,
|
||||
'step14': self.step14_panel,
|
||||
}
|
||||
return panel_map.get(step_id)
|
||||
@ -2489,17 +2433,17 @@ class WaterQualityGUI(QMainWindow):
|
||||
'1_water_mask': 'step1',
|
||||
'2_glint': 'step2',
|
||||
'3_deglint': 'step3',
|
||||
'4_processed_data': 'step4',
|
||||
'5_training_spectra': 'step5',
|
||||
'6_water_quality_indices': 'step6',
|
||||
'7_Supervised_Model_Training': 'step7',
|
||||
'8_Regression_Modeling': 'step8_non_empirical_modeling',
|
||||
'9_Custom_Regression_Modeling': 'step9',
|
||||
'10_sampling': 'step10',
|
||||
'11_12_13_predictions/Machine_Learning_Prediction': 'step11_ml',
|
||||
'11_12_13_predictions/Non_Empirical_Prediction': 'step11',
|
||||
'11_12_13_predictions/Custom_Regression_Prediction': 'step12',
|
||||
'14_visualization': 'step14'
|
||||
'4_processed_data': 'step4_sampling',
|
||||
'5_training_spectra': 'step5_clean',
|
||||
'6_water_quality_indices': 'step6_feature',
|
||||
'7_Supervised_Model_Training': 'step7_index',
|
||||
'8_Regression_Modeling': 'step8_ml_train',
|
||||
'9_Custom_Regression_Modeling': 'step9_ml_predict',
|
||||
'11_12_13_predictions/Machine_Learning_Prediction': 'step9_ml_predict',
|
||||
'11_12_13_predictions/Non_Empirical_Prediction': 'step10_map',
|
||||
'11_12_13_predictions/Custom_Regression_Prediction': 'step11_viz',
|
||||
'14_visualization': 'step12_report',
|
||||
'14_geotiff_batch_rendering': 'step14'
|
||||
}
|
||||
|
||||
for subdir, step_ids in subdirs.items():
|
||||
@ -2541,15 +2485,15 @@ class WaterQualityGUI(QMainWindow):
|
||||
discovered_outputs[step_id]['glint_mask'] = str(file_path)
|
||||
elif 'deglint' in file_name and step_id == 'step3':
|
||||
discovered_outputs[step_id]['deglint_image'] = str(file_path)
|
||||
elif 'processed_data' in file_name and step_id == 'step4':
|
||||
elif 'processed_data' in file_name and step_id == 'step4_sampling':
|
||||
discovered_outputs[step_id]['processed_data'] = str(file_path)
|
||||
elif 'training_spectra' in file_name and step_id == 'step5':
|
||||
elif 'training_spectra' in file_name and step_id == 'step5_clean':
|
||||
discovered_outputs[step_id]['training_spectra'] = str(file_path)
|
||||
elif 'water_quality_indices' in file_name and step_id == 'step6':
|
||||
elif 'water_quality_indices' in file_name and step_id == 'step6_feature':
|
||||
discovered_outputs[step_id]['water_indices'] = str(file_path)
|
||||
elif 'sampling_spectra' in file_name and step_id == 'step10':
|
||||
elif 'sampling_spectra' in file_name and step_id == 'step4_sampling':
|
||||
discovered_outputs[step_id]['sampling_points'] = str(file_path)
|
||||
elif file_name.endswith('.csv') and step_id in ['step11_ml', 'step11', 'step12']:
|
||||
elif file_name.endswith('.csv') and step_id in ['step9_ml_predict', 'step10_map', 'step11_viz']:
|
||||
discovered_outputs[step_id]['predictions'] = str(file_path)
|
||||
|
||||
# 更新内部记录
|
||||
@ -2572,8 +2516,8 @@ class WaterQualityGUI(QMainWindow):
|
||||
# 首先扫描工作目录发现已有的输出文件
|
||||
self.scan_work_directory_for_files(work_path)
|
||||
|
||||
step_order = ['step2', 'step3', 'step4', 'step5', 'step6', 'step7', 'step8_non_empirical_modeling', 'step9',
|
||||
'step10', 'step11_ml', 'step11', 'step12', 'step14']
|
||||
step_order = ['step2', 'step3', 'step4_sampling', 'step5_clean', 'step6_feature', 'step7_index',
|
||||
'step8_ml_train', 'step9_ml_predict', 'step10_map', 'step11_viz', 'step12_report', 'step14']
|
||||
|
||||
filled_count = 0
|
||||
for step_id in step_order:
|
||||
@ -2594,11 +2538,15 @@ class WaterQualityGUI(QMainWindow):
|
||||
panels_with_dependencies = [
|
||||
('step2', self.step2_panel),
|
||||
('step3', self.step3_panel),
|
||||
('step5', self.step5_panel),
|
||||
('step6', self.step6_panel),
|
||||
('step7', self.step7_panel),
|
||||
('step10', self.step4_panel),
|
||||
('step11_ml', self.step10_ml_panel),
|
||||
('step4_sampling', self.step4_sampling_panel),
|
||||
('step5_clean', self.step5_clean_panel),
|
||||
('step6_feature', self.step6_feature_panel),
|
||||
('step7_index', self.step7_index_panel),
|
||||
('step8_ml_train', self.step8_ml_train_panel),
|
||||
('step9_ml_predict', self.step9_ml_predict_panel),
|
||||
('step10_map', self.step10_map_panel),
|
||||
('step11_viz', self.step11_viz_panel),
|
||||
('step12_report', self.step12_report_panel),
|
||||
('step14', self.step14_panel)
|
||||
]
|
||||
|
||||
@ -2669,10 +2617,10 @@ class WaterQualityGUI(QMainWindow):
|
||||
self.statusBar().showMessage(f"工作目录: {dir_path}")
|
||||
|
||||
# 同步到可视化面板
|
||||
if hasattr(self, 'viz_panel'):
|
||||
self.viz_panel.set_work_dir(dir_path)
|
||||
if hasattr(self, 'report_panel'):
|
||||
self.report_panel.set_work_dir(dir_path)
|
||||
if hasattr(self, 'step11_viz_panel'):
|
||||
self.step11_viz_panel.set_work_dir(dir_path)
|
||||
if hasattr(self, 'step12_report_panel'):
|
||||
self.step12_report_panel.set_work_dir(dir_path)
|
||||
|
||||
def open_work_directory(self):
|
||||
"""打开工作目录"""
|
||||
@ -2991,11 +2939,11 @@ class WaterQualityGUI(QMainWindow):
|
||||
|
||||
# 准备实际运行配置(排除未启用的步骤)
|
||||
worker_config = copy.deepcopy(config)
|
||||
step6_cfg = worker_config.get('step6')
|
||||
step6_cfg = worker_config.get('step6_feature')
|
||||
if step6_cfg:
|
||||
enabled = step6_cfg.pop('enabled', True)
|
||||
if not enabled:
|
||||
worker_config.pop('step6', None)
|
||||
worker_config.pop('step6_feature', None)
|
||||
|
||||
# 工作线程内创建 Pipeline,避免主线程阻塞及 Qt5Agg 子线程绘图卡死
|
||||
self.worker = WorkerThread(work_dir, worker_config, mode='full', skip_list=skip_list)
|
||||
@ -3225,19 +3173,18 @@ class WaterQualityGUI(QMainWindow):
|
||||
def update_ui_for_training_mode(self):
|
||||
"""根据训练数据模式更新UI状态"""
|
||||
# 需要禁用的步骤ID(对应无训练数据模式下需要禁用的步骤)
|
||||
disabled_step_ids = ['step4', 'step5', 'step6', 'step7', 'step8', 'step8_non_empirical_modeling', 'step9']
|
||||
disabled_step_ids = ['step4_sampling', 'step5_clean', 'step6_feature', 'step7_index', 'step9_ml_predict']
|
||||
|
||||
# 更新标签页的启用/禁用状态
|
||||
step_id_to_tab = {
|
||||
'step1': 0, 'step2': 1, 'step3': 2, 'step4': 3,
|
||||
'step5': 4, 'step6': 5, 'step7': 6, 'step8': 7,
|
||||
'step9': 8, 'step10': 9, 'step8_non_empirical_modeling': 10,
|
||||
'step9_concentration': 11, 'step14': 12, 'step9_viz': 13, 'step_report': 14
|
||||
step_id_to_tab_training = {
|
||||
'step1': 0, 'step2': 1, 'step3': 2, 'step4_sampling': 3,
|
||||
'step5_clean': 4, 'step6_feature': 5, 'step7_index': 6, 'step9_ml_predict': 7,
|
||||
'step10_map': 8, 'step14': 10, 'step11_viz': 11, 'step12_report': 12
|
||||
}
|
||||
|
||||
for step_id in disabled_step_ids:
|
||||
if step_id in step_id_to_tab:
|
||||
tab_index = step_id_to_tab[step_id]
|
||||
if step_id in step_id_to_tab_training:
|
||||
tab_index = step_id_to_tab_training[step_id]
|
||||
if tab_index < self.step_stack.count():
|
||||
self.step_stack.setTabEnabled(tab_index, self.has_training_data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user