Skip to content

Gui improvement #1164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 49 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# suite2p <img src="suite2p/logo/logo_unshaded.png" width="250" title="sweet two pea" alt="sweet two pea" align="right" vspace = "50">
# suite2p (Custom Fork)

**This is a fork of the [official suite2p repository](https://github.com/MouseLand/suite2p).
Maintained by Ahmed Jamali / Yaksi- Lab / Kavli Institute for Systems Neuroscience / Norwegian University of Science and Technology.**

This fork contains modifications and extra code snippets to handle the processing of SciScan raw files and other specialized use cases.
It retains the [GPL v3 license](./LICENSE) from the original authors.

> **For the official Suite2p code, issues, or documentation, please visit the
> [MouseLand suite2p GitHub](https://github.com/MouseLand/suite2p).**

----

<!--
### (Optional) Badges
Below are badges from the *original* Suite2p repo. They may not apply to this fork.
Uncomment or modify them if you have set up your own CI/CD or coverage.

[![Documentation Status](https://readthedocs.org/projects/suite2p/badge/?version=latest)](https://suite2p.readthedocs.io/en/latest/?badge=latest)
![tests](https://github.com/mouseland/suite2p/actions/workflows/test_and_deploy.yml/badge.svg)
Expand All @@ -13,49 +29,60 @@
[![repo size](https://img.shields.io/github/repo-size/MouseLand/suite2p)](https://github.com/MouseLand/suite2p/)
[![GitHub stars](https://img.shields.io/github/stars/MouseLand/suite2p?style=social)](https://github.com/MouseLand/suite2p/)
[![GitHub forks](https://img.shields.io/github/forks/MouseLand/suite2p?style=social)](https://github.com/MouseLand/suite2p/)
-->

----

## Original README (with slight edits for fork)

Pipeline for processing two-photon calcium imaging data.
Copyright (C) 2018 Howard Hughes Medical Institute Janelia Research Campus
<img src="suite2p/logo/logo_unshaded.png" width="250" title="sweet two pea" alt="sweet two pea" align="right" vspace="50">

Pipeline for processing two-photon calcium imaging data.
Copyright (C) 2018 Howard Hughes Medical Institute Janelia Research Campus

suite2p includes the following modules:

* Registration
* Cell detection
* Spike detection
* Visualization GUI
- Registration
- Cell detection
- Spike detection
- Visualization GUI

This code was written by Carsen Stringer and Marius Pachitariu.
For support on the official version, please open an [issue on the official repo](https://github.com/MouseLand/suite2p/issues).

This code was written by Carsen Stringer and Marius Pachitariu.
For support, please open an [issue](https://github.com/MouseLand/suite2p/issues).
The reference paper is [here](https://www.biorxiv.org/content/early/2017/07/20/061507).
The deconvolution algorithm is based on [this paper](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005423),
with settings based on [this paper](http://www.jneurosci.org/content/early/2018/08/06/JNEUROSCI.3339-17.2018).

The reference paper is [here](https://www.biorxiv.org/content/early/2017/07/20/061507). The deconvolution algorithm is based on [this paper](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005423), with settings based on [this paper](http://www.jneurosci.org/content/early/2018/08/06/JNEUROSCI.3339-17.2018).
You can also run suite2p in Google Colab (no local install needed, though recommended):
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MouseLand/suite2p/blob/main/jupyter/run_suite2p_colab_2023.ipynb)

You can now run suite2p in google colab, no need to locally install (although we recommend doing so eventually): [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MouseLand/suite2p/blob/main/jupyter/run_suite2p_colab_2023.ipynb). Note you do not have access to the GUI via google colab, but you can download the processed files and view them locally in the GUI.
> **Note**: In a Colab environment, the GUI is not accessible, but you can process data and then download outputs locally to view in the GUI.

See this **twitter [thread](https://twitter.com/marius10p/status/1032804776633880583)** for GUI demonstrations.

The matlab version is available [here](https://github.com/cortex-lab/Suite2P). Note that the algorithm is older and will not work as well on non-circular ROIs.
The older MATLAB version is available [here](https://github.com/cortex-lab/Suite2P).
Note that the algorithm is older and may not work as well on non-circular ROIs.

Lectures on how suite2p works are available [here](https://youtu.be/HpL5XNtC5wU?list=PLutb8FMs2QdNqL4h4NrNhSHgLGk4sXarb).

**Note on pull requests**: we accept very few pull requests due to the maintenance efforts required to support new code, and we do not accept pull requests from automated code checkers. If you wrote code that interfaces/changes suite2p behavior, a common approach would be to keep that in a fork and pull periodically from the main branch to make sure you have the latest updates.

### CITATION

If you use this package in your research, please cite the [paper](https://www.biorxiv.org/content/early/2017/07/20/061507):

Pachitariu, M., Stringer, C., Schröder, S., Dipoppa, M., Rossi, L. F., Carandini, M., & Harris, K. D. (2016). Suite2p: beyond 10,000 neurons with standard two-photon microscopy. BioRxiv, 061507.


## Read the Documentation at https://suite2p.readthedocs.io/
## Documentation
For full documentation, please see the [official Suite2p docs](https://suite2p.readthedocs.io/).

## Local installation

1. Install an [Anaconda](https://www.anaconda.com/download/) distribution of Python -- Choose **Python 3.8** and your operating system. Note you might need to use an anaconda prompt if you did not add anaconda to the path.
2. Open an anaconda prompt / command prompt with `conda` for **python 3** in the path
3. Create a new environment with `conda create --name suite2p python=3.9`.
4. To activate this new environment, run `conda activate suite2p`
5. (Option 1) You can install the minimal version of suite2p, run `python -m pip install suite2p`.
4. To activate this new environment, run `conda activate suite2p`.
5. (Option 1) You can install the minimal version of suite2p, run `python -m pip install suite2p`.
6. (Option 2) You can install the GUI version with `python -m pip install suite2p[gui]`. If you're on a zsh server, you may need to use `' '` around the suite2p[gui] call: `python -m pip install 'suite2p[gui]'`. This also installs the NWB dependencies.
7. Now run `python -m suite2p` and you're all set.
8. Running the command `suite2p --version` in the terminal will print the install version of suite2p.
Expand All @@ -66,11 +93,6 @@ If you have an older `suite2p` environment you can remove it with `conda env rem

Note you will always have to run **conda activate suite2p** before you run suite2p. Conda ensures mkl_fft and numba run correctly and quickly on your machine. If you want to run jupyter notebooks in this environment, then also `conda install jupyter`.

To **upgrade** the suite2p (package [here](https://pypi.org/project/suite2p/)), run the following in the environment:
~~~~
pip install --upgrade suite2p
~~~~

### Dependencies

This package relies on the awesomeness of [pyqtgraph](http://pyqtgraph.org/), [PyQt6](http://pyqt.sourceforge.net/Docs/PyQt6/), [torch](http://pytorch.org), [numpy](http://www.numpy.org/), [numba](http://numba.pydata.org/numba-doc/latest/user/5minguide.html), [scanimage-tiff-reader](https://vidriotech.gitlab.io/scanimagetiffreader-python/), [scipy](https://www.scipy.org/), [scikit-learn](http://scikit-learn.org/stable/), [tifffile](https://pypi.org/project/tifffile/), [natsort](https://natsort.readthedocs.io/en/master/), and our neural visualization tool [rastermap](https://github.com/MouseLand/rastermap). You can pip install or conda install all of these packages. If having issues with PyQt6, then try to install within it conda install pyqt. On Ubuntu you may need to `sudo apt-get install libegl1` to support PyQt6. Alternatively, you can use PyQt5 by running `pip uninstall PyQt6` and `pip install PyQt5`. If you already have a PyQt version installed, suite2p will not install a new one.
Expand All @@ -81,23 +103,14 @@ The software has been heavily tested on Windows 10 and Ubuntu 18.04, and less we

The simplest way is
~~~
pip install git+https://github.com/MouseLand/suite2p.git
pip install git+https://github.com/AhmedJamali/suite2pR.git
~~~

If you want to download and edit the code, and use that version,
1. Clone the repository with git and `cd suite2p`
2. Run `pip install -e .` in that folder


### Installation for developers

1. Clone the repository and `cd suite2p` in an anaconda prompt / command prompt with `conda` for **python 3** in the path
2. Run `conda create --name suite2p python=3.9`
3. To activate this new environment, run `conda activate suite2p` (you will have to activate every time you want to run suite2p)
4. Install the local version of suite2p into this environment in develop mode with the command `pip install -e .[all]`
5. Run tests: `python setup.py test` or `pytest -vs`, this will automatically download the test data into your `suite2p` folder. The test data is split into two parts: test inputs and expected test outputs which will be downloaded in `data/test_inputs` and `data/test_outputs` respectively. The .zip files for these two parts can be downloaded from these links: [test_inputs](https://www.suite2p.org/static/test_data/test_inputs.zip) and [test_outputs](https://www.suite2p.org/static/test_data/test_outputs.zip).

## Examples
## Examples from the official repository

An example dataset is provided [here](https://drive.google.com/drive/folders/0B649boZqpYG1amlyX015SG12VU0?resourcekey=0-v-pxg8FwtFV7lqynlsuc9Q&usp=sharing). It's a single-plane, single-channel recording.

Expand Down Expand Up @@ -183,3 +196,6 @@ Copyright (C) 2023 Howard Hughes Medical Institute Janelia Research Campus, the

### Logo
Logo was designed by Shelby Stringer and [Chris Czaja](http://chrisczaja.com/).

NOTE: For questions related to this custom fork or its modifications, please contact Ahmed Jamali / Yaksi- Lab / Kavli Institute for Systems Neuroscience / Norwegian University of Science and Technology.
For official Suite2p help or issues, go to the official Suite2p repo.
124 changes: 67 additions & 57 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import setuptools

install_deps = ["importlib-metadata",
"natsort",
"rastermap>=0.9.0",
"tifffile",
"torch>=1.13.1",
"numpy>=1.24.3",
"numba>=0.57.0",
"matplotlib",
"scipy>=1.9.0",
"scikit-learn",
"cellpose",
"scanimage-tiff-reader>=1.4.1"
]
# ------------------------------------------------------------------------------------
# NOTE: This is a custom fork of Suite2p, originally by Marius Pachitariu & Carsen Stringer.
# We preserve their license (GPL v3) and give credit for the original code.
# This file has been adapted to clarify it is a modified version.
# ------------------------------------------------------------------------------------

install_deps = [
"importlib-metadata",
"natsort",
"rastermap>=0.9.0",
"tifffile",
"torch>=1.13.1",
"numpy>=1.24.3",
"numba>=0.57.0",
"matplotlib",
"scipy>=1.9.0",
"scikit-learn",
"cellpose",
"scanimage-tiff-reader>=1.4.1"
]

gui_deps = [
"qtpy",
"pyqt6",
"pyqt6.sip",
"pyqtgraph",
]
"qtpy",
"pyqt6",
"pyqt6.sip",
"pyqtgraph",
]

io_deps = [
"paramiko",
Expand All @@ -32,94 +39,97 @@
]

nwb_deps = [
"pynwb>=2.3.2",
]
"pynwb>=2.3.2",
]

test_deps = [
"pytest",
"tenacity",
"tqdm",
"pynwb>=2.3.2", #this is needed as test_io contains a test with nwb
"pytest-qt>3.3.0",
"pytest",
"tenacity",
"tqdm",
"pynwb>=2.3.2", # needed since test_io contains an NWB test
"pytest-qt>3.3.0",
]

# check if pyqt/pyside already installed
# Check if PyQt/PySide is installed to avoid conflicts
try:
import PyQt5
gui_deps.remove("pyqt6")
gui_deps.remove("pyqt6.sip")
except:
except ImportError:
pass

try:
import PySide2
gui_deps.remove("pyqt6")
gui_deps.remove("pyqt6.sip")
except:
except ImportError:
pass

try:
import PySide6
gui_deps.remove("pyqt6")
gui_deps.remove("pyqt6.sip")
except:
except ImportError:
pass

all_deps = gui_deps + nwb_deps + test_deps + io_deps
all_deps = gui_deps + nwb_deps + test_deps + io_deps

# Torch version check
try:
import torch
a = torch.ones(2, 3)
major_version, minor_version, _ = torch.__version__.split(".")
# Optionally remove older constraints if a newer Torch is present
if major_version == "2" or int(minor_version) >= 6:
install_deps.remove("torch>=1.6")
except:
except ImportError:
pass

with open("README.md", "r") as fh:
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

setuptools.setup(
name="suite2p",
author="Marius Pachitariu and Carsen Stringer",
author_email="[email protected]",
description="Pipeline for calcium imaging",
# Name changed to avoid conflicts with the official suite2p package on PyPI.
name="suite2p",
# Include both original and your info.
author="Marius Pachitariu, Carsen Stringer (Original Authors); Fork Maintainer: Ahmed Jamali",
author_email="[email protected]", # Replace with your contact if desired
description="Pipeline for calcium imaging (Custom Fork of Suite2p)",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/MouseLand/suite2p",
url="https://github.com/AhmedJamali/suite2pR",
packages=setuptools.find_packages(),
setup_requires=[
"pytest-runner",
"setuptools_scm",
"pytest-runner",
"setuptools_scm",
],
use_scm_version=True,
install_requires=install_deps,
tests_require=test_deps,
extras_require={
"docs": [
"sphinx>=3.0",
"sphinxcontrib-apidoc",
"sphinx_rtd_theme",
"sphinx-prompt",
"sphinx-autodoc-typehints",
],
"gui": gui_deps,
"nwb": nwb_deps,
"io": io_deps,
"tests": test_deps,
"all": all_deps,
"docs": [
"sphinx>=3.0",
"sphinxcontrib-apidoc",
"sphinx_rtd_theme",
"sphinx-prompt",
"sphinx-autodoc-typehints",
],
"gui": gui_deps,
"nwb": nwb_deps,
"io": io_deps,
"tests": test_deps,
"all": all_deps,
},
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
],
entry_points = {
entry_points={
"console_scripts": [
"suite2p = suite2p.__main__:main",
"reg_metrics = benchmarks.registration_metrics:main",
"tiff2scanimage = scripts.make_tiff_scanimage_compatible:main",
"suite2p = suite2p.__main__:main",
"reg_metrics = benchmarks.registration_metrics:main",
"tiff2scanimage = scripts.make_tiff_scanimage_compatible:main",
]
},
},
)
Loading