Metadata-Version: 2.4
Name: torch-volpy
Version: 0.1.0
Summary: PyTorch tools for voltage imaging movie processing and signal extraction.
License-Expression: MIT
Keywords: voltage-imaging,calcium-imaging,neuroscience,pytorch,signal-extraction,motion-correction
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cellpose
Requires-Dist: h5py>=3.8
Requires-Dist: matplotlib>=3.7
Requires-Dist: numpy>=1.24
Requires-Dist: tifffile>=2023.7.10
Requires-Dist: torch>=2.0
Provides-Extra: segmentation
Provides-Extra: gui
Requires-Dist: PyQt6>=6.6; extra == "gui"
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Dynamic: license-file

# torch-volpy

PyTorch tools for voltage imaging movie processing and signal extraction.

The package currently provides:

- HDF5-backed movie I/O through `Movie`
- Motion template building, translation estimation, and motion correction
- Gaussian high-pass filtering
- Summary image generation
- Cellpose-based segmentation support
- ALI and SpikePursuit signal extraction

## Installation

```bash
pip install torch-volpy
```

Install the GUI extra for interactive movie viewing and ROI trace extraction:

```bash
pip install "torch-volpy[gui]"
torch-volpy-gui
```

For local development from this repository:

```bash
python -m pip install -e ".[gui,dev]"
```

## Basic Imports

```python
from torch_volpy.movie import Movie
from torch_volpy.motion import MotionCorrect, Template, Translation
from torch_volpy.filter import Filter
from torch_volpy.model import Summary
from torch_volpy.extraction import ALI, Spikepursuit
from torch_volpy.model import Cellpose
```

## GUI

The PyQt GUI opens HDF5 movies (`.h5`/`.hdf5`, dataset defaults to `movie`) and
TIFF stacks (`.tif`/`.tiff`). It provides frame playback, Cellpose ROI
generation from a summary image, loading existing ROI masks (`.tif`, `.npy`,
`.npz`, `.h5`/`.hdf5`), click-to-select ROI picking, and trace extraction with:

- `Spikepursuit` as the default extraction method
- `ALI` for cropped ROI activity localization
- a simple mean-ROI trace for quick inspection

The Cellpose ROI button follows the test workflow in `_test/test_cellpose.py`:
build `Summary(movie)`, stack `[mean, mean, corr]`, and pass that image to
`Cellpose.build(...)`. The resulting labeled mask is shown as an overlay; click
an ROI in `Select` mode to choose which label is used for trace extraction.

When opening a TIFF stack, the GUI first converts it to a sibling HDF5 file,
runs motion correction into `corrected_<name>.h5`, and then displays the
corrected HDF5 movie. A progress bar in the Movie panel reports conversion and
motion-correction phases.

<p align="center">
  <img src="./media/2026-06-06%20231838.png" width="800" alt="App Screenshot">
</p>
<p align="center">
  <img src="./media/2026-06-06%20232535.png" width="800" alt="App Screenshot">
</p>

## How To Build

```bash
python -m build
```

The build artifacts are written to `dist/`.
