Skip to main content

A library for classifying and tracking ROIs.

Project description

Welcome to ROICaT

ROICaT

Ask DeepWiki build PyPI version Downloads build

🎉 CONTRIBUTIONS WELCOME! 🎉
See the TODO section

Region Of Interest Classification and Tracking ᗢ

A simple-to-use Python package for automatically classifying images of cells and tracking them across imaging sessions/planes.

tracking_FOV_clusters_rich

Why use ROICaT?

  • It's easy to use. You don't need to know how to code. You can use the interactive notebooks or online app to run the pipelines with just a few clicks.
  • It's accurate. ROICaT was desgined to be better than existing tools. It is capable of classifying and tracking neuron ROIs at accuracies approaching human performance out of the box.
  • It's fast and computational requirements are low. You can run it on a laptop. It was designed to be used with >1M ROIs, and can utilize GPUs to speed things up.

With ROICaT, you can:

  • Classify ROIs into different categories (e.g. neurons, dendrites, glia, etc.).
  • Track ROIs across imaging sessions/planes (e.g. ROI #1 in session 1 is the same as ROI #7 in session 2).

What data types can ROICaT process?

  • ROICaT can accept any imaging data format including: Suite2p, CaImAn, CNMF, NWB, raw/custom ROI data and more. See below for details on how to use any data type with ROICaT.


How to use ROICaT

ROICaT

TRACKING:

roicat --pipeline tracking --path_params /path/to/params.yaml --dir_data /folder/with/data/ --dir_save /folder/save/ --prefix_name_save expName --verbose

CLASSIFICATION:

OTHER:

  • Custom data importing notebook
  • Use the API to integrate ROICaT functions into your own code: Documentation.
  • Run the full tracking pipeline using the CLI or roicat.pipelines.pipeline_tracking with default parameters generated from roicat.util.get_default_paramaters() saved as a yaml file.

Installation

ROICaT works on Windows, MacOS, and Linux. If you have any issues during the installation process, please make a github issue with the error.

0. Requirements

1. (Recommended) Create a new conda environment

conda create -n roicat python=3.12
conda activate roicat

You will need to activate the environment with conda activate roicat each time you want to use ROICaT.

2. Install ROICaT

pip install roicat[all]
pip install git+https://github.com/RichieHakim/roiextractors

Note on zsh: if you are using a zsh terminal, change command to: pip3 install --user 'roicat[all]'
Note on installing GPU support on Windows: see GPU Troubleshooting documentation.
Note on opencv: The headless version of opencv is installed by default. If the regular version is already installed, you will need to uninstall it first.

3. Clone the repo to get the notebooks

git clone https://github.com/RichieHakim/ROICaT

Then, navigate to the ROICaT/notebooks/jupyter directory to run the notebooks.

Upgrading versions

There are 2 parts to upgrading ROICaT: the Python package and the repository files which contain the notebooks and scripts.
Activate your environment first, then...
To upgrade the Python package, run:

pip install --upgrade roicat[all]

To upgrade the repository files, navigate your terminal to the ROICaT folder and run:

git pull

General workflow:

  • Pass ROIs through ROInet: Images of the ROIs are passed through a neural network which outputs a feature vector for each image describing what the ROI looks like.
  • Classification: The feature vectors can then be used to classify ROIs:
    • A simple regression-like classifier can be trained using user-supplied labeled data (e.g. an array of images of ROIs and a corresponding array of labels for each ROI).
    • Alternatively, classification can be done by projecting the feature vectors into a lower-dimensional space using UMAP and then simply circling the region of space to classify the ROIs.
  • Tracking: The feature vectors can be combined with information about the position of the ROIs to track the ROIs across imaging sessions/planes.

Run the app locally

Although, we recommend transitioning to using the notebooks or CLI instead of the app, you can download and run the app locally with the following command:

sudo docker run -it -p 7860:7860 --platform=linux/amd64 --shm-size=10g registry.hf.space/richiehakim-roicat-tracking:latest streamlit run app.py

TODO:

algorithmic improvements:

  • Add in method to use more similarity metrics for tracking
  • Coordinate descent on each similarity metric
  • Add F and Fneu to data_roicat, dFoF and trace quality metric functions
  • Add in notebook for demonstrating using temporal similarity metrics (SWT on dFoF)
  • Make a standard classifier
  • Try other clustering methods
  • Make image aligner based on image similarity + RANSAC of centroids or s_SF
  • Better post-hoc curation metrics and visualizations
  • Discount the non-rigid warp masks towards the edges to be more like the rigid warp map in order improve border performance
  • Make non-rigid image registration optional

code improvements:

  • Finish ROIextractors integration
  • Update automatic regression module (make new repo for it)
  • Switch to ONNX for ROInet
  • Some more integration tests
  • Figure out RNG / OS differences issues for tests
  • Add more documentation / tutorials
  • Make a GUI
  • Add settings to the GUI
  • [ ] Make a Docker container
  • Make colab demo notebook not require user data
  • Make a better CLI
  • Switch to pyproject.toml
  • Improve params.json / default params system
  • Spruce up training code
  • Switch off pickling optuna save file
  • Try training on cellpose datasets
  • Python 3.13

other:

  • Write the paper
  • Make tweet about it
  • Make a video or two on how to use it
  • Maybe use lightthetorch for torch installation
  • Better Readme
  • More documentation
  • Make a regression model for in-plane-ness
  • Formalize bounty program

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

roicat-1.5.5.tar.gz (226.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

roicat-1.5.5-py3-none-any.whl (218.7 kB view details)

Uploaded Python 3

File details

Details for the file roicat-1.5.5.tar.gz.

File metadata

  • Download URL: roicat-1.5.5.tar.gz
  • Upload date:
  • Size: 226.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for roicat-1.5.5.tar.gz
Algorithm Hash digest
SHA256 7bd88ccc1437a34b42379f3a3f96b3ccce154736d24ebb91d7208b71854b141f
MD5 e9a39f1c5ea8fc2261e250207259e6fa
BLAKE2b-256 95704195b67af32345554770177f3fc3b32c9b8ef67376c0520c070e081626dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for roicat-1.5.5.tar.gz:

Publisher: pypi_release.yml on RichieHakim/ROICaT

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roicat-1.5.5-py3-none-any.whl.

File metadata

  • Download URL: roicat-1.5.5-py3-none-any.whl
  • Upload date:
  • Size: 218.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for roicat-1.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 57a8cbbe2d7e14d0c471af15fb713d64367cf0a0a6bbe7d5fd90a72c5cac3bd5
MD5 1d3863b69e71a781f0bedeb26cc6450a
BLAKE2b-256 23068c779ed0f16e04370c9f4b48614307b2f044add4212ef982afca0ff4688b

See more details on using hashes here.

Provenance

The following attestation bundles were made for roicat-1.5.5-py3-none-any.whl:

Publisher: pypi_release.yml on RichieHakim/ROICaT

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page