更新工作目录子文件夹的序号
This commit is contained in:
186
IMAGE_CONFIG.md
186
IMAGE_CONFIG.md
@ -1,186 +0,0 @@
|
||||
# Logo和横幅图像配置说明
|
||||
|
||||
## 功能概述
|
||||
|
||||
本更新实现了以下需求:
|
||||
1. **Logo在菜单栏左侧** - 和菜单栏在**同一行**
|
||||
2. **菜单栏在最右侧** - 使用弹性空间布局
|
||||
3. **横幅图片撑满整个区域** - 自适应窗口宽度
|
||||
|
||||
## 布局说明
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ [Logo] 文件 工具 帮助 │ ← 同一行:Logo在左,菜单在右
|
||||
├─────────────────────────────────────┤
|
||||
│ [软件名称横幅图 - 撑满宽度] │ ← 横幅撑满整个区域
|
||||
├─────────────────────────────────────┤
|
||||
│ │
|
||||
│ 主要内容区 │
|
||||
│ │
|
||||
```
|
||||
|
||||
## 配置步骤
|
||||
|
||||
### 1. 准备图像文件
|
||||
|
||||
将你的图像文件放在项目目录中。建议的目录结构:
|
||||
|
||||
```
|
||||
fengzhuang-ui2/
|
||||
├── assets/ # 推荐:创建资源目录
|
||||
│ ├── logo.png # 公司logo (建议高度30像素)
|
||||
│ └── banner.png # 软件名称横幅 (建议高度70像素)
|
||||
├── src/
|
||||
│ └── gui/
|
||||
│ └── water_quality_gui.py
|
||||
└── ...
|
||||
```
|
||||
|
||||
### 2. 修改图像路径
|
||||
|
||||
打开 `src/gui/water_quality_gui.py` 文件,找到以下两处代码:
|
||||
|
||||
#### Logo路径修改(create_logo_bar 方法中,第3928行左右)
|
||||
|
||||
```python
|
||||
# 修改前:
|
||||
logo_path = "path/to/your/logo.png"
|
||||
|
||||
# 修改后(使用相对路径):
|
||||
logo_path = "assets/logo.png"
|
||||
|
||||
# 或使用绝对路径:
|
||||
logo_path = r"E:\your\full\path\to\logo.png"
|
||||
```
|
||||
|
||||
#### 横幅路径修改(create_banner_widget 方法中,第3978行左右)
|
||||
|
||||
```python
|
||||
# 修改前:
|
||||
banner_path = "path/to/your/banner.png"
|
||||
|
||||
# 修改后(使用相对路径):
|
||||
banner_path = "assets/banner.png"
|
||||
|
||||
# 或使用绝对路径:
|
||||
banner_path = r"E:\your\full\path\to\banner.png"
|
||||
```
|
||||
|
||||
### 3. 图像规格建议
|
||||
|
||||
| 名称 | 建议尺寸 | 格式 | 说明 |
|
||||
|-----|--------|------|------|
|
||||
| Logo | 高度30像素 | PNG/JPG | 放在顶部Logo栏中,自动按高度缩放保持宽高比 |
|
||||
| 横幅 | 高度70像素 | PNG/JPG | 占据横幅区域,自动按高度缩放保持宽高比 |
|
||||
|
||||
### 4. 图像加载失败处理
|
||||
|
||||
如果图像文件未找到或加载失败,系统会自动显示占位符:
|
||||
|
||||
- **Logo占位符**: 显示"Logo"文本,背景为浅灰色
|
||||
- **横幅占位符**: 显示"软件名称横幅"文本,背景为蓝色,字体为24号加粗
|
||||
|
||||
### 5. 自适应缩放说明
|
||||
|
||||
为了避免图像拉伸,代码使用了 `scaledToHeight()` 方法:
|
||||
- Logo按高度30像素缩放,自动计算宽度,保持原始宽高比
|
||||
- 横幅按高度70像素缩放,自动计算宽度,保持原始宽高比
|
||||
|
||||
这样可以确保无论原始图像大小如何,都能自然地显示而不会出现拉伸变形。
|
||||
|
||||
## 常见问题
|
||||
|
||||
### Q: 如何使用项目内的图像资源?
|
||||
|
||||
**A**: 在项目中创建 `assets` 或 `resources` 文件夹,并使用相对路径:
|
||||
|
||||
```python
|
||||
# 假设项目结构:
|
||||
# fengzhuang-ui2/
|
||||
# ├── assets/
|
||||
# │ ├── logo.png
|
||||
# │ └── banner.png
|
||||
# └── src/gui/water_quality_gui.py
|
||||
|
||||
# 在 water_quality_gui.py 中(第3928行):
|
||||
logo_path = "assets/logo.png"
|
||||
|
||||
# 在 water_quality_gui.py 中(第3978行):
|
||||
banner_path = "assets/banner.png"
|
||||
```
|
||||
|
||||
### Q: Logo或横幅大小不合适?
|
||||
|
||||
**A**: 修改以下代码调整显示大小:
|
||||
|
||||
```python
|
||||
# 在 create_logo_bar() 方法中调整Logo大小
|
||||
logo_label.setFixedSize(60, 40) # 改为 60×40
|
||||
|
||||
# 在 create_banner_widget() 方法中调整横幅大小
|
||||
banner_label.setMaximumHeight(100) # 改为100像素高
|
||||
banner_label.setMinimumHeight(80) # 改为最小80像素高
|
||||
|
||||
# 调整缩放高度
|
||||
scaled_pixmap = logo_pixmap.scaledToHeight(35, Qt.SmoothTransformation) # 改为35
|
||||
scaled_pixmap = banner_pixmap.scaledToHeight(85, Qt.SmoothTransformation) # 改为85
|
||||
```
|
||||
|
||||
### Q: 如何隐藏Logo或横幅?
|
||||
|
||||
**A**: 在 `init_ui()` 方法中注释掉相应的创建方法:
|
||||
|
||||
```python
|
||||
# 在 init_ui() 中
|
||||
# self.create_logo_bar() # 注释此行隐藏Logo
|
||||
# self.create_banner_widget() # 注释此行隐藏横幅
|
||||
```
|
||||
|
||||
### Q: Logo显示位置不对?
|
||||
|
||||
**A**: Logo栏是作为独立的工具栏添加在菜单栏下方,不是在菜单栏内。当前的布局顺序是:
|
||||
1. 菜单栏 (最上方)
|
||||
2. Logo栏 (菜单栏下方)
|
||||
3. 横幅区域 (Logo栏下方)
|
||||
4. 主内容区域 (最下方)
|
||||
|
||||
### Q: 图像在高分辨率屏幕上看起来模糊?
|
||||
|
||||
**A**: 使用 `Qt.SmoothTransformation` 可以改善图像质量。如果仍然不够清晰,可以准备高分辨率的原始图像。
|
||||
|
||||
## 代码位置
|
||||
|
||||
- **Logo栏创建**: `create_logo_bar()` 方法 (第3902行)
|
||||
- **横幅区域创建**: `create_banner_widget()` 方法 (第3950行)
|
||||
- **主UI初始化**: `init_ui()` 方法 (第3821行)
|
||||
|
||||
## 支持的图像格式
|
||||
|
||||
- PNG (推荐,支持透明背景)
|
||||
- JPG/JPEG
|
||||
- BMP
|
||||
- GIF
|
||||
- TIFF
|
||||
|
||||
## 样式调整
|
||||
|
||||
如需修改样式(背景色、边框等),编辑以下位置的 `setStyleSheet()` 调用:
|
||||
|
||||
```python
|
||||
# Logo样式(第3907-3916行)
|
||||
logo_toolbar.setStyleSheet("""...""")
|
||||
|
||||
# 占位符样式(第3931行)
|
||||
logo_label.setStyleSheet("...")
|
||||
|
||||
# 横幅占位符样式(第3959-3965行)
|
||||
banner_label.setStyleSheet("""...""")
|
||||
```
|
||||
|
||||
## 更新日期
|
||||
2026-03-27
|
||||
|
||||
## 备注
|
||||
|
||||
所有的图像路径都可以根据你的实际项目结构灵活调整。建议将图像文件与代码一起版本控制,以确保项目的可维护性。
|
||||
@ -1,4 +1,4 @@
|
||||
Formula_Name,Category,Formula,Reference
|
||||
Formula_Name,Category,Formula,Reference
|
||||
BGA_Am09KBBI,Phycocyanin (BGA_PC),(w686 - w658) / (w686 + w658),"Amin, R.; Zhou, J.; Gilerson, A.; Gross, B.; Moshary, F.; Ahmed, S.; Novel optical techniques for detecting and classifying toxic dinoflagellate Karenia brevis blooms using satellite imagery, Optics Express, 2009, 17, 11, 1-13."
|
||||
BGA_Be162B643sub629,Phycocyanin (BGA_PC),w644 - w629,"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 538."
|
||||
BGA_Be162B700sub601,Phycocyanin (BGA_PC),w700 - w601,"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 539."
|
||||
@ -12,35 +12,35 @@ BGA_Be16NDPhyI644over615,Phycocyanin (BGA_PC),(w644 - w615) / (w644 + w615),"Bec
|
||||
BGA_Be16NDPhyI644over629,Phycocyanin (BGA_PC),(w644 - w629) / (w644 + w629),"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 542."
|
||||
BGA_Be16Phy2BDA644over629,Phycocyanin (BGA_PC),w644 / w629,"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 545."
|
||||
BGA_Da052BDA,Phycocyanin (BGA_PC),w714 / w672,"Wynne, T. T., Stumpf, R. P., Tomlinson, M. C., Warner, R. A., Tester, P. A., Dyble, J.; Relating spectral shape to cyanobacterial blooms in the Laurentian Great Lakes. Int. J. Remote Sens., 2008, 29, 3665-3672."
|
||||
BGA_Go04MCI,Phycocyanin (BGA_PC),w709 - w681 - (w753 - w681),"Gower, J.F.R.; Brown,L.; Borstad, G.A.; Observation of chlorophyll fluorescence in west coast waters of Canada using the MODIS satellite sensor. Can. J. Remote Sens., 2004, 30 (1), 17闁?5."
|
||||
BGA_Go04MCI,Phycocyanin (BGA_PC),w709 - w681 - (w753 - w681),"Gower, J.F.R.; Brown,L.; Borstad, G.A.; Observation of chlorophyll fluorescence in west coast waters of Canada using the MODIS satellite sensor. Can. J. Remote Sens., 2004, 30 (1), 17<EFBFBD><EFBFBD>?5."
|
||||
BGA_HU103BDA,Phycocyanin (BGA_PC),(((1 / w615) - (1 / w600)) - w725),"Hunter, P.D.; Tyler, A.N.; Willby, N.J.; Gilvear, D.J.; The spatial dynamics of vertical migration by Microcystis aeruginosa in a eutrophic shallow lake: A case study using high spatial resolution time-series airborne remote sensing. Limn. Oceanogr. 2008, 53, 2391-2406"
|
||||
BGA_Ku15PhyCI,Phycocyanin (BGA_PC),(-1 * (W681 - W665 - (W709 - W665))),"Kudela, R.M., Palacios, S.L., Austerberry, D.C., Accorsi, E.K., Guild, L.S.; Application of hyperspectral remote sensing to cyanobacterial blooms in inland waters, Torres-Perez, J., 2015, Remote Sens. Environ., 2015, 167, 1-10."
|
||||
BGA_Ku15SLH,Phycocyanin (BGA_PC),(w715 - w658) + (w715 - w658),"Kudela, R.M., Palacios, S.L., Austerberry, D.C., Accorsi, E.K., Guild, L.S.; Application of hyperspectral remote sensing to cyanobacterial blooms in inland waters, Torres-Perez, J., 2015, Remote Sens. Environ., 2015, 167, 1-11."
|
||||
BGA_MI092BDA,Phycocyanin (BGA_PC),w700 / w600,"Mishra, S.; Mishra, D.R.; Schluchter, W. M., A novel algorithm for predicting PC concentrations in cyanobacteria: A proximal hyperspectral remote sensing approach. Remote Sens., 2009, 1, 758闁?75."
|
||||
BGA_MM092BDA,Phycocyanin (BGA_PC),w724 / w600,"Mishra, S.; Mishra, D.R.; Schluchter, W. M., A novel algorithm for predicting PC concentrations in cyanobacteria: A proximal hyperspectral remote sensing approach. Remote Sens., 2009, 1, 758闁?76."
|
||||
BGA_MI092BDA,Phycocyanin (BGA_PC),w700 / w600,"Mishra, S.; Mishra, D.R.; Schluchter, W. M., A novel algorithm for predicting PC concentrations in cyanobacteria: A proximal hyperspectral remote sensing approach. Remote Sens., 2009, 1, 758<EFBFBD><EFBFBD>?75."
|
||||
BGA_MM092BDA,Phycocyanin (BGA_PC),w724 / w600,"Mishra, S.; Mishra, D.R.; Schluchter, W. M., A novel algorithm for predicting PC concentrations in cyanobacteria: A proximal hyperspectral remote sensing approach. Remote Sens., 2009, 1, 758<EFBFBD><EFBFBD>?76."
|
||||
BGA_MM12NDCIalt,Phycocyanin (BGA_PC),(w700 - w658) / (w700 + w658),"Mishra, S.; Mishra, D.R.; A novel remote sensing algorithm to quantify phycocyanin in cyanobacterial algal blooms, Env. Res. Lett., 2014, 9 (11), DOI:10.1088/1748-9326/9/11/114003"
|
||||
BGA_MM143BDAopt,Phycocyanin (BGA_PC),((1 / w629) - (1 / w659)) * w724,"Mishra, S.; Mishra, D.R.; A novel remote sensing algorithm to quantify phycocyanin in cyanobacterial algal blooms, Env. Res. Lett., 2014, 9 (11), DOI:10.1088/1748-9326/9/11/114004"
|
||||
BGA_SI052BDA,Phycocyanin (BGA_PC),w709 / w620,"Simis, S. G. H.; Peters, S.W. M.; Gons, H. J.; Remote sensing of the cyanobacteria pigment phycocyanin in turbid inland water. Limn. Oceanogr., 2005, 50, 237闁?45"
|
||||
BGA_SI052BDA,Phycocyanin (BGA_PC),w709 / w620,"Simis, S. G. H.; Peters, S.W. M.; Gons, H. J.; Remote sensing of the cyanobacteria pigment phycocyanin in turbid inland water. Limn. Oceanogr., 2005, 50, 237<EFBFBD><EFBFBD>?45"
|
||||
BGA_SM122BDA,Phycocyanin (BGA_PC),w709 / w600,"Mishra, S. Remote sensing of cyanobacteria in turbid productive waters, PhD Dissertation. Mississippi State University, USA. 2012."
|
||||
BGA_SY002BDA,Phycocyanin (BGA_PC),w650 / w625,"Schalles, J.; Yacobi, Y. Remote detection and seasonal patterns of phycocyanin, carotenoid and chlorophyll-a pigments in eutrophic waters. Archiv fur Hydrobiologie, Special Issues Advances in Limnology, 2000, 55,153闁?68"
|
||||
BGA_SY002BDA,Phycocyanin (BGA_PC),w650 / w625,"Schalles, J.; Yacobi, Y. Remote detection and seasonal patterns of phycocyanin, carotenoid and chlorophyll-a pigments in eutrophic waters. Archiv fur Hydrobiologie, Special Issues Advances in Limnology, 2000, 55,153<EFBFBD><EFBFBD>?68"
|
||||
BGA_Wy08CI,Phycocyanin (BGA_PC),(-1 * (W686 - W672 - (W715 - W672))),"Wynne, T. T., Stumpf, R. P., Tomlinson, M. C., Warner, R. A., Tester, P. A., Dyble, J.; Relating spectral shape to cyanobacterial blooms in the Laurentian Great Lakes. Int. J. Remote Sens., 2008, 29, 3665-3672."
|
||||
Chl_Al10SABI,chlorophyll_a,(w857 - w644) / (w458 + w529),"Alawadi, F. Detection of surface algal blooms using the newly developed algorithm surface algal bloom index (SABI). Proc. SPIE 2010, 7825."
|
||||
Chl_Am092Bsub,chlorophyll_a,w681 - w665,"Amin, R.; Zhou, J.; Gilerson, A.; Gross, B.; Moshary, F.; Ahmed, S. Novel optical techniques for detecting and classifying toxic dinoflagellate Karenia brevis blooms using satellite imagery. Opt. Express 2009, 17, 9126闁?144."
|
||||
Chl_Am092Bsub,chlorophyll_a,w681 - w665,"Amin, R.; Zhou, J.; Gilerson, A.; Gross, B.; Moshary, F.; Ahmed, S. Novel optical techniques for detecting and classifying toxic dinoflagellate Karenia brevis blooms using satellite imagery. Opt. Express 2009, 17, 9126<EFBFBD><EFBFBD>?144."
|
||||
Chl_Be16FLHblue,chlorophyll_a,w529 - (w644 + (w458 - w644)),"Beck, R.A. and 22 others; Comparison of satellite reflectance algorithms for estimating chlorophyll-a in a temperate reservoir using coincident hyperspectral aircraft imagery and dense coincident surface observations, Remote Sens. Environ., 2016, 178, 15-30."
|
||||
Chl_Be16FLHviolet,chlorophyll_a,w529 - (w644 + (w429 - w644)),"Beck, R.A. and 22 others; Comparison of satellite reflectance algorithms for estimating chlorophyll-a in a temperate reservoir using coincident hyperspectral aircraft imagery and dense coincident surface observations, Remote Sens. Environ., 2016, 178, 15-30."
|
||||
Chl_Be16NDTIblue,chlorophyll_a,(w658 - w458) / (w658 + w458),"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 543."
|
||||
Chl_Be16NDTIviolet,chlorophyll_a,(w658 - w444) / (w658 + w444),"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 544."
|
||||
Chl_De933BDA,chlorophyll_a,w600 - w648 - w625,"Dekker, A.; Detection of the optical water quality parameters for eutrophic waters by high resolution remote sensing, Ph.D. thesis, 1993, Free University, Amsterdam."
|
||||
Chl_Gi033BDA,chlorophyll_a,((1 / w672) - (1 / w715)) * w757,"Gitelson, A.A.; U. Gritz, and M. N. Merzlyak.; Relationships between leaf chlorophyll content and spectral reflectance and algorithms for non-destructive chlorophyll assessment in higher plant leaves. J. Plant Phys. 2003, 160, 271-282."
|
||||
Chl_Kn07KIVU,chlorophyll_a,(w458 - w644) / w529,"Kneubuhler, M.; Frank T.; Kellenberger, T.W; Pasche N.; Schmid M.; Mapping chlorophyll-a in Lake Kivu with remote sensing methods. 2007, Proceedings of the Envisat Symposium 2007, Montreux, Switzerland 23闁?7 April 2007 (ESA SP-636, July 2007)."
|
||||
Chl_Kn07KIVU,chlorophyll_a,(w458 - w644) / w529,"Kneubuhler, M.; Frank T.; Kellenberger, T.W; Pasche N.; Schmid M.; Mapping chlorophyll-a in Lake Kivu with remote sensing methods. 2007, Proceedings of the Envisat Symposium 2007, Montreux, Switzerland 23<EFBFBD><EFBFBD>?7 April 2007 (ESA SP-636, July 2007)."
|
||||
Chl_MM12NDCI,chlorophyll_a,(w715 - w686) / (w715 + w686),"Mishra, S.; and Mishra, D.R. Normalized difference chlorophyll index: A novel model for remote estimation of chlorophyll-a concentration in turbid productive waters, Remote Sens. Environ., 2012, 117, 394-406"
|
||||
Chl_Zh10FLH,chlorophyll_a,w686 - (w715 + (w672 - w751)),"Zhao, D.Z.; Xing, X.G.; Liu, Y.G.; Yang, J.H.; Wang, L. The relation of chlorophyll-a concentration with the reflectance peak near 700 nm in algae-dominated waters and sensitivity of fluorescence algorithms for detecting algal bloom. Int. J. Remote Sens. 2010, 31, 39-48"
|
||||
Turb_Be16GreenPlusRedBothOverViolet,Turbidity,(w558 + w658) / w444,"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 538"
|
||||
Turb_Be16RedOverViolet,Turbidity,w658 / w444,"Beck, R.; Xu, M.; Zhan, S.; Liu, H.; Johansen, R.A.; Tong, S.; Yang, B.; Shu, S.; Wu, Q.; Wang, S.; Berling, K.; Murray, A.; Emery, E.; Reif, M.; Harwood, J.; Young, J.; Martin, M.; Stillings, G.; Stumpf, R.; Su, H.; Ye, Z.; Huang, Y. Comparison of Satellite Reflectance Algorithms for Estimating Phycocyanin Values and Cyanobacterial Total Biovolume in a Temperate Reservoir Using Coincident Hyperspectral Aircraft Imagery and Dense Coincident Surface Observations. Remote Sens. 2017, 9, 539"
|
||||
Turb_Bow06RedOverGreen,Turbidity,w658 / w558,"Bowers, D. G., and C. E. Binding. 2006. 闁炽儲缈籬e Optical Properties of Mineral Suspended Particles: A Review and Synthesis.闁?Estuarine Coastal and Shelf Science 67 (1闁?): 219闁?30. doi:10.1016/j.ecss.2005.11.010"
|
||||
Turb_Bow06RedOverGreen,Turbidity,w658 / w558,"Bowers, D. G., and C. E. Binding. 2006. 闁炽儲缈籬e Optical Properties of Mineral Suspended Particles: A Review and Synthesis.<EFBFBD><EFBFBD>?Estuarine Coastal and Shelf Science 67 (1<EFBFBD><EFBFBD>?): 219<EFBFBD><EFBFBD>?30. doi:10.1016/j.ecss.2005.11.010"
|
||||
Turb_Chip09NIROverGreen,Turbidity,w857 / w558,"Chipman, J. W.; Olmanson, L.G.; Gitelson, A.A.; Remote sensing methods for lake management: A guide for resource managers and decision-makers. 2009."
|
||||
Turb_Dox02NIRoverRed,Turbidity,w857 / w658,"Doxaran, D., Froidefond, J.-M.; Castaing, P. ; A reflectance band ratio used to estimate suspended matter concentrations in sediment-dominated coastal waters, Remote Sens., 2002, 23, 5079-5085"
|
||||
Turb_Frohn09GreenPlusRedBothOverBlue,Turbidity,(w558 + w658) / w458,"Frohn, R. C., & Autrey, B. C. (2009). Water quality assessment in the Ohio River using new indices for turbidity and chlorophyll-a with Landsat-7 Imagery. Draft Internal Report, US Environmental Protection Agency."
|
||||
Turb_Harr92NIR,Turbidity,w857,"Schiebe F.R., Harrington J.A., Ritchie J.C. Remote-Sensing of Suspended Sediments闁炽儲鏁刪e Lake Chicot, Arkansas Project. Int. J. Remote Sens. 1992;13:1487闁?509"
|
||||
Turb_Harr92NIR,Turbidity,w857,"Schiebe F.R., Harrington J.A., Ritchie J.C. Remote-Sensing of Suspended Sediments闁炽儲鏁刪e Lake Chicot, Arkansas Project. Int. J. Remote Sens. 1992;13:1487<EFBFBD><EFBFBD>?509"
|
||||
Turb_Lath91RedOverBlue,Turbidity,w658 / w458,"Lathrop, R. G., Jr., T. M. Lillesand, and B. S. Yandell, 1991. Testing the utility of simple multi-date Thematic Mapper calibration algorithms for monitoring turbid inland waters. International Journal of Remote Sensing"
|
||||
Turb_Moore80Red,Turbidity,w658,"Moore, G.K., Satellite remote sensing of water turbidity, Hydrological Sciences, 1980, 25, 4, 407-422"
|
||||
|
||||
|
175
docs/项目交接文档.md
Normal file
175
docs/项目交接文档.md
Normal file
@ -0,0 +1,175 @@
|
||||
# 水质参数反演分析系统 — 项目交接文档
|
||||
|
||||
> 文档用途:帮助新负责人快速理解仓库结构、运行方式、核心逻辑与维护要点。
|
||||
> 适用仓库:本地工程 **fengzhuang-ui2V3**(水质 GUI + 反演流水线)。
|
||||
|
||||
---
|
||||
|
||||
## 1. 项目概述
|
||||
|
||||
本系统为 **基于遥感影像与机器学习的水质反演桌面应用**:水域掩膜、耀斑检测与去除、CSV/光谱处理、监督与非经验建模、采样与预测、空间制图与报告生成。
|
||||
|
||||
- **图形界面**:PyQt5,主入口 `src/gui/water_quality_gui.py`。
|
||||
- **业务编排**:GUI 使用 `src/core/water_quality_inversion_pipeline_GUI.py` 中的 `WaterQualityInversionPipeline`;命令行/无 GUI 场景可参考 `src/core/water_quality_inversion_pipeline.py`(子目录命名已与 GUI 管线对齐,但 **不含** 步骤 5.5 / 6.5 / 6.75 等扩展目录的完整定义,以 GUI 管线为准)。
|
||||
- **打包**:PyInstaller,`scripts/water_quality_gui_file.spec`,单文件 exe,`console=False`。
|
||||
|
||||
---
|
||||
|
||||
## 2. 目录结构(精简)
|
||||
|
||||
```
|
||||
项目根/
|
||||
├── src/
|
||||
│ ├── gui/ # PyQt5 主界面、步骤面板、工作线程
|
||||
│ ├── core/ # 反演流水线、去耀斑、建模、预测、非经验反演
|
||||
│ ├── preprocessing/ # 光谱预处理、水质数据加工
|
||||
│ ├── postprocessing/ # 制图、可视化、Word 报告、航迹等
|
||||
│ ├── visualization/ # 可视化包初始化(具体实现多在 postprocessing)
|
||||
│ └── utils/ # 水域提取、指数、采样、工具函数
|
||||
├── data/ # 图标、公式子数据等静态资源
|
||||
├── scripts/ # PyInstaller spec、构建产物常出现在 scripts/build|dist
|
||||
├── docs/ # 说明文档(含本文)
|
||||
├── requirements*.txt # pip/conda 依赖清单
|
||||
├── README.md / README-conda.md # 安装与 conda 说明
|
||||
└── README_SAMPLING_MAP.md # 采样地图相关说明(若仍写旧目录名,需与下文「工作目录」对照更新)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 运行方式
|
||||
|
||||
### 3.1 开发运行 GUI
|
||||
|
||||
在项目根目录(或已将 `src` 加入 `PYTHONPATH`)下:
|
||||
|
||||
```bash
|
||||
python src/gui/water_quality_gui.py
|
||||
```
|
||||
|
||||
依赖见 `requirements.txt`;地理栈(GDAL/rasterio 等)建议在 **Conda** 环境按 `README-conda.md` / `requirements-conda.txt` 安装。
|
||||
|
||||
### 3.2 打包 Windows exe
|
||||
|
||||
在已激活的构建环境中执行(路径按本机调整):
|
||||
|
||||
```bash
|
||||
pyinstaller scripts/water_quality_gui_file.spec
|
||||
```
|
||||
|
||||
产物一般为 `scripts/dist/water_quality_gui.exe`(以 spec 中 `name` 为准)。spec 中已收集 rasterio 动态库、conda `Library/bin` 下 DLL、`data/icons` 等。
|
||||
|
||||
### 3.3 多进程说明(Windows / 打包)
|
||||
|
||||
- 若使用 **sklearn `GridSearchCV(n_jobs=-1)`** 等并行,joblib 会起子进程;**冻结 exe 时可能出现控制台窗口闪烁**。缓解思路:线程后端 `parallel_backend("threading")`、或 `n_jobs=1`、或模型内部 `n_jobs` 并行(需改 `modeling_batch.py`,交接时按需评估)。
|
||||
- 入口脚本建议在 `if __name__ == "__main__":` 内、启动 GUI 前调用 `multiprocessing.freeze_support()`,以符合 PyInstaller + multiprocessing 规范(是否已加请以当前 `water_quality_gui.py` 为准)。
|
||||
|
||||
---
|
||||
|
||||
## 4. GUI 与流水线步骤对应关系
|
||||
|
||||
界面上的「步骤」通过 `WorkerThread.run_single_step` 映射到管线方法(配置键名与面板一致,如 `step6`、`step5_5`):
|
||||
|
||||
| 配置键 / 逻辑步骤 | 管线方法名 |
|
||||
|-------------------|------------|
|
||||
| step1 | `step1_generate_water_mask` |
|
||||
| step2 | `step2_find_glint_area` |
|
||||
| step3 | `step3_remove_glint` |
|
||||
| step4 | `step4_process_csv` |
|
||||
| step5 | `step5_extract_training_spectra` |
|
||||
| step5_5 | `step5_5_calculate_water_quality_indices` |
|
||||
| step6 | `step6_train_models` |
|
||||
| step6_5 | `step6_5_non_empirical_modeling` |
|
||||
| step6_75 | `step6_75_custom_regression` |
|
||||
| step7 | `step7_generate_sampling_points` |
|
||||
| step8 | `step8_predict_water_quality` |
|
||||
| step8_5 | `step8_5_predict_with_non_empirical_models` |
|
||||
| step8_75 | `step8_75_predict_with_custom_regression` |
|
||||
| step9 | `step9_generate_distribution_map` |
|
||||
|
||||
单步运行时会注入 `skip_dependency_check=True`,便于独立调试;全流程运行仍应保证输入/前置步骤产物存在。
|
||||
|
||||
---
|
||||
|
||||
## 5. 工作目录(work_dir)子文件夹命名
|
||||
|
||||
所有中间结果默认写在用户选择的 **工作目录** 下。当前代码中约定如下(**若磁盘上仍为旧文件夹名,需手动改名或重新跑流程**):
|
||||
|
||||
| 子目录名 | 含义 |
|
||||
|----------|------|
|
||||
| `1_water_mask` | 水域掩膜 |
|
||||
| `2_glint` | 耀斑相关 |
|
||||
| `3_deglint` | 去耀斑影像 |
|
||||
| `4_processed_data` | 处理后数据 |
|
||||
| `5_training_spectra` | 训练光谱等 |
|
||||
| `6_water_quality_indices` | 水质指数(原 `5_5_water_quality_indices`) |
|
||||
| `7_models` | 监督学习模型(原 `6_models`) |
|
||||
| `8_non_empirical_models` | 非经验模型(原 `6_5_non_empirical_models`) |
|
||||
| `9_custom_regression` | 自定义回归结果(原 `6_75_custom_regression`) |
|
||||
| `10_sampling` | 采样点/光谱(原 `7_sampling`) |
|
||||
| `11_12_13_predictions` | 预测 CSV 等(原 `8_predictions`) |
|
||||
| `14_visualization` | 图表、分布图、预览等(原 `9_visualization`) |
|
||||
| `reports` | 报告输出(原 `10_reports`) |
|
||||
|
||||
**定义位置**:`water_quality_inversion_pipeline_GUI.py` 构造函数中对 `self.*_dir` 的赋值;GUI 中大量路径拼接需与此一致(如 `14_visualization`、`7_models`)。
|
||||
|
||||
---
|
||||
|
||||
## 6. 核心模块说明
|
||||
|
||||
| 模块路径 | 职责 |
|
||||
|----------|------|
|
||||
| `src/gui/water_quality_gui.py` | 主窗口、各步骤面板、线程 Worker、图像查看、配置收集与单步/全流程触发 |
|
||||
| `src/core/water_quality_inversion_pipeline_GUI.py` | GUI 用流水线:步骤实现、目录管理、与可视化/报告类协作 |
|
||||
| `src/core/water_quality_inversion_pipeline.py` | 无扩展步骤目录时的管线实现,供脚本或非 GUI 参考 |
|
||||
| `src/core/modeling/modeling_batch.py` | 批量训练、`GridSearchCV`、模型落盘(joblib) |
|
||||
| `src/core/prediction/inference_batch.py` | 批量预测与模型加载 |
|
||||
| `src/core/glint_removal/*.py` | Goodman、Hedley、Kutser、SUGAR 等去耀斑算法 |
|
||||
| `src/postprocessing/visualization_reports.py` | 水质可视化封装(输出目录常指向 `14_visualization`) |
|
||||
| `src/postprocessing/report_word.py` | Word 报告;默认从 `work_dir/14_visualization` 等读图 |
|
||||
| `src/postprocessing/map.py` | 分布图、插值相关(内含开发者本地示例路径,勿当生产配置) |
|
||||
|
||||
---
|
||||
|
||||
## 7. 依赖与环境
|
||||
|
||||
- **Python**:3.8+(README 声明;实际环境以 `requirements-py310.txt` 等为准)。
|
||||
- **关键库**:PyQt5、numpy、pandas、scipy、scikit-learn、joblib、matplotlib、rasterio/geopandas(视功能启用)、opencv-python、Pillow 等。
|
||||
- **Conda**: GDAL 等二进制依赖推荐用 conda-forge,见 `README-conda.md`。
|
||||
|
||||
---
|
||||
|
||||
## 8. 维护与排错提示
|
||||
|
||||
1. **资源路径(打包后图标不显示)**:冻结运行时勿依赖 `Path(__file__)` 指向源码树;应使用 `sys._MEIPASS` 或项目内统一的 `get_icon_path()` 类逻辑。
|
||||
2. **tqdm / 无控制台**:打包 GUI 时若 `sys.stdout` 为 `None`,tqdm 可能报错;`Goodman.py` 等处已对 frozen GUI 做了 `disable` 处理,新增进度条时注意同样处理。
|
||||
3. **配置与 YAML**:全流程配置由 GUI 各面板 `get_config()` 汇总;改字段名需同步管线 `**config['stepX']` 形参。
|
||||
4. **文档滞后**:`README_SAMPLING_MAP.md` 等若仍出现 `9_visualization` 等旧目录名,应以本文第 5 节为准或更新该文档。
|
||||
|
||||
---
|
||||
|
||||
## 9. 交接检查清单
|
||||
|
||||
- [ ] 已能在本机用 `python src/gui/water_quality_gui.py` 启动 GUI 并完成一次最小流程(或关键单步)。
|
||||
- [ ] 已确认 Conda/pip 环境与 `README-conda.md`、`requirements.txt` 一致。
|
||||
- [ ] 已阅读 `scripts/water_quality_gui_file.spec`,知悉打包入口与 `datas` 列表。
|
||||
- [ ] 已知悉 `work_dir` 子目录当前命名,并能区分「配置键 step6」与「文件夹 `7_models`」。
|
||||
- [ ] 已记录客户/内部使用的 **工作目录样例** 与 **典型输入数据格式**(CSV 列、影像格式)。
|
||||
- [ ] Git 远程、发布分支、Issue/需求跟踪方式已交接。
|
||||
- [ ] 许可证与第三方库合规(MIT 与 README 声明等)已确认。
|
||||
|
||||
---
|
||||
|
||||
## 10. 文档修订记录
|
||||
|
||||
| 日期 | 说明 |
|
||||
|------|------|
|
||||
| 2026-04-09 | 初版:目录结构、步骤映射、工作目录新命名、打包与多进程注意事项 |
|
||||
|
||||
---
|
||||
|
||||
**联系人(请交接时填写)**
|
||||
|
||||
| 角色 | 姓名 | 联系方式 |
|
||||
|------|------|----------|
|
||||
| 移交人 | | |
|
||||
| 接收人 | | |
|
||||
@ -246,8 +246,8 @@ def non_empirical_retrieval(algorithm, model_info_path, coor_spectral_path, outp
|
||||
|
||||
if __name__ == "__main__":
|
||||
algorithm= "chl_a"
|
||||
model_info_path= r"E:\code\WQ\pipeline_result\work_dir\5_training_spectra\6_5_non_empirical_models\SS\SS_chl_a.json"
|
||||
coor_spectral_path= r"E:\code\WQ\pipeline_result\work_dir\7_sampling\sampling_spectra.csv"
|
||||
output_path= r"E:\code\WQ\pipeline_result\work_dir\8_predictions\SS_chl_a.csv"
|
||||
model_info_path= r"E:\code\WQ\pipeline_result\work_dir\5_training_spectra\8_non_empirical_models\SS\SS_chl_a.json"
|
||||
coor_spectral_path= r"E:\code\WQ\pipeline_result\work_dir\10_sampling\sampling_spectra.csv"
|
||||
output_path= r"E:\code\WQ\pipeline_result\work_dir\11_12_13_predictions\SS_chl_a.csv"
|
||||
wave_radius=5.0
|
||||
non_empirical_retrieval(algorithm, model_info_path, coor_spectral_path, output_path, wave_radius)
|
||||
@ -95,11 +95,11 @@ class WaterQualityInversionPipeline:
|
||||
self.deglint_dir = self.work_dir / "3_deglint"
|
||||
self.processed_data_dir = self.work_dir / "4_processed_data"
|
||||
self.training_spectra_dir = self.work_dir / "5_training_spectra"
|
||||
self.models_dir = self.work_dir / "6_models"
|
||||
self.sampling_dir = self.work_dir / "7_sampling"
|
||||
self.prediction_dir = self.work_dir / "8_predictions"
|
||||
self.visualization_dir = self.work_dir / "9_visualization"
|
||||
self.reports_dir = self.work_dir / "10_reports"
|
||||
self.models_dir = self.work_dir / "7_models"
|
||||
self.sampling_dir = self.work_dir / "10_sampling"
|
||||
self.prediction_dir = self.work_dir / "11_12_13_predictions"
|
||||
self.visualization_dir = self.work_dir / "14_visualization"
|
||||
self.reports_dir = self.work_dir / "reports"
|
||||
|
||||
# 创建所有子目录
|
||||
for dir_path in [self.water_mask_dir, self.glint_dir, self.deglint_dir,
|
||||
|
||||
@ -105,14 +105,14 @@ class WaterQualityInversionPipeline:
|
||||
self.deglint_dir = self.work_dir / "3_deglint"
|
||||
self.processed_data_dir = self.work_dir / "4_processed_data"
|
||||
self.training_spectra_dir = self.work_dir / "5_training_spectra"
|
||||
self.indices_dir = self.work_dir / "5_5_water_quality_indices"
|
||||
self.models_dir = self.work_dir / "6_models"
|
||||
self.non_empirical_models_dir = self.work_dir / "6_5_non_empirical_models"
|
||||
self.custom_regression_dir = self.work_dir / "6_75_custom_regression"
|
||||
self.sampling_dir = self.work_dir / "7_sampling"
|
||||
self.prediction_dir = self.work_dir / "8_predictions"
|
||||
self.visualization_dir = self.work_dir / "9_visualization"
|
||||
self.reports_dir = self.work_dir / "10_reports"
|
||||
self.indices_dir = self.work_dir / "6_water_quality_indices"
|
||||
self.models_dir = self.work_dir / "7_models"
|
||||
self.non_empirical_models_dir = self.work_dir / "8_non_empirical_models"
|
||||
self.custom_regression_dir = self.work_dir / "9_custom_regression"
|
||||
self.sampling_dir = self.work_dir / "10_sampling"
|
||||
self.prediction_dir = self.work_dir / "11_12_13_predictions"
|
||||
self.visualization_dir = self.work_dir / "14_visualization"
|
||||
self.reports_dir = self.work_dir / "reports"
|
||||
|
||||
# 创建所有子目录
|
||||
for dir_path in [self.water_mask_dir, self.glint_dir, self.deglint_dir,
|
||||
@ -3379,10 +3379,10 @@ class WaterQualityInversionPipeline:
|
||||
else:
|
||||
# 如果output_dir为空,使用工作目录
|
||||
if hasattr(self, 'work_dir') and self.work_dir is not None:
|
||||
non_empirical_dir = Path(self.work_dir) / "6_5_non_empirical_models"
|
||||
non_empirical_dir = Path(self.work_dir) / "8_non_empirical_models"
|
||||
else:
|
||||
# 如果没有工作目录,使用当前目录
|
||||
non_empirical_dir = Path.cwd() / "6_5_non_empirical_models"
|
||||
non_empirical_dir = Path.cwd() / "8_non_empirical_models"
|
||||
non_empirical_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# 设置默认参数
|
||||
@ -3712,7 +3712,7 @@ class WaterQualityInversionPipeline:
|
||||
if non_empirical_models_dir is not None:
|
||||
final_models_dir = non_empirical_models_dir
|
||||
else:
|
||||
default_models_dir = str(self.work_dir / "6_5_non_empirical_models")
|
||||
default_models_dir = str(self.work_dir / "8_non_empirical_models")
|
||||
if Path(default_models_dir).exists():
|
||||
final_models_dir = default_models_dir
|
||||
else:
|
||||
|
||||
@ -536,7 +536,7 @@ class VisualizationWorkerThread(QThread):
|
||||
wp = Path(self.work_dir)
|
||||
if self.task == "mask_glint":
|
||||
from src.postprocessing.visualization_reports import WaterQualityVisualization
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "9_visualization"))
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "14_visualization"))
|
||||
preview_paths = viz.generate_glint_deglint_previews(
|
||||
work_dir=str(wp),
|
||||
output_subdir="glint_deglint_previews",
|
||||
@ -572,7 +572,7 @@ class VisualizationWorkerThread(QThread):
|
||||
csv_path = str(csv_files[0])
|
||||
from src.postprocessing.point_map import SamplingPointMap
|
||||
map_generator = SamplingPointMap(
|
||||
output_dir=str(wp / "9_visualization" / "sampling_maps"),
|
||||
output_dir=str(wp / "14_visualization" / "sampling_maps"),
|
||||
fast_mode=True,
|
||||
)
|
||||
map_path = map_generator.create_sampling_point_map(
|
||||
@ -597,7 +597,7 @@ class VisualizationWorkerThread(QThread):
|
||||
)
|
||||
elif self.task == "spectrum":
|
||||
from src.postprocessing.visualization_reports import WaterQualityVisualization
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "9_visualization"))
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "14_visualization"))
|
||||
csv_file = self.extra.get("csv_path")
|
||||
wl = self.extra.get("wavelength_start_column", "UTM_Y")
|
||||
n_groups = int(self.extra.get("n_groups", 5))
|
||||
@ -641,7 +641,7 @@ class VisualizationWorkerThread(QThread):
|
||||
)
|
||||
elif self.task == "statistics":
|
||||
from src.postprocessing.visualization_reports import WaterQualityVisualization
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "9_visualization"))
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "14_visualization"))
|
||||
csv_file = self.extra.get("csv_path")
|
||||
param_cols = self.extra.get("param_cols") or []
|
||||
output_paths = viz.plot_statistical_charts(
|
||||
@ -660,7 +660,7 @@ class VisualizationWorkerThread(QThread):
|
||||
self.failed.emit("训练光谱 CSV 无效或不存在,请确认已选择步骤5输出的文件。")
|
||||
return
|
||||
if not models_dir or not Path(models_dir).is_dir():
|
||||
self.failed.emit("模型目录无效或不存在,请确认步骤6已生成 6_models 下的参数子文件夹。")
|
||||
self.failed.emit("模型目录无效或不存在,请确认步骤6已生成 7_models 下的参数子文件夹。")
|
||||
return
|
||||
pipeline = WaterQualityInversionPipeline(work_dir=str(wp))
|
||||
scatter_paths = pipeline.generate_model_scatter_plots(
|
||||
@ -670,7 +670,7 @@ class VisualizationWorkerThread(QThread):
|
||||
self.finished_ok.emit({"task": "scatter", "scatter_paths": scatter_paths or {}})
|
||||
elif self.task == "generate_all_selected":
|
||||
from src.postprocessing.visualization_reports import WaterQualityVisualization
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "9_visualization"))
|
||||
viz = WaterQualityVisualization(output_dir=str(wp / "14_visualization"))
|
||||
parts = []
|
||||
if self.extra.get("gen_mask_glint"):
|
||||
preview_paths = viz.generate_glint_deglint_previews(
|
||||
@ -703,7 +703,7 @@ class VisualizationWorkerThread(QThread):
|
||||
csv_path = str(csv_files[0])
|
||||
from src.postprocessing.point_map import SamplingPointMap
|
||||
map_generator = SamplingPointMap(
|
||||
output_dir=str(wp / "9_visualization" / "sampling_maps"),
|
||||
output_dir=str(wp / "14_visualization" / "sampling_maps"),
|
||||
fast_mode=True,
|
||||
)
|
||||
map_path = map_generator.create_sampling_point_map(
|
||||
@ -2699,12 +2699,12 @@ class Step9Panel(QWidget):
|
||||
params_group.setLayout(params_layout)
|
||||
layout.addWidget(params_group)
|
||||
|
||||
# 输出目录(可选):在此目录下生成「CSV文件名_distribution.png」;留空则用工作目录/9_visualization
|
||||
# 输出目录(可选):在此目录下生成「CSV文件名_distribution.png」;留空则用工作目录/14_visualization
|
||||
self.output_dir = FileSelectWidget(
|
||||
"输出分布图目录:",
|
||||
"Directories;;All Files (*.*)"
|
||||
)
|
||||
self.output_dir.line_edit.setPlaceholderText("留空→工作目录/9_visualization")
|
||||
self.output_dir.line_edit.setPlaceholderText("留空→工作目录/14_visualization")
|
||||
# 修改浏览按钮为选择目录
|
||||
self.output_dir.browse_btn.clicked.disconnect()
|
||||
self.output_dir.browse_btn.clicked.connect(self.browse_output_dir)
|
||||
@ -3404,10 +3404,10 @@ class ImageCategoryTree(QTreeWidget):
|
||||
if not work_path.exists():
|
||||
return
|
||||
|
||||
# 查找所有图像文件:9_visualization 为主,同时扫描步骤产出目录(如 1_water_mask 下的预览/叠置图)
|
||||
# 查找所有图像文件:14_visualization 为主,同时扫描步骤产出目录(如 1_water_mask 下的预览/叠置图)
|
||||
image_extensions = ['*.png', '*.jpg', '*.jpeg', '*.tif', '*.tiff', '*.bmp']
|
||||
scan_roots: List[Path] = []
|
||||
_viz = work_path / "9_visualization"
|
||||
_viz = work_path / "14_visualization"
|
||||
if _viz.is_dir():
|
||||
scan_roots.append(_viz)
|
||||
_wm = work_path / "1_water_mask"
|
||||
@ -3761,7 +3761,7 @@ class VisualizationPanel(QWidget):
|
||||
self,
|
||||
"成功",
|
||||
f"掩膜和耀斑缩略图生成完成,共 {cnt} 个预览图。\n"
|
||||
f"保存位置: 9_visualization/glint_deglint_previews/",
|
||||
f"保存位置: 14_visualization/glint_deglint_previews/",
|
||||
)
|
||||
else:
|
||||
QMessageBox.warning(
|
||||
@ -3776,7 +3776,7 @@ class VisualizationPanel(QWidget):
|
||||
"成功",
|
||||
"采样点地图生成完成。\n"
|
||||
f"输出: {Path(map_path).name if map_path else ''}\n"
|
||||
"路径: 9_visualization/sampling_maps/",
|
||||
"路径: 14_visualization/sampling_maps/",
|
||||
)
|
||||
if map_path:
|
||||
self.show_chart_viewer(map_path, "采样点分布图")
|
||||
@ -3787,7 +3787,7 @@ class VisualizationPanel(QWidget):
|
||||
errs = payload.get("errors") or []
|
||||
msg = (
|
||||
f"已为 {len(ok_paths)} 个水质参数生成光谱对比图。\n"
|
||||
f"保存目录: 工作目录/9_visualization/"
|
||||
f"保存目录: 工作目录/14_visualization/"
|
||||
)
|
||||
if errs:
|
||||
msg += f"\n\n以下列未生成或出错 ({len(errs)} 项,详见日志):\n"
|
||||
@ -3818,14 +3818,14 @@ class VisualizationPanel(QWidget):
|
||||
self,
|
||||
"成功",
|
||||
f"已生成 {len(ok_paths)} 个模型评估散点图。\n"
|
||||
f"保存位置: 9_visualization/scatter_plots/",
|
||||
f"保存位置: 14_visualization/scatter_plots/",
|
||||
)
|
||||
self.show_chart_viewer(ok_paths[0], "模型评估散点图")
|
||||
else:
|
||||
QMessageBox.warning(
|
||||
self,
|
||||
"提示",
|
||||
"未生成任何散点图。请确认 6_models 下已有各参数子目录及模型文件,"
|
||||
"未生成任何散点图。请确认 7_models 下已有各参数子目录及模型文件,"
|
||||
"且训练 CSV 与建模时一致。",
|
||||
)
|
||||
elif t == "generate_all_selected":
|
||||
@ -3935,7 +3935,7 @@ class VisualizationPanel(QWidget):
|
||||
|
||||
self.gen_scatter_btn = QPushButton("📊 散点图")
|
||||
self.gen_scatter_btn.setToolTip(
|
||||
"基于工作目录下 5_training_spectra/training_spectra.csv 与 6_models 生成模型评估散点图"
|
||||
"基于工作目录下 5_training_spectra/training_spectra.csv 与 7_models 生成模型评估散点图"
|
||||
)
|
||||
self.gen_scatter_btn.clicked.connect(lambda: self.generate_chart('scatter'))
|
||||
specific_layout.addWidget(self.gen_scatter_btn)
|
||||
@ -4000,7 +4000,7 @@ class VisualizationPanel(QWidget):
|
||||
self.image_tree.scan_directory(str(work_path))
|
||||
|
||||
# 如果有图像,自动选择第一个
|
||||
viz_dir = work_path / "9_visualization"
|
||||
viz_dir = work_path / "14_visualization"
|
||||
if viz_dir.exists():
|
||||
image_files = list(viz_dir.glob("**/*.png")) + list(viz_dir.glob("**/*.jpg"))
|
||||
if image_files:
|
||||
@ -4082,7 +4082,7 @@ class VisualizationPanel(QWidget):
|
||||
)
|
||||
return
|
||||
training_csv = training_spectra_csv
|
||||
models_dir = work_path / "6_models"
|
||||
models_dir = work_path / "7_models"
|
||||
if not models_dir.is_dir() or not any(
|
||||
d.is_dir() for d in models_dir.iterdir()
|
||||
):
|
||||
@ -4188,9 +4188,9 @@ class VisualizationPanel(QWidget):
|
||||
return
|
||||
|
||||
work_path = Path(self.work_dir)
|
||||
viz_dir = work_path / "9_visualization"
|
||||
viz_dir2 = work_path / "9_visualization/boxplots"
|
||||
viz_dir3 = work_path / "9_visualization/scatter_plots"
|
||||
viz_dir = work_path / "14_visualization"
|
||||
viz_dir2 = work_path / "14_visualization/boxplots"
|
||||
viz_dir3 = work_path / "14_visualization/scatter_plots"
|
||||
if not viz_dir.exists():
|
||||
QMessageBox.warning(self, "警告",
|
||||
f"可视化目录不存在:\n{viz_dir}\n\n请先生成图表。")
|
||||
@ -4338,7 +4338,7 @@ class ReportGenerationPanel(QWidget):
|
||||
layout.setSpacing(10)
|
||||
|
||||
intro = QLabel(
|
||||
"根据工作目录下的可视化结果(9_visualization 等)生成 Word 分析报告。"
|
||||
"根据工作目录下的可视化结果(14_visualization 等)生成 Word 分析报告。"
|
||||
"需已存在可视化图表;AI 分析通过 Ollama /api/chat 调用本地或远程服务。"
|
||||
)
|
||||
intro.setWordWrap(True)
|
||||
@ -4350,7 +4350,7 @@ class ReportGenerationPanel(QWidget):
|
||||
|
||||
wd_row = QHBoxLayout()
|
||||
self.work_dir_edit = QLineEdit()
|
||||
self.work_dir_edit.setPlaceholderText("选择流程工作目录(含 9_visualization)…")
|
||||
self.work_dir_edit.setPlaceholderText("选择流程工作目录(含 14_visualization)…")
|
||||
wd_browse = QPushButton("浏览…")
|
||||
wd_browse.clicked.connect(self.browse_work_dir)
|
||||
sync_btn = QPushButton("同步主窗口工作目录")
|
||||
@ -4362,7 +4362,7 @@ class ReportGenerationPanel(QWidget):
|
||||
|
||||
out_row = QHBoxLayout()
|
||||
self.output_dir_edit = QLineEdit()
|
||||
self.output_dir_edit.setPlaceholderText("留空则保存到 工作目录/9_visualization")
|
||||
self.output_dir_edit.setPlaceholderText("留空则保存到 工作目录/14_visualization")
|
||||
out_browse = QPushButton("浏览…")
|
||||
out_browse.clicked.connect(self.browse_output_dir)
|
||||
out_row.addWidget(self.output_dir_edit, 1)
|
||||
@ -4494,7 +4494,7 @@ class ReportGenerationPanel(QWidget):
|
||||
if not wd or not os.path.isdir(wd):
|
||||
QMessageBox.warning(self, "提示", "请选择有效的工作目录。")
|
||||
return
|
||||
viz = Path(wd) / "9_visualization"
|
||||
viz = Path(wd) / "14_visualization"
|
||||
if not viz.is_dir():
|
||||
QMessageBox.warning(
|
||||
self,
|
||||
@ -4755,7 +4755,7 @@ class Step6_5Panel(QWidget):
|
||||
"输出模型目录:",
|
||||
"Directories;;All Files (*.*)"
|
||||
)
|
||||
self.output_dir.line_edit.setPlaceholderText("6_5_non_empirical_models")
|
||||
self.output_dir.line_edit.setPlaceholderText("8_non_empirical_models")
|
||||
# 修改浏览按钮为选择目录
|
||||
self.output_dir.browse_btn.clicked.disconnect()
|
||||
self.output_dir.browse_btn.clicked.connect(self.browse_output_dir)
|
||||
@ -4825,9 +4825,9 @@ class Step6_5Panel(QWidget):
|
||||
# 如果output_dir为空,使用工作目录或当前目录
|
||||
main_window = self.parent().window()
|
||||
if hasattr(main_window, 'work_dir') and main_window.work_dir:
|
||||
output_dir = str(Path(main_window.work_dir) / "6_5_non_empirical_models")
|
||||
output_dir = str(Path(main_window.work_dir) / "8_non_empirical_models")
|
||||
else:
|
||||
output_dir = str(Path.cwd() / "6_5_non_empirical_models")
|
||||
output_dir = str(Path.cwd() / "8_non_empirical_models")
|
||||
config['output_dir'] = output_dir
|
||||
|
||||
# 添加训练数据路径(用于独立运行)
|
||||
@ -5044,7 +5044,7 @@ class Step6_75Panel(QWidget):
|
||||
output_layout = QFormLayout()
|
||||
|
||||
self.output_dir = QLineEdit()
|
||||
self.output_dir.setText("6_75_custom_regression")
|
||||
self.output_dir.setText("9_custom_regression")
|
||||
output_layout.addRow("输出目录名:", self.output_dir)
|
||||
|
||||
output_group.setLayout(output_layout)
|
||||
@ -5202,7 +5202,7 @@ class Step6_75Panel(QWidget):
|
||||
checkbox.setChecked(method in selected_methods)
|
||||
|
||||
if 'output_dir' in config:
|
||||
self.output_dir.setText(config['output_dir'] or "6_75_custom_regression")
|
||||
self.output_dir.setText(config['output_dir'] or "9_custom_regression")
|
||||
if 'enabled' in config:
|
||||
self.enable_checkbox.setChecked(config['enabled'])
|
||||
|
||||
|
||||
@ -534,7 +534,7 @@ if __name__ == "__main__":
|
||||
print(" )")
|
||||
|
||||
|
||||
visualizer = FlightPathVisualizer(output_dir=r"E:\code\WQ\pipeline_result\work_dir\9_visualization\flight_maps")
|
||||
visualizer = FlightPathVisualizer(output_dir=r"E:\code\WQ\pipeline_result\work_dir\14_visualization\flight_maps")
|
||||
# 生成飞行轨迹图
|
||||
map_path = visualizer.create_flight_path_map(
|
||||
gps_folder=r"D:\BaiduNetdiskDownload\20250902\gps", # GPS文件夹路径
|
||||
|
||||
@ -2130,9 +2130,9 @@ def main():
|
||||
mapper = ContentMapper()
|
||||
|
||||
# 示例1:处理单个文件
|
||||
csv_file = r"E:\code\WQ\pipeline_result\tests1\8_predictions\BGA.csv" # 采样点的预测值
|
||||
csv_file = r"E:\code\WQ\pipeline_result\tests1\11_12_13_predictions\BGA.csv" # 采样点的预测值
|
||||
shp_file = r"D:\BaiduNetdiskDownload\yaobao\roi\roi.shp" # 水体边界shapefile路径
|
||||
output_file = r"E:\code\WQ\pipeline_result\work_dir\8_predictions\BGA.png" # 输出图片路径
|
||||
output_file = r"E:\code\WQ\pipeline_result\work_dir\11_12_13_predictions\BGA.png" # 输出图片路径
|
||||
#
|
||||
mapper.process_data(
|
||||
csv_file=csv_file,
|
||||
|
||||
@ -79,7 +79,7 @@ class WaterQualityReportGenerator:
|
||||
self.work_dir = Path(work_dir)
|
||||
|
||||
# 基于工作目录设置各子目录
|
||||
self.visualization_dir = self.work_dir / "9_visualization"
|
||||
self.visualization_dir = self.work_dir / "14_visualization"
|
||||
|
||||
# 设置报告保存位置:默认为可视化目录(visualization_dir)
|
||||
self._output_dir_is_default = output_dir is None
|
||||
@ -585,12 +585,12 @@ class WaterQualityReportGenerator:
|
||||
output_path: Optional[str] = None) -> str:
|
||||
"""
|
||||
生成 Word 报告 - 所有数据均来自工作目录(work_dir)
|
||||
可视化图片、统计数据等均从 work_dir/9_visualization 和 work_dir/4_processed_data 中读取
|
||||
可视化图片、统计数据等均从 work_dir/14_visualization 和 work_dir/4_processed_data 中读取
|
||||
"""
|
||||
# 设置工作目录(整个流程的核心)
|
||||
if work_dir is not None:
|
||||
self.work_dir = Path(work_dir)
|
||||
self.visualization_dir = self.work_dir / "9_visualization"
|
||||
self.visualization_dir = self.work_dir / "14_visualization"
|
||||
if getattr(self, "_output_dir_is_default", False):
|
||||
self.output_dir = self.visualization_dir
|
||||
self.output_dir.mkdir(parents=True, exist_ok=True)
|
||||
@ -1050,7 +1050,7 @@ class WaterQualityReportGenerator:
|
||||
vis_dir = self.visualization_dir
|
||||
|
||||
# 0. 航线规划图
|
||||
flight_path_img_path = work_dir_path / "9_visualization" / "flight_maps"
|
||||
flight_path_img_path = work_dir_path / "14_visualization" / "flight_maps"
|
||||
h3 = doc.add_heading("航线规划:", level=3)
|
||||
self._style_heading(h3, level=3)
|
||||
|
||||
|
||||
@ -423,7 +423,7 @@ class WaterQualityVisualization:
|
||||
- 2_glint文件夹:单波段二值耀斑掩膜,使用红色高亮显示
|
||||
- 3_deglint文件夹:多波段去耀斑影像,使用RGB合成显示
|
||||
- 自动识别文件类型并应用相应的可视化方案
|
||||
- 输出保存至9_visualization/glint_deglint_previews/
|
||||
- 输出保存至14_visualization/glint_deglint_previews/
|
||||
|
||||
Args:
|
||||
work_dir: 工作目录路径
|
||||
@ -713,7 +713,7 @@ class WaterQualityVisualization:
|
||||
from src.postprocessing.point_map import SamplingPointMap
|
||||
|
||||
# 如果没有提供路径,自动查找
|
||||
work_dir = self.output_dir.parent # 9_visualization的父目录就是工作目录
|
||||
work_dir = self.output_dir.parent # 14_visualization的父目录就是工作目录
|
||||
|
||||
if hyperspectral_path is None:
|
||||
# 查找高光谱影像
|
||||
|
||||
Reference in New Issue
Block a user