Code to perform analysis on segmentations like those produced by CellMap
Project description
cellmap-analyze
A suite of Dask-powered tools for processing and analyzing terabyte-scale 3D segmentation datasets.
Features
Processing Tools
| Tool | CLI Command | Description |
|---|---|---|
| Connected Components | connected-components |
Threshold and mask segmentations. |
| Clean Components | clean-connected-components |
Refine and clean existing segmentations. |
| Contact Sites | contact-sites |
Identify object contact regions with configurable contact distance. |
| Fill Holes | fill-holes |
Fill interior gaps in segmented volumes. |
| Filter IDs | filter-ids |
Exclude unwanted segmentation IDs. |
| Mutex Watershed | mws |
Mutex watershed agglomeration from affinities |
| Label With Mask | label-with-mask |
Label one dataset with ids from another |
| Watershed Segmentation | watershed-segmentation |
Watershed a segmentation; currently only works by doing watershed globally, but distance transform and seed finding work blockwise |
| Morphological Operations | morphological-operations |
Allowe for erosion and dilation of a segmented dataset, but since ordering of processing may matter, there is no guarantee of consistency based on order of blocks processed |
Analysis Tools
| Tool | CLI Command | Description |
|---|---|---|
| Measurement | measure |
Compute metrics (volume, surface area) for objects and contact sites. |
| Fit Lines | fit_lines_to_segmentations |
Fit geometric lines to elongated/cylindrical structures. |
| Assign to Cells | assign_to_cells |
Map segmented objects to cells based on centers of mass. |
Installation
Install via PyPI:
pip install cellmap-analyze
Usage
All commands share the same basic interface:
<command> [options] <config_path>
-
<command>: One of the processing or analysis tools listed above. -
<config_path>: Directory containing:run-config.yaml(parameters for your chosen command)dask-config.yaml(Dask cluster settings)
Options:
-n, --num-workers N: Number of Dask workers to launch.
Output: A new directory named
config_path-<YYYYMMDDHHMMSS>will be created, containing copies of your configs and anoutput.logfor monitoring.
Configuration Examples
The following run-config.yaml could be used to run connected-components.
run-config.yaml
input_path: /path/to/predictions.zarr/mito/s0
output_path: /path/to/segmentations.zarr/mito
intensity_threshold_minimum: 0.71
minimum_volume_nm_3: 1E7
delete_tmp: true
connectivity: 1
mask_config:
cell:
path: /path/to/masks.zarr/cell/s0
mask_type: inclusive
fill_holes: true
dask-config.yaml
The following dask-config.yaml files can be used for a variety of tasks.
Local
jobqueue:
local:
ncpus: 1
processes: 1
cores: 1
log-directory: job-logs
name: dask-worker
distributed:
scheduler:
work-stealing: true
LSF Cluster
jobqueue:
lsf:
ncpus: 8 # cores per job chunk
processes: 12 # worker processes per chunk
cores: 12 # threads per process (1 thread each)
memory: 120GB # 15 GB per slot
walltime: 08:00
mem: 12000000000
use-stdin: true
log-directory: job-logs
name: cellmap-analyze
project: charge_group
distributed:
scheduler:
work-stealing: true
admin:
log-format: '[%(asctime)s] %(levelname)s %(message)s'
tick:
interval: 20ms
limit: 3h
Submission
To run on 12 dask workers:
Local run example:
connected-components -n 12 config_path
Cluster submit example (LSF):
bsub -n 4 -P chargegroup connected-components -n 12 config_path
Acknowledgements
The center-finding implementation is taken from funlib.evaluate.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 cellmap_analyze-0.1.4.tar.gz.
File metadata
- Download URL: cellmap_analyze-0.1.4.tar.gz
- Upload date:
- Size: 866.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3113b4f1dbadc8731ae7d78055e251b77e67139b090db08e779db38bfe5f133
|
|
| MD5 |
efbad6dce7f95cf8c0583bdc2d2c2023
|
|
| BLAKE2b-256 |
a5ea0f3cc634287c5ec6cff9cdda25560bdc230ecabdfb8346600bf78f882ff1
|
File details
Details for the file cellmap_analyze-0.1.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: cellmap_analyze-0.1.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7293e8c3357919f84a1ad8730199a42a50027985aaedd0b3835aee098b031e7
|
|
| MD5 |
e35f0c4f3b00286e0fde21c3647846dc
|
|
| BLAKE2b-256 |
01e409c2f6222d6fa4ff404ee8656b34f7ca8e81e16df4b58d6f426af6527e6b
|
File details
Details for the file cellmap_analyze-0.1.4-cp312-cp312-macosx_10_13_universal2.whl.
File metadata
- Download URL: cellmap_analyze-0.1.4-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
622f0634236b60f645da831d7d8ca65ff3268f53c717748cbeb376692669d48e
|
|
| MD5 |
f00f705728fd36c4d79f7cd22c7e448a
|
|
| BLAKE2b-256 |
2c55b68f48a4c59814724350a9d0554f7ffcaeedc79c5e995797849968093543
|