Files
cDNA-image-processing/CLAUDE.md
T

61 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CLAUDE.md — cDNA微阵列图像处理作业
## 项目概述
河南理工大学计算机学院图像处理课程作业。用Python实现cDNA微阵列图像的网格划分与阈值分割。
## 项目结构
```
src/
├── cDNA_segmentation.py ← 原版:完整处理流程
└── cDNA_gridding_simple.py ← 简化版:仅划线,用于课堂讲解 ★
results/ ← 原版输出(6张图)
results_simple/ ← 简化版输出(1张图)
cDNA图像处理实例/数据/cDNA/ ← 输入图像 + MATLAB示例
参考资料/NewGridAndCV/ ← MATLAB参考实现
```
## 两个Python实现
### 简化版 (`cDNA_gridding_simple.py`) — 课堂主讲
- 算法:投影求和 → (max-min)×10%阈值 → 过零点配对 → 划线
- 约150行,带详细中文注释,适合课堂讲解
- 输出:`results_simple/gridding_simple.png`
- **与原版网格线位置完全一致(误差0像素)**
### 原版 (`cDNA_segmentation.py`) — 完整实现
- 网格划分:自相关+白顶帽+Otsu+质心(参照MATLAB `GriddingAndCV.m`
- 三种阈值分割:人工阈值、Otsu、迭代阈值
- TV去噪(Chambolle投影算法,参照 `tvdenoise.m`
## 算法要点
简化版核心逻辑(`find_gap_lines`函数):
- 减阈值后:正=斑点区域,负=空隙
- 过零点交替出现:+→-(离开斑点),-→+(进入下一个斑点)
- 配对"离开→进入",中点=空隙中央=划线位置
## 输入数据
- `cDNA.png`820×820 RGB23×23斑点阵列,Cy3/Cy5双色荧光
- 斑点间距约35px,每斑点约18px宽
## 编码规范
- **禁止硬编码绝对路径**:所有文件路径必须从 `__file__` 动态计算,确保代码可在任意目录运行
- 使用 `os.path.dirname(os.path.abspath(__file__))` 定位脚本所在目录,再由相对关系推导其他目录
## 运行环境
Python`D:\ProgramData\anaconda3\envs\my_env`
依赖:numpy, scipy, scikit-image, matplotlib, Pillow
## 仓库
Gitea: `ssh://git@192.168.5.8:2222/Serendipity/cDNA-image-processing.git`