Skip to content

apasarkar/masknmf-toolbox

Repository files navigation

masknmf-toolbox

Installation | API | Data Formats | Paper |

PyTorch implementation of the masknmf framework for {calcium, voltage, glutamate} imaging analysis. Supports GPU-accelerated:

  • Motion Correction
  • Compression and Denoising
  • Signal Demixing
  • High-performance visualization

Installation

Tests are run against Python 3.12 and 3.13, on Linux and Windows using pip and miniforge3.

Download the repository

Until the package is published to PyPI, you have a few options to download the software:

  1. git clone (recommended)
  2. Download directly from GitHub (code -> Download ZIP)
  3. Install directly from a branch (see Skip the cloning step)
git clone https://github.com/apasarkar/masknmf-toolbox.git
cd masknmf-toolbox

pip

Virtual environments are outside the scope of this README, but in general we recommend:

  • UV (strongly recommended, prepend uv to all pip commands)
uv pip install .
pip install .

miniforge3

The only tested and supported flavor of anaconda is miniforge3:

conda create -n masknmf -c conda-forge python=3.12
pip install .

Skip the cloning step

If your environment is already set up, you can skip the cloning step and install directly from a branch of the repository:

# with standard venvs 
$ pip install git+https://github.com/apasarkar/masknmf-toolbox.git@main
# or with UV
$ uv pip install git+https://github.com/apasarkar/masknmf-toolbox.git@main

Installed 1 package in 0.63ms
 - masknmf-toolbox==0.1.0 
 + masknmf-toolbox==0.1.0 

GPU Dependencies

The default installation of PyTorch will not have cuda enabled. To get the cuda-enabled PyTorch installation

Find which Cuda version you're using (e.g. cuda_12.6)

nvcc --version
% or
nvidia-smi

Windows should have nvcc available in the command prompt if you have installed the CUDA toolkit.

If not, you can find it in the CUDA installation directory:

  • Windows:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin
  • Linux/Unix: /usr/local/cuda/bin/nvcc
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:55:00_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0

Install the version of PyTorch that matches your cuda and operating system on the PyTorch Getting Started.

API

See the notebooks folder for demos on how to use the motion correction, compression, and demixing APIs.

Data Formats

Support currently provided for

  • multipage .tiff files
  • hdf5 files.

Support for other formats can be easily added by defining a data loader class that implements LazyDataLoader.

Paper

If you use this method, please cite the accompanying paper

maskNMF: A denoise-sparsen-detect approach for extracting neural signals from dense imaging data. (2023). A. Pasarkar*, I. Kinsella, P. Zhou, M. Wu, D. Pan, J.L. Fan, Z. Wang, L. Abdeladim, D.S. Peterka, H. Adesnik, N. Ji, L. Paninski.

About

Tools for motion correcting, compressing, demixing and visualizing single cell functional imaging data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors