Pycroglia
A Python-based toolkit for quantitative 3D morphology analysis of cells from fluorescence microscopy images.
Originally based on the MATLAB tool CellSelect-3DMorph, Pycroglia reconstructs individual cells voxel-by-voxel and extracts quantitative morphological descriptors. It is built with a robust, extensible Python architecture and supports both a PyQt6 graphical interface and a library mode for automated/scripted workflows.
Features
Morphological Analysis
- Cell volume – Voxel-accurate 3D cell volume computation
- Territorial volume – Convex-hull based territorial volume and coverage statistics
- Ramification index – Complexity ratio comparing cell volume to territorial volume
- Branch analysis – Branch length (with linear, PCHIP, and spline interpolation), branch count, branch order classification (primary to quaternary), end point detection
- Centroid analysis – 3D centroid coordinates and mean pairwise distances in physical units
- Convex hull metrics – Hull volume, surface area, solidity, and compactness ratios
Image Processing Pipeline
- Multi-channel reader – TIFF file format support with automatic channel extraction
- Otsu thresholding – Per-slice MATLAB-compatible Otsu thresholding with interactive adjustment
- Small object removal – Minimum-size filtering to eliminate noise artifacts
- Morphological erosion – Configurable 2D/3D structuring elements (disk, diamond, ball, octahedron, rectangle)
- GMM clustering – Gaussian Mixture Model-based nucleus separation for splitting merged cells
- Interactive segmentation – Per-cell segmentation with undo/rollback support
3D Skeletonization
- Lee-Kashyap-Chu algorithm – Full implementation of the 3D thinning algorithm with based Skeleton3D method used by CellSelect-3DMorph.
- Scikit-image fallback – Alternative skeletonization backend via
skimage.morphology.skeletonize - Skeleton-to-graph conversion – Convert binary skeletons to graph representations to prune short branches and back.
Visualization & Export
- 3D rendering – PyVista-powered visualizations: original cell surfaces, skeleton branch order coloring, end points, branch points, convex hulls
- Geometry export – Export skeleton surfaces, cell mask surfaces, and boolean mask volumes in OBJ, PLY, VTP, VTK, VTI formats
- Results export – Structured output to Excel (XLSX) and JSON
- Branch lengths export – Specialized branch-lengths XLSX output for downstream analysis
Workflow & Performance
- Wizard-based GUI – Step-by-step workflow: file selection → filtering → segmentation → cell selection → analysis dashboard
- Library mode – Import
pycroglia.coredirectly for automated batch processing - Parallel computation – Qt thread pool and multiprocessing backends via a unified
Poolfacade; metrics computed concurrently via a DAG-based orchestrator - Interactive dashboards – Per-file tabs throughout the pipeline, summary tables, per-cell viewers, and graph preview before export
Installation
Option 1 — Standalone Executables (No Python Installation Required)
For a quick setup without installing Python or any dependencies, you can download standalone pre-compiled executables from the Latest Release:
- Go to the Releases page.
- In the Assets section of the latest release, download the file matching your operating system:
- Windows: Download
pycroglia-windows.exeand double-click to run. - macOS: Download
pycroglia-macos.zip, extract it to getPycroglia.app, and run it. (Note: Since the app is not signed, you may need to right-click it, select Open, and confirm). - Linux: Download
pycroglia-linux, make it executable, and run it via terminal:chmod +x pycroglia-linux ./pycroglia-linux
- Windows: Download
Option 2 — Run using uvx
Prerequisites
Install/Update and Run
uvx pycroglia
Option 3 — Install with pip
- Python 3.11 or later
- pip
pip install pycroglia
pycroglia
Option 4 — From source
git clone https://github.com/CGK-Laboratory/pycroglia.git
cd pycroglia
uv run python -m pycroglia
Run the test suite:
uv run pytest
Jupyter Notebook
Launch a notebook server connected to the project environment:
uv run --with jupyter jupyter lab
Usage
GUI Mode
Launch the application and follow the wizard:
- File Selection – Select TIFF or LSM image files
- Filter Editor – Adjust Otsu threshold per slice, remove small objects, configure erosion
- Segmentation Editor – View labeled cells by size, split merged cells via GMM
- Cell Selection – Filter cells by size, remove border cells, preview selections
- Results Dashboard – Set physical scale, compute all metrics, preview 3D visualizations, export results
Documentation
Full documentation is available at CGK-Laboratory.github.io/pycroglia (or locally via docs/).
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Release files for pycroglia 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycroglia-1.0.1.tar.gz | 129.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycroglia-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 312.8 kB
Release files / pycroglia-1.0.1.tar.gz
| Download URL | pycroglia-1.0.1.tar.gz |
|---|---|
| Size | 129.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c6384e068a2a8e6f46d2fa3fef7324a7841318f4d9f4260c8635ec272408d7e
|
|
BLAKE2b-256 checksum How to use checksums |
c98bdc41fd8140f5f5cb5ee86f2660baad00a3ea25055fa8c03fcd93758be412
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pycroglia-1.0.1-py3-none-any.whl
| Download URL | pycroglia-1.0.1-py3-none-any.whl |
|---|---|
| Size | 183.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0912fdb59c6ed71875e300ce8386d6efd9cbfa5409ae7a434e097b23ad720b8a
|
|
BLAKE2b-256 checksum How to use checksums |
7ea5fb14ab757668f760164a99d944f72fde23db46d4d07b16f092a0f03271ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|