Metadata-Version: 2.4
Name: cellmap-flow
Version: 0.2.3
Summary: Realtime prediction using neuroglancer
Author-email: David Ackerman <ackermand@hhmi.org>, Marwan Zouinkhi <zouinkhim@hhmi.org>
License: BSD 3-Clause License
Requires-Python: <4.0,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pymorton
Requires-Dist: numpy
Requires-Dist: PyYAML
Requires-Dist: gunicorn
Requires-Dist: fastremap
Requires-Dist: fastmorph
Requires-Dist: flask
Requires-Dist: flask-cors
Requires-Dist: tensorstore
Requires-Dist: funlib.geometry
Requires-Dist: marshmallow
Requires-Dist: scikit-image
Requires-Dist: flasgger
Requires-Dist: numcodecs==0.15.0
Requires-Dist: zarr==2.18.4
Requires-Dist: xarray==2024.7.0
Requires-Dist: h5py
Requires-Dist: s3fs
Requires-Dist: torch
Requires-Dist: universal_pathlib
Requires-Dist: mwatershed
Requires-Dist: funlib.math
Requires-Dist: neuroglancer
Requires-Dist: pydantic
Requires-Dist: funlib.persistence==0.6.1
Requires-Dist: daisy
Requires-Dist: cellmap-models
Requires-Dist: huggingface_hub
Provides-Extra: dacapo
Requires-Dist: dacapo-ml; extra == "dacapo"
Provides-Extra: cellpose
Requires-Dist: cellpose==3.1.1.1; extra == "cellpose"
Provides-Extra: bioimageio
Requires-Dist: bioimageio.core[onnx,pytorch]==0.7.0; extra == "bioimageio"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-lazy-fixtures; extra == "test"
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pdbpp; extra == "dev"
Requires-Dist: rich; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
Requires-Dist: sphinx-autoapi; extra == "docs"
Requires-Dist: sphinx-click; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: myst-parser; extra == "docs"
Requires-Dist: nbsphinx; extra == "docs"
Requires-Dist: myst_nb; extra == "docs"
Requires-Dist: jupytext; extra == "docs"
Provides-Extra: postprocess
Requires-Dist: edt; extra == "postprocess"
Requires-Dist: mwatershed; extra == "postprocess"
Requires-Dist: funlib.math; extra == "postprocess"
Dynamic: license-file

**🚧 This repository is still under construction. 🚧**

Please feel free to explore and contribute, but note that there may be frequent changes.



<p align="center">
  <img src="https://raw.githubusercontent.com/janelia-cellmap/cellmap-flow/refs/heads/main/img/CMFLOW_dark.png" alt="CellMapFlow Logo" />
</p>

<p align="center">
  <a href="#"><img src="https://img.shields.io/badge/Status-Under_Construction-orange.svg" alt="Under Construction" /></a>
</p>

<p align="center">
  <strong>Real-time inference is performed using Torch/Tensorflow, Dacapo, and bioimage models on local data or any cloud-hosted data.</strong>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/janelia-cellmap/cellmap-flow/refs/heads/main/img/flow.gif" alt="Animated demonstration of CellMapFlow's real-time data processing workflow" />
</p>

<p align="center">
  🚀 Speed up your data processing from months to minutes!
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/janelia-cellmap/cellmap-flow/refs/heads/main/img/jrc.gif" alt="Real-time data processing visualization" />
</p>





## Installation

To install CellMapFlow, you can use pip:

```bash
pip install cellmap-flow
```

Note that the basic installation does not include DaCapo and BioImage.io core dependencies. To install CellMapFlow with DaCapo support, use the following command:

```bash
pip install cellmap-flow[dacapo]
```

To install CellMapFlow with BioImage.io support, use the following command:

```bash
pip install cellmap-flow[bioimage]
```

To install CellMapFlow with both DaCapo and BioImage.io support, use the following command:

```bash
pip install cellmap-flow[dacapo,bioimage]
```

## Usage

```bash
$ cellmap_flow

Usage: cellmap_flow [OPTIONS] COMMAND [ARGS]...

  Examples:     
    To use Dacapo run the following commands:  
    cellmap_flow dacapo -r my_run -i iteration -d data_path

    To use custom script
    cellmap_flow script -s script_path -d data_path

    To use bioimage-io model 
    cellmap_flow bioimage -m model_path -d data_path


Commands:
  bioimage  Run the CellMapFlow server with a bioimage-io model.
  dacapo    Run the CellMapFlow server with a DaCapo model.
  script    Run the CellMapFlow server with a custom script.
```

Currently available:
## Using custom script:
This enables using any model by providing a script e.g. [example/model_spec.py](example/model_spec.py)
e.g.
```bash
cellmap_flow script -s /groups/cellmap/cellmap/zouinkhim/cellmap-flow/example/model_spec.py -d /nrs/cellmap/data/jrc_mus-cerebellum-1/jrc_mus-cerebellum-1.zarr/recon-1/em/fibsem-uint8/s0 
```

### Script keywords:
Define these variables in your script (`cellmap_flow script -s path/to/your_script.py`):
- **model**: 
  The PyTorch model to be used for inference. 
- **input_size**: 
  The voxel shape of the data to be input to the PyTorch model.
- **output_size**: 
  The voxel shape of the data in output by the PyTorch model.
- **input_voxel_size**: 
  The voxel size of the data input to the model.
- **output_voxel_size**: 
  The voxel size of the data output by the model.
- **output_channels**:
  The number of channels in the output of the model.
- **process_chunk** (optional):
  (Optional) A function that takes an ImageDataInterface and an ROI and returns the data to be display. This can be used to run a TensorFlow model or do other custom data processing.

## Using Dacapo model:
which enable inference using a Dacapo model by providing the run name and iteration number
e.g.
```bash
cellmap_flow dacapo -r 20241204_finetune_mito_affs_task_datasplit_v3_u21_kidney_mito_default_cache_8_1 -i 700000 -d /nrs/cellmap/data/jrc_ut21-1413-003/jrc_ut21-1413-003.zarr/recon-1/em/fibsem-uint8/s0
```

## Using bioimage-io model:
still in development

## Using TensorFlow model:
To run TensorFlow models, we suggest installing TensorFlow via conda: `conda install tensorflow-gpu==2.16.1`

##  Run multiple model at once: 
```bash
cellmap_flow_multiple --script -s /groups/cellmap/cellmap/zouinkhim/cellmap-flow/example/model_spec.py -n script_base --dacapo -r 20241204_finetune_mito_affs_task_datasplit_v3_u21_kidney_mito_default_cache_8_1 -i 700000 -n using_dacapo -d /nrs/cellmap/data/jrc_ut21-1413-003/jrc_ut21-1413-003.zarr/recon-1/em/fibsem-uint8/s0
```

