WSI radiomics feature extraction from cell polygons (GeoJSON) and WSI slides
Project description
WSIRadiomics
WSIRadiomics 是一个用于 全视野病理切片(Whole Slide Image, WSI) 的 细胞级 → WSI 级放射组学特征提取工具包。
它支持从 细胞实例分割结果(GeoJSON) 出发,计算细胞级特征,并进一步聚合为 WSI 级特征,适用于计算病理、数字病理与多模态研究。
✨ Features
- 🧬 Cell-level → WSI-level 特征计算流程
- 🧠 支持 first-order、shape 等基础放射组学特征
- 🧩 基于 YAML 的灵活参数配置
- 🏷 支持按细胞类型(cell_type)聚合
- 📦 模块化设计,易于二次开发
- 📝 使用 Python logging,不使用 print
- 🚫 核心 API 不写文件,完全由用户控制输出
📦 Installation
方法一:通过 PyPI 安装(推荐)
pip install wsiradiomics
适合 直接使用 / 服务器环境 / 虚拟环境。
方法二:通过 Conda / Mamba 环境(推荐科研环境)
项目提供了完整的环境文件:
conda env create -f environment.yaml
conda activate wsiradiomics
或使用 mamba(更快):
mamba env create -f environment.yaml
mamba activate wsiradiomics
该方式特别适合 WSI / OpenSlide / Linux 服务器 环境。
🚀 Quick Start
建议先参考 examples/ 文件夹中的示例代码和配置文件
示例文件说明
examples/
├── example_file.csv # 批量处理 CSV 示例
├── extract_from_pandas.py # 批量特征提取示例
└── params.yaml # 参数配置示例
1️⃣ 单张 WSI 特征提取(API 方式)
from wsiradiomics.extractor import extract
res = extract(
svs_path="example.svs",
geojson_path="cells.geojson",
params_path="params.yaml",
)
wsi_features = res["wsi_features"]
2️⃣ 批量处理(CSV 驱动,推荐)
CSV 示例(见 examples/example_file.csv):
wsi_path,mask_path
/path/to/wsi_001.svs,/path/to/wsi_001_cells.geojson
/path/to/wsi_002.svs,/path/to/wsi_002_cells.geojson
运行示例脚本:
python examples/extract_from_pandas.py \
--input_csv examples/example_file.csv \
--params examples/params.yaml \
--out_dir result/
输出结果:
result/
├── wsi_features.csv
└── run_wsi_feature_extract.log
📄 License
MIT License
📬 Contact
欢迎通过 GitHub Issues 提交问题或建议
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wsiradiomics-0.1.2.tar.gz.
File metadata
- Download URL: wsiradiomics-0.1.2.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9c3dafe05aacb38e8f5a6a03c0d45a22f6a23185ea1d47594eea073bd67b078
|
|
| MD5 |
37b58ce14ecfc8d7ad6c0a57e2fa51bd
|
|
| BLAKE2b-256 |
9855a6c1730ea375d111e2f0ffffd9857d9d698db0a951a86a962a67a494b312
|
File details
Details for the file wsiradiomics-0.1.2-py3-none-any.whl.
File metadata
- Download URL: wsiradiomics-0.1.2-py3-none-any.whl
- Upload date:
- Size: 33.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f32ff832459751d34ba33ca6c072066809e0422d962d2f1701615e52d43f061d
|
|
| MD5 |
5198053c12961394fb23adf65e48dfae
|
|
| BLAKE2b-256 |
4c90b1801b00e0ed214681f53624ee89d65a84f906bee778075db310ffa57812
|