FISSA
=====
+------------------+----------------------------------------------------------------------+
| Latest Release | |PyPI badge| |Py Versions| |
+------------------+----------------------------------------------------------------------+
| License | |License| |
+------------------+----------------------------------------------------------------------+
| Documentation | |readthedocs| |
+------------------+----------------------------------------------------------------------+
| Build Status | |Documentation| |GHA tests| |AppVeyor| |Codecov| |pre-commit-status| |
+------------------+----------------------------------------------------------------------+
| Code style | |black| |pre-commit| |
+------------------+----------------------------------------------------------------------+
| Interactive Demo | |Binder| |
+------------------+----------------------------------------------------------------------+
| Support | |Gitter| |
+------------------+----------------------------------------------------------------------+
| Citation | |DOI badge| |
+------------------+----------------------------------------------------------------------+
FISSA (Fast Image Signal Separation Analysis) is a Python package for
decontaminating somatic signals from two-photon calcium imaging data.
It can read images in tiff format and ROIs from zip files exported by ImageJ_;
or operate on numpy arrays, generated by importing files stored in other
or as the output of other packages.
For details of the algorithm, please see our `companion paper <doi_>`_
published in Scientific Reports. For the code used to generate the simulated
data in the companion paper, see the `SimCalc repository`_.
FISSA is compatible with both Python 2.7 and Python >=3.5, however it is
strongly encouraged that you use Python 3, since as Python 2 has
`reached its end of life <sunset_python2_>`_.
FISSA is continually tested on Ubuntu, Windows, and Mac OSX during its
development cycle.
Documentation, including the full API, is available online at readthedocs_.
If you encounter a specific problem please `open a new issue`_. For general
discussion and help with installation or setup, please see the `Gitter chat`_.
.. _ImageJ: https://imagej.net/
.. _doi: https://www.doi.org/10.1038/s41598-018-21640-2
.. _SimCalc repository: https://github.com/rochefort-lab/SimCalc/
.. _sunset_python2: https://www.python.org/doc/sunset-python-2/
.. _readthedocs: https://fissa.readthedocs.io
.. _open a new issue: https://github.com/rochefort-lab/fissa/issues/new
.. _Gitter chat: https://gitter.im/rochefort-lab/fissa
Usage
-----
A concise example of how to use FISSA is as follows.
.. code:: python
import fissa
result = fissa.run_fissa("path/to/tiffs", "path/to/rois.zip")
# The decontaminated time series is now available as
# result[roi_index, tiff_index][0, :]
We also have several example notebooks for a basic workflow and more complicated
workflows where FISSA needs to interact with the outputs of other two-photon
calcium imaging toolboxes which can be used to automatically detect cells.
You can try out each of the example notebooks interactively in your browser on
Binder_ (note that it may take 10 minutes for Binder to boot up).
Note that the Suite2p notebook is housed in its own `repository <suite2p_example_repo_>`_, and runs on a `separate Binder <suitebind_>`_ instance from the other notebooks.
+---------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------+
| Workflow | Jupyter Notebook | Script |
+===========================+======================+===============================+==========================+================================+==============================+
| Function-based (ImageJ_) | `Docs <func_html_>`_ | `Launch Binder <func_bind_>`_ | `Download <func_down_>`_ | `Linux/Mac <func_nixscript_>`_ | `Windows <func_winscript_>`_ |
+---------------------------+----------------------+-------------------------------+--------------------------+--------------------------------+------------------------------+
| Object-oriented (ImageJ_) | `Docs <basichtml_>`_ | `Launch Binder <basicbind_>`_ | `Download <basicdown_>`_ | `Linux/Mac <basicnixscript_>`_ | `Windows <basicwinscript_>`_ |
+---------------------------+----------------------+-------------------------------+--------------------------+--------------------------------+------------------------------+
| With suite2p_ | `Docs <suitehtml_>`_ | `Launch Binder <suitebind_>`_ | `Download <suitedown_>`_ | | |
+---------------------------+----------------------+-------------------------------+--------------------------+--------------------------------+------------------------------+
| With SIMA_ | `Docs <sima_html_>`_ | `Launch Binder <sima_bind_>`_ | `Download <sima_down_>`_ | | |
+---------------------------+----------------------+-------------------------------+--------------------------+--------------------------------+------------------------------+
| With `CNMF (MATLAB)`_ | `Docs <cnmf_html_>`_ | `Launch Binder <cnmf_bind_>`_ | `Download <cnmf_down_>`_ | | |
+---------------------------+----------------------+-------------------------------+--------------------------+--------------------------------+------------------------------+
.. _Binder: https://mybinder.org/v2/gh/rochefort-lab/fissa/1.0.0?filepath=examples
.. _func_bind: https://mybinder.org/v2/gh/rochefort-lab/fissa/1.0.0?filepath=examples/Basic%20usage%20-%20Function.ipynb
.. _func_html: https://fissa.readthedocs.io/en/1.0.0/examples/Basic%20usage%20-%20Function.html
.. _func_view: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/Basic%20usage%20-%20Function.ipynb
.. _func_down: https://raw.githubusercontent.com/rochefort-lab/fissa/1.0.0/examples/Basic%20usage%20-%20Function.ipynb
.. _func_nixscript: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/basic_usage_func.py
.. _func_winscript: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/basic_usage_func_windows.py
.. _basicbind: https://mybinder.org/v2/gh/rochefort-lab/fissa/1.0.0?filepath=examples/Basic%20usage.ipynb
.. _basichtml: https://fissa.readthedocs.io/en/1.0.0/examples/Basic%20usage.html
.. _basicview: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/Basic%20usage.ipynb
.. _basicdown: https://raw.githubusercontent.com/rochefort-lab/fissa/1.0.0/examples/Basic%20usage.ipynb
.. _basicnixscript: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/basic_usage.py
.. _basicwinscript: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/basic_usage_windows.py
.. _suite2p: https://suite2p.readthedocs.io/
.. _suite2p_example_repo: https://github.com/rochefort-lab/fissa-suite2p-example/
.. _suitebind: https://mybinder.org/v2/gh/rochefort-lab/fissa-suite2p-example/master?filepath=Suite2p%20example.ipynb
.. _suitehtml: https://fissa.readthedocs.io/en/1.0.0/examples/Suite2p%20example.html
.. _suiteview: https://github.com/rochefort-lab/fissa-suite2p-example/blob/master/Suite2p%20example.ipynb
.. _suitedown: https://raw.githubusercontent.com/rochefort-lab/fissa-suite2p-example/master/Suite2p%20example.ipynb
.. _SIMA: http://www.losonczylab.org/sima/
.. _sima_bind: https://mybinder.org/v2/gh/rochefort-lab/fissa/1.0.0?filepath=examples/SIMA%20example.ipynb
.. _sima_html: https://fissa.readthedocs.io/en/1.0.0/examples/SIMA%20example.html
.. _sima_view: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/SIMA%20example.ipynb
.. _sima_down: https://raw.githubusercontent.com/rochefort-lab/fissa/1.0.0/examples/SIMA%20example.ipynb
.. _CNMF (MATLAB): https://github.com/flatironinstitute/CaImAn-MATLAB
.. _cnmf_bind: https://mybinder.org/v2/gh/rochefort-lab/fissa/1.0.0?filepath=examples/cNMF%20example.ipynb
.. _cnmf_html: https://fissa.readthedocs.io/en/1.0.0/examples/cNMF%20example.html
.. _cnmf_view: https://github.com/rochefort-lab/fissa/blob/1.0.0/examples/cNMF%20example.ipynb
.. _cnmf_down: https://raw.githubusercontent.com/rochefort-lab/fissa/1.0.0/examples/cNMF%20example.ipynb
These notebooks can also be run on your own machine.
To do so, you will need to:
0. If you want to run the Suite2p notebook, you'll have to install everything
into a conda environment, as per their `installation instructions <install_suite2p_>`_.
1. Install fissa with its plotting dependencies ``pip install fissa[plotting]``.
2. If you want to run the sima notebook, you will also have to install sima
with ``pip install sima``. Note that sima only supports python<=3.6.
3. Download `a copy of the repository <download_repo_>`_, unzip it and browse
to the examples_ directory.
4. Start up a Jupyter notebook server to run our notebooks ``jupyter notebook``.
If you're new to Jupyter notebooks, here is `an approachable tutorial`_.
.. _install_suite2p: https://mouseland.github.io/suite2p/_build/html/installation.html
.. _download_repo: https://github.com/rochefort-lab/fissa/archive/1.0.0.zip
.. _examples: https://github.com/rochefort-lab/fissa/tree/1.0.0/examples
.. _an approachable tutorial: https://www.datacamp.com/community/tutorials/tutorial-jupyter-notebook
Installation
------------
Quick Guide
~~~~~~~~~~~
FISSA is available on PyPI_ and the latest version can be installed into your
current environment using pip_.
.. code:: bash
pip install fissa
.. _PyPI: https://pypi.org/project/fissa
.. _pip: https://pip.pypa.io/
If you need more details or you're stuck with something in the dependency chain,
more detailed instructions for both Windows and Ubuntu users are below.
Installation on Windows
~~~~~~~~~~~~~~~~~~~~~~~
We detail two different ways to install Python on your Windows. One is to
download the `official Python installer <Official Python distribution_>`_,
and the other is to use `Anaconda <Anaconda distribution_>`_.
Official Python distribution
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1. Go to the `Python website <download_python_>`_ and download the latest
version of Python for Windows.
.. _download_python: https://www.python.org/downloads/
2. Run the executable file downloaded, which has a name formatted like
**python-3.y.z.exe**.
3. In the installation window, tick the checkbox "Add Python 3.y to PATH".
4. Click "Install Now", and go though the installation process to
install Python.
5. Open the **Command Prompt** application. We can run Python from the
general purpose command prompt because we added its binaries to the
global ``PATH`` variable in Step |nbsp| 3.
6. At the **Command Prompt** command prompt, install fissa and its
dependencies by running the command:
.. code:: batch
pip install fissa
7. You can check to see if fissa is installed with:
.. code:: batch
python -c "import fissa; print(fissa.__version__)"
You should see your FISSA version number printed in the terminal.
8. You can now use FISSA from the Python command prompt. To open a python
command prompt, either execute the command ``python`` within the
**Command Prompt**, or open Python executable which was installed in
Step |nbsp| 4. At the python command prompt, you can run FISSA as described
in Usage_ above.
Anaconda distribution
^^^^^^^^^^^^^^^^^^^^^
1. Download and install the latest version of either
`Anaconda <download_anaconda_>`_ or Miniconda_. Miniconda is a
`lightweight version`_ of Anaconda, the same thing but without any packages
pre-installed.
.. _lightweight version: https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html#anaconda-or-miniconda
.. _download_anaconda: https://www.anaconda.com/products/individual#windows
.. _Miniconda: https://docs.conda.io/en/latest/miniconda.html
2. Open the **Anaconda Prompt**, which was installed by either Anaconda or
Miniconda in Step |nbsp| 1.
3. In the Anaconda Prompt, run the following command to install some of
FISSA's dependencies with conda.
.. code:: batch
conda install -c conda-forge numpy scipy shapely tifffile
4. Run the following command to install FISSA, along with the rest of its
dependencies.
.. code:: batch
pip install fissa
5. You can check to see if fissa is installed with:
.. code:: batch
python -c "import fissa; print(fissa.__version__)"
You should see your FISSA version number printed in the terminal.
6. You can now use FISSA from the Python command prompt. To open a python
command prompt, either execute the command ``python`` within the
**Anaconda Prompt**. At the python command prompt, you can run FISSA as
described in Usage_ above.
7. Optionally, if you want use suite2p_, it and its dependencies can be
installed as follows.
.. code:: batch
conda install -c conda-forge mkl mkl_fft numba pyqt
pip install suite2p rastermap
Installation on Linux
~~~~~~~~~~~~~~~~~~~~~
Before installing FISSA, you will need to make sure you have all of its
dependencies (and the dependencies of its dependencies) installed.
Here we will outline how to do all of these steps, assuming you already
have both Python and pip installed. It is highly likely that your Linux
distribution ships with these. You can upgrade to a newer version of Python
by `downloading Python`_ from the official website.
Alternatively, you can use an Anaconda_ environment (not detailed here).
.. _downloading Python: https://www.python.org/downloads/
.. _Anaconda: https://www.anaconda.com/products/individual
1. Dependencies of dependencies
- scipy_ requires a `Fortran compiler and BLAS/LAPACK/ATLAS`_
- shapely_ requires GEOS.
- Pillow_>=3.0.0 effectively requires a JPEG library.
These packages can be installed on Debian/Ubuntu with the following
shell commands.
.. code:: bash
sudo apt-get update
sudo apt-get install gfortran libopenblas-dev liblapack-dev libatlas-dev libatlas-base-dev
sudo apt-get install libgeos-dev
sudo apt-get install libjpeg-dev
.. _scipy: https://pypi.python.org/pypi/scipy/
.. _Fortran compiler and BLAS/LAPACK/ATLAS: http://www.scipy.org/scipylib/building/linux.html#installation-from-source
.. _shapely: https://pypi.python.org/pypi/Shapely
.. _Pillow: https://pypi.org/project/Pillow/
2. Install the latest release version of FISSA from PyPI_ using pip_:
.. code:: bash
pip install fissa
3. You can check to see if FISSA is installed by running the command:
.. code:: bash
python -c "import fissa; print(fissa.__version__)"
You will see your FISSA version number printed in the terminal.
4. You can now use FISSA from the Python command prompt, as
described in Usage_ above.
Citing FISSA
------------
If you use FISSA for your research, we would be grateful if you could cite our
paper on FISSA in any resulting publications:
S. W. Keemink, S. C. Lowe, J. M. P. Pakan, E. Dylda, M. C. W. van Rossum, and N. L. Rochefort. FISSA: A neuropil decontamination toolbox for calcium imaging signals, *Scientific Reports*, **8**\ (1):3493, 2018.
doi: |nbsp| `10.1038/s41598-018-21640-2 <doi_>`_.
For your convenience, we provide a copy of this citation in `bibtex`_ and `RIS`_ format.
.. _bibtex: https://raw.githubusercontent.com/rochefort-lab/fissa/1.0.0/citation.bib
.. _RIS: https://raw.githubusercontent.com/rochefort-lab/fissa/1.0.0/citation.ris
You can browse papers which utilise FISSA `here <gscholarcitations_>`_.
.. _gscholarcitations: https://scholar.google.com/scholar?cites=15500040671728073630
License
-------
Unless otherwise stated in individual files, all code is Copyright (c)
2015–2022, Sander Keemink, Scott Lowe, and Nathalie Rochefort. All rights
reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see http://www.gnu.org/licenses/.
.. |nbsp| unicode:: 0xA0
:trim:
.. |Gitter| image:: https://badges.gitter.im/Join%20Chat.svg
:target: `Gitter chat`_
:alt: Join the FISSA chat
.. |PyPI badge| image:: https://img.shields.io/pypi/v/fissa.svg
:target: PyPI_
:alt: Latest PyPI release
.. |Py Versions| image:: https://img.shields.io/pypi/pyversions/fissa
:target: PyPI_
:alt: Python Versions Supported
.. |GHA tests| image:: https://github.com/rochefort-lab/fissa/workflows/tests/badge.svg
:target: https://github.com/rochefort-lab/fissa/actions?query=workflow%3Atests
:alt: GHA Status
.. |AppVeyor| image:: https://img.shields.io/appveyor/build/scottclowe/rochefort-lab-fissa/master?label=Windows%20build
:target: https://ci.appveyor.com/project/scottclowe/rochefort-lab-fissa/branch/master
:alt: AppVeyor Build Status
.. |readthedocs| image:: https://img.shields.io/badge/docs-readthedocs-blue
:target: https://fissa.readthedocs.io/
:alt: Documentation
.. |Documentation| image:: https://readthedocs.org/projects/fissa/badge/
:target: https://fissa.readthedocs.io/
:alt: Documentation Status
.. |Codecov| image:: https://codecov.io/gh/rochefort-lab/fissa/branch/master/graph/badge.svg
:target: https://codecov.io/gh/rochefort-lab/fissa
:alt: Coverage
.. |Binder| image:: https://mybinder.org/badge_logo.svg
:target: Binder_
:alt: Launch Notebooks in Binder
.. |DOI badge| image:: https://img.shields.io/badge/DOI-10.1038/s41598--018--21640--2-blue.svg
:target: doi_
:alt: DOI
.. |License| image:: https://img.shields.io/pypi/l/fissa
:target: https://raw.githubusercontent.com/rochefort-lab/fissa/1.0.0/LICENSE
:alt: GPLv3 License
.. |pre-commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commit enabled
.. |pre-commit-status| image:: https://results.pre-commit.ci/badge/github/rochefort-lab/fissa/1.0.0.svg
:target: https://results.pre-commit.ci/latest/github/rochefort-lab/fissa/1.0.0
:alt: pre-commit.ci status
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: black