PyPathomics is an open-source software for gigapixel whole-slide image analysis. Off-the-shelf and easy-to-use.
Currently under development. This is a simplified version of [sc_MTOP] [Paper]
Support for:
Get all cell and slide-level features directly through the cell segmentation file like Hover-Net's .json
file.
conda create -n pypathomics
conda activate pypathomics
pip install -r requirements.txt
openslide-home: path\to\openslide-home # for Windows only
feature-set: ['Morph', 'Texture', 'Triangle']
cell_types: ['I', 'S', 'T']
statistic-types: ['basic', 'distribution']
Where,
openslide-home
: Specifies the path to the OpenSlide library. (for Windows only, leave it empty for Linux)feature-set
: A list of feature sets to extract. Options:Morph
,Texture
,Triangle
.cell_types
: Types of cells to analyze. Options:I
(inflammatory),S
, (stromal),T
(tumor).statistic-types
: Types of statistics to calculate. Options:basic
,distribution
.
statistics-types | e.g. |
---|---|
basic | mean, std |
distribution | Q25, Q75, median, IQR, range, skewness, kurtosis |
Required Arguments:
--config Specify the configuration file path
--seg Path to the segmentation directory or file from Hover-Net(.json) or Cerberus(.dat)
--wsi Path to the WSI directory or file
--ext WSI file extension (default: .svs)
--buffer Specify the output buffer dir for preprocessing
--output Set the output directory for the analysis
Optional Arguments:
-f Run for a single file (default: run for directory)
--auto_skip Skip existing directories automatically (default: True)
--level Detail level of the WSI to analyze (default: 0)
-
Make sure you run the Hover-Net's wsi seg or Cerberus' wsi seg and get the seg files.
-
Modify and check the config.yaml before running.
-
Analyze a Directory:
python main.py --seg /path/to/seg_dir --wsi /path/to/wsi_dir --buffer /path/to/buffer --ext .svs --output /path/to/output.csv
-
Analyze a Single File
python main.py -f --seg /path/to/seg_file --wsi /path/to/wsi_file --buffer /path/to/buffer --ext .svs --output /path/to/output.csv
Feature | Description |
---|---|
Name | Identifier for the cell |
Centroid | Position of the cell's centroid |
Cell Type | Information about the cell type |
Feature | Description |
---|---|
Ratio | Reflects the proportion of cells of this type |
Feature | Description |
---|---|
Area | Area of the cell, indicating cell size |
AreaBbox | Area of the minimum bounding rectangle around the cell |
CellEccentricities | Eccentricity of the cell |
Circularity | Roundness of the cell |
Elongation | Elongation rate of the cell |
Extent | Proportion of the cell occupying its bounding rectangle |
MajorAxisLength / Morph_MinorAxisLength | Lengths of the major and minor axes of the fitted ellipse for the cell |
Perimeter | Perimeter of the cell boundary |
Solidity | Ratio of the cell area to its convex hull area |
CurvMean / Std / Max / Min | Mean, standard deviation, maximum, and minimum of the cell boundary curvature |
Feature | Description |
---|---|
ASM (Angular Second Moment) | Texture consistency, measuring the similarity between a pixel and its neighbors |
Contrast | Texture contrast, describing the intensity variation in the image |
Correlation | Texture correlation, measuring the similarity between a pixel and its neighbors |
Entropy | Texture entropy, representing the diversity of information in the image; higher values indicate more complex textures |
Homogeneity | Texture homogeneity, assessing the consistency of the texture |
IntensityMean / Std / Max / Min | Mean, standard deviation, maximum, and minimum of the texture intensity |
Feature | Description |
---|---|
Area | Area of the Delaunay triangle around the cell |
Perimeter | Perimeter of the Delaunay triangle around the cell |
Angle_Range | Difference between the maximum and minimum angles of the Delaunay triangle around the cell |
@software{pypathomics,
author = {HY Cui and XX Wang and J Xu and DP Chen},
title = {PyPathomics},
year = 2024,
publisher = {GitHub},
url = {https://github.com/HaoyuCui/PyPathomics},
version = {1.0},
}