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
Tests are run against Python 3.12 and 3.13, on Linux and Windows using pip and miniforge3.
Until the package is published to PyPI, you have a few options to download the software:
git clone(recommended)- Download directly from GitHub (code -> Download ZIP)
- Install directly from a branch (see Skip the cloning step)
git clone https://github.com/apasarkar/masknmf-toolbox.git
cd masknmf-toolboxVirtual environments are outside the scope of this README, but in general we recommend:
- UV (strongly recommended, prepend
uvto allpipcommands)
uv pip install .pip install .The only tested and supported flavor of anaconda is miniforge3:
conda create -n masknmf -c conda-forge python=3.12
pip install .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 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-smiWindows 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_0Install the version of PyTorch that matches your cuda and operating system on the PyTorch Getting Started.
See the notebooks folder for demos on how to use the motion correction, compression, and demixing APIs.
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.
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.