Code for classifying the cell candidate outputs from aind-smartspim-segmentation within the SmartSPIM pipeline. It uses the aind-large-scale-prediction package to efficiently process large amounts of image data.
This repository takes as input the cell proposals that will be classified by the CellFinder model. The output is a CSV with the following columns:
- Cell Counts: Number of positive cells.
- Cell Likelihood Mean: Mean of the probabilities of a cell being a cell.
- Cell Likelihood STD: Standard deviation of the probability of a cell being a cell.
- Noncell Counts: Number of negative cells.
- Noncell Likelihood Mean: Mean of the probabilities of negative cells.
- Noncell Likelihood STD: Standard deviation of the probabilities of negative cells.
- Python 3.9
- A CUDA-capable GPU (the pipeline is designed to run on GPU; see
environment/Dockerfilefor the full hardware/software stack) - Conda — the production environment uses the
cell_classconda environment defined inenvironment/environment.yml
For local development outside of Code Ocean, a CUDA GPU is not strictly required to run tests, but is needed to run the full pipeline.
From the repository root, install the package and its dependencies:
pip install -e .To install development tools (linters, test runner, coverage):
pip install -e ".[dev]"Note: The Python package (
aind_smartspim_classification) lives insidecode/. Thepyproject.tomlat the root configuressetuptoolsto find it there automatically.
The capsule entry point is code/run. It activates the cell_class conda environment, sets KERAS_BACKEND=torch, and executes code/run_capsule.py. Inputs are mounted at /data and outputs are written to /results.
For SLURM-based execution, use code/run_slurm instead.
After installing with pip install -e ".[dev]", the following tools are available:
- Run the test suite with coverage:
pytest code/tests/ --cov=aind_smartspim_classification --cov-report=term-missing- Check documentation coverage:
interrogate .- Check code style:
flake8 code/- Auto-format code:
black code/- Sort imports:
isort code/For internal members, please create a branch. For external members, please fork the repository and open a pull request from the fork. We primarily use Angular style for commit messages:
<type>(<scope>): <short summary>
where scope (optional) describes the packages affected and type (mandatory) is one of:
- build: Changes that affect build tools or external dependencies (example scopes: pyproject.toml)
- ci: Changes to CI configuration files and scripts
- docs: Documentation only changes
- feat: A new feature
- fix: A bugfix
- perf: A code change that improves performance
- refactor: A code change that neither fixes a bug nor adds a feature
- test: Adding missing tests or correcting existing tests
To generate RST source files for Sphinx documentation, run from the repo root:
sphinx-apidoc -o doc_template/source/ code/Then build HTML:
sphinx-build -b html doc_template/source/ doc_template/build/htmlMore info on Sphinx installation can be found here.