# napari-animation
[![License](https://img.shields.io/pypi/l/napari-animation.svg?color=green)](https://github.com/napari/napari-animation/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/napari-animation.svg?color=green)](https://pypi.org/project/napari-animation)
[![Python Version](https://img.shields.io/pypi/pyversions/napari-animation.svg?color=green)](https://python.org)
[![tests](https://github.com/napari/napari-animation/actions/workflows/test_and_deploy.yml/badge.svg)](https://github.com/napari/napari-animation/actions)
[![codecov](https://codecov.io/gh/napari/napari-animation/branch/main/graph/badge.svg)](https://codecov.io/gh/napari/napari-animation)
**napari-animation** is a plugin for making animations in [napari](https://napari.org).
<p align="center">
<img width="500" src="https://user-images.githubusercontent.com/7307488/196110138-6c4663b1-67b2-4c79-97b7-57b706d1d49c.gif">
</p>
----------------------------------
[Merlin Lange](https://twitter.com/Merlin_Lange) used *napari-animation* to create one of [Nature's best science images for September 2022](https://www.nature.com/immersive/d41586-022-03051-6/index.html)
----------------------------------
This plugin is built on [`naparimovie`](https://github.com/guiwitz/naparimovie) from [@guiwitz](https://github.com/guiwitz). `naparimovie` was submitted to napari in [PR#851](https://github.com/napari/napari/pull/780) before napari plugin infrastructure existed.
----------------------------------
## Overview
**napari-animation** provides a framework for the creation of animations in napari. The plugin contains:
- an easy to use GUI for creating animations interactively;
- a Python package for the programmatic creation of animations.
This plugin remains under development and contributions are very welcome, please open an issue to discuss potential improvements.
You can read the documentation at [https://napari.org/napari-animation](https://napari.org/napari-animation)
## Installation
### PyPI
`napari-animation` is available through the Python package index and can be installed using `pip`.
```sh
pip install napari-animation
```
```{warning}
`napari-animation` uses `ffmpeg` to export animations. If you are using a macOS arm64 computer (Apple Silicon e.g. M1, M2 processor)
the PyPI package does not include the needed binary for your platform. You will need to install `ffmpeg` using
`conda` from the [conda-forge channel](https://conda-forge.org/docs/#what-is-conda-forge) (`conda install -c conda-forge ffmpeg`)
or using [`homebrew`](https://brew.sh) (`brew install ffmpeg`).
```
### Conda
`napari-animation` is also available for install using `conda` through the [conda-forge channel](https://conda-forge.org/docs/#what-is-conda-forge).
```sh
conda install -c conda-forge napari-animation
```
### Local
You can clone this repository and install locally with
pip install -e .
### Interactive use
**napari-animation** can be used interactively.
An animation is created by capturing [keyframes](https://en.wikipedia.org/wiki/Key_frame) containing the current viewer state.
<p align="center">
<img width="600" src="https://user-images.githubusercontent.com/7307488/196113682-96ce0da3-fa5c-411e-8fb1-52dc3a8f96b6.png">
</p>
To activate the GUI, select **napari-animation: wizard** from the *plugins menu*
<p align="center">
<img width="200" src="https://user-images.githubusercontent.com/7307488/196114466-56cb5985-0d79-4cfa-96f1-38cf3ccfbc48.png">
</p>
### Scripting
**napari-animation** can also be run programatically, allowing for reproducible, scripted creation of animations.
```python
from napari_animation import Animation
animation = Animation(viewer)
viewer.dims.ndisplay = 3
viewer.camera.angles = (0.0, 0.0, 90.0)
animation.capture_keyframe()
viewer.camera.zoom = 2.4
animation.capture_keyframe()
viewer.camera.angles = (-7.0, 15.7, 62.4)
animation.capture_keyframe(steps=60)
viewer.camera.angles = (2.0, -24.4, -36.7)
animation.capture_keyframe(steps=60)
viewer.reset_view()
viewer.camera.angles = (0.0, 0.0, 90.0)
animation.capture_keyframe()
animation.animate('demo.mov', canvas_only=False)
```
## Examples
Examples can be found in our [Examples gallery](https://napari.org/napari-animation/gallery), generated from [our example scripts](https://github.com/napari/napari-animation/tree/main/examples). Simple examples for both interactive and headless
use of the plugin follow.
## Contributing
Contributions are very welcome and a detailed contributing guide is coming soon.
In the meantime, clone this repository and install it in editable mode using `pip`:
```
pip install -e .
```
We recommend using a virtual environment, for example `conda`.
```{important}
Ensure you have a suitable Qt backend for napari! We recommend `PyQt5`.
For more information, see the napari [Qt backend installation guide](https://napari.org/stable/tutorials/fundamentals/installation.html#choosing-a-different-qt-backend)
```
To set up your development installation, clone this repository, navigate to the clone folder, and install napari-animation in editable mode using `pip`.
```sh
conda create -n nap-anim python=3.10
conda activate nap-anim
pip install -e ".[dev]" PyQt5
```
Tests are run with `pytest`.
You can make sure your `[dev]` installation is working properly by running
`pytest .` from within the repository.
```{note}
We use [`pre-commit`](https://pre-commit.com) to sort imports and lint with
[`ruff`](https://github.com/astral-sh/ruff) and format code with
[`black`](https://github.com/psf/black) automatically prior to each commit.
To minmize test errors when submitting pull requests, please install `pre-commit`
in your environment as follows:
`pre-commit install`
```
## Documentation
The documentation is available at [https://napari.org/napari-animation](https://napari.org/napari-animation)
The documentation for napari-animation is built with [Sphinx](https://www.spinx-doc.org) and the [napari Sphinx Theme](https://github.com/napari/napari-sphinx-theme).
### Building docs locally
After installing the documentation dependencies with
```sh
pip install ".[doc]"
```
you can see a local version of the documentation by running
```sh
make docs
```
Open up the `docs/_build/index.html` file in your browser, and you'll see the home page of the docs being displayed.
### Deploying docs
The napari-animation documentation is automatically built and deployed to the website
whenever the main branch is updated, or a new release is tagged.
This is controlled by the [deploy_docs.yml](https://github.com/napari/napari-animation/blob/main/.github/workflows/deploy_docs.yml) github actions script.
You can also manually trigger a documenation re-build and deployment [from the github actions tab](https://github.com/napari/napari-animation/actions/workflows/deploy_docs.yml).
## License
Distributed under the terms of the [BSD-3 license](http://opensource.org/licenses/BSD-3-Clause),
`napari-animation` is free and open source software.
## Issues
If you encounter any problems, please [file an issue](https://github.com/napari/napari-animation/issues) along with a detailed description.
[Cookiecutter]: https://github.com/audreyr/cookiecutter
[@napari]: https://github.com/napari
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin
[file an issue]: https://github.com/sofroniewn/napari-animation/issues
[napari]: https://github.com/napari/napari
[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
[PyPI]: https://pypi.org/
Raw data
{
"_id": null,
"home_page": "https://github.com/napari/napari-animation",
"name": "napari-animation",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Nicholas Sofroniew, Alister Burt, Guillaume Witz, Faris Abouakil, Talley Lambert",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/81/5c/6a68fc184711f6b0fe0e9cb9a4946329bb8f41e0cb9a6ea589c35e27d0fc/napari_animation-0.0.8.tar.gz",
"platform": null,
"description": "# napari-animation\n\n[![License](https://img.shields.io/pypi/l/napari-animation.svg?color=green)](https://github.com/napari/napari-animation/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/napari-animation.svg?color=green)](https://pypi.org/project/napari-animation)\n[![Python Version](https://img.shields.io/pypi/pyversions/napari-animation.svg?color=green)](https://python.org)\n[![tests](https://github.com/napari/napari-animation/actions/workflows/test_and_deploy.yml/badge.svg)](https://github.com/napari/napari-animation/actions)\n[![codecov](https://codecov.io/gh/napari/napari-animation/branch/main/graph/badge.svg)](https://codecov.io/gh/napari/napari-animation)\n\n**napari-animation** is a plugin for making animations in [napari](https://napari.org).\n\n<p align=\"center\">\n <img width=\"500\" src=\"https://user-images.githubusercontent.com/7307488/196110138-6c4663b1-67b2-4c79-97b7-57b706d1d49c.gif\">\n</p>\n\n----------------------------------\n\n[Merlin Lange](https://twitter.com/Merlin_Lange) used *napari-animation* to create one of [Nature's best science images for September 2022](https://www.nature.com/immersive/d41586-022-03051-6/index.html)\n\n----------------------------------\n\nThis plugin is built on [`naparimovie`](https://github.com/guiwitz/naparimovie) from [@guiwitz](https://github.com/guiwitz). `naparimovie` was submitted to napari in [PR#851](https://github.com/napari/napari/pull/780) before napari plugin infrastructure existed.\n\n----------------------------------\n\n## Overview\n\n**napari-animation** provides a framework for the creation of animations in napari. The plugin contains:\n\n- an easy to use GUI for creating animations interactively;\n- a Python package for the programmatic creation of animations.\n\nThis plugin remains under development and contributions are very welcome, please open an issue to discuss potential improvements.\n\nYou can read the documentation at [https://napari.org/napari-animation](https://napari.org/napari-animation)\n\n## Installation\n\n### PyPI\n`napari-animation` is available through the Python package index and can be installed using `pip`.\n\n```sh\npip install napari-animation\n```\n\n```{warning}\n`napari-animation` uses `ffmpeg` to export animations. If you are using a macOS arm64 computer (Apple Silicon e.g. M1, M2 processor)\nthe PyPI package does not include the needed binary for your platform. You will need to install `ffmpeg` using\n`conda` from the [conda-forge channel](https://conda-forge.org/docs/#what-is-conda-forge) (`conda install -c conda-forge ffmpeg`)\nor using [`homebrew`](https://brew.sh) (`brew install ffmpeg`).\n```\n\n### Conda\n`napari-animation` is also available for install using `conda` through the [conda-forge channel](https://conda-forge.org/docs/#what-is-conda-forge).\n\n```sh\nconda install -c conda-forge napari-animation\n```\n\n### Local\nYou can clone this repository and install locally with\n\n pip install -e .\n\n### Interactive use\n**napari-animation** can be used interactively.\n\nAn animation is created by capturing [keyframes](https://en.wikipedia.org/wiki/Key_frame) containing the current viewer state.\n\n<p align=\"center\">\n <img width=\"600\" src=\"https://user-images.githubusercontent.com/7307488/196113682-96ce0da3-fa5c-411e-8fb1-52dc3a8f96b6.png\">\n</p>\n\nTo activate the GUI, select **napari-animation: wizard** from the *plugins menu*\n\n<p align=\"center\">\n <img width=\"200\" src=\"https://user-images.githubusercontent.com/7307488/196114466-56cb5985-0d79-4cfa-96f1-38cf3ccfbc48.png\">\n</p>\n\n### Scripting\n\n**napari-animation** can also be run programatically, allowing for reproducible, scripted creation of animations.\n\n```python\nfrom napari_animation import Animation\n\nanimation = Animation(viewer)\n\nviewer.dims.ndisplay = 3\nviewer.camera.angles = (0.0, 0.0, 90.0)\nanimation.capture_keyframe()\nviewer.camera.zoom = 2.4\nanimation.capture_keyframe()\nviewer.camera.angles = (-7.0, 15.7, 62.4)\nanimation.capture_keyframe(steps=60)\nviewer.camera.angles = (2.0, -24.4, -36.7)\nanimation.capture_keyframe(steps=60)\nviewer.reset_view()\nviewer.camera.angles = (0.0, 0.0, 90.0)\nanimation.capture_keyframe()\nanimation.animate('demo.mov', canvas_only=False)\n```\n\n## Examples\n\nExamples can be found in our [Examples gallery](https://napari.org/napari-animation/gallery), generated from [our example scripts](https://github.com/napari/napari-animation/tree/main/examples). Simple examples for both interactive and headless\nuse of the plugin follow.\n\n## Contributing\n\nContributions are very welcome and a detailed contributing guide is coming soon.\nIn the meantime, clone this repository and install it in editable mode using `pip`:\n\n```\npip install -e .\n```\nWe recommend using a virtual environment, for example `conda`.\n\n\n```{important}\nEnsure you have a suitable Qt backend for napari! We recommend `PyQt5`.\nFor more information, see the napari [Qt backend installation guide](https://napari.org/stable/tutorials/fundamentals/installation.html#choosing-a-different-qt-backend)\n```\n\nTo set up your development installation, clone this repository, navigate to the clone folder, and install napari-animation in editable mode using `pip`.\n\n```sh\nconda create -n nap-anim python=3.10\nconda activate nap-anim\npip install -e \".[dev]\" PyQt5\n\n```\n\nTests are run with `pytest`.\nYou can make sure your `[dev]` installation is working properly by running\n`pytest .` from within the repository.\n\n```{note}\nWe use [`pre-commit`](https://pre-commit.com) to sort imports and lint with\n[`ruff`](https://github.com/astral-sh/ruff) and format code with\n[`black`](https://github.com/psf/black) automatically prior to each commit.\nTo minmize test errors when submitting pull requests, please install `pre-commit`\nin your environment as follows:\n\n`pre-commit install`\n```\n\n## Documentation\n\nThe documentation is available at [https://napari.org/napari-animation](https://napari.org/napari-animation)\n\nThe documentation for napari-animation is built with [Sphinx](https://www.spinx-doc.org) and the [napari Sphinx Theme](https://github.com/napari/napari-sphinx-theme).\n\n### Building docs locally\n\nAfter installing the documentation dependencies with\n\n```sh\npip install \".[doc]\"\n```\n\nyou can see a local version of the documentation by running\n\n```sh\nmake docs\n```\n\nOpen up the `docs/_build/index.html` file in your browser, and you'll see the home page of the docs being displayed.\n\n### Deploying docs\n\nThe napari-animation documentation is automatically built and deployed to the website\nwhenever the main branch is updated, or a new release is tagged.\nThis is controlled by the [deploy_docs.yml](https://github.com/napari/napari-animation/blob/main/.github/workflows/deploy_docs.yml) github actions script.\n\nYou can also manually trigger a documenation re-build and deployment [from the github actions tab](https://github.com/napari/napari-animation/actions/workflows/deploy_docs.yml).\n\n## License\n\nDistributed under the terms of the [BSD-3 license](http://opensource.org/licenses/BSD-3-Clause),\n`napari-animation` is free and open source software.\n\n## Issues\n\nIf you encounter any problems, please [file an issue](https://github.com/napari/napari-animation/issues) along with a detailed description.\n\n[Cookiecutter]: https://github.com/audreyr/cookiecutter\n[@napari]: https://github.com/napari\n[BSD-3]: http://opensource.org/licenses/BSD-3-Clause\n[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin\n[file an issue]: https://github.com/sofroniewn/napari-animation/issues\n[napari]: https://github.com/napari/napari\n[tox]: https://tox.readthedocs.io/en/latest/\n[pip]: https://pypi.org/project/pip/\n[PyPI]: https://pypi.org/\n",
"bugtrack_url": null,
"license": "BSD 3-Clause",
"summary": "A plugin for making animations in napari",
"version": "0.0.8",
"project_urls": {
"Download": "https://github.com/napari/napari-animation",
"Homepage": "https://github.com/napari/napari-animation"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a95e2f337dc8329ed6d7bb5821553e33fa70a8642c2a0e5e36a6ab408f4ba72d",
"md5": "c935265a19f57dd597939ff66326dadc",
"sha256": "09afe0b7b637a3f5cbc6a1d6d0f7a0ad66a19a3e380a77d6bb3f5f2602d1c660"
},
"downloads": -1,
"filename": "napari_animation-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c935265a19f57dd597939ff66326dadc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 33836,
"upload_time": "2024-04-16T02:28:29",
"upload_time_iso_8601": "2024-04-16T02:28:29.024756Z",
"url": "https://files.pythonhosted.org/packages/a9/5e/2f337dc8329ed6d7bb5821553e33fa70a8642c2a0e5e36a6ab408f4ba72d/napari_animation-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "815c6a68fc184711f6b0fe0e9cb9a4946329bb8f41e0cb9a6ea589c35e27d0fc",
"md5": "dbbdefd5371319fa181b8ca8df1330b5",
"sha256": "82f0888cc56bb164d7d3d129b7fb6482dca268ff15f4fc0fb49a1996b3864bcc"
},
"downloads": -1,
"filename": "napari_animation-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "dbbdefd5371319fa181b8ca8df1330b5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 819219,
"upload_time": "2024-04-16T02:28:30",
"upload_time_iso_8601": "2024-04-16T02:28:30.747709Z",
"url": "https://files.pythonhosted.org/packages/81/5c/6a68fc184711f6b0fe0e9cb9a4946329bb8f41e0cb9a6ea589c35e27d0fc/napari_animation-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-16 02:28:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "napari",
"github_project": "napari-animation",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "napari-animation"
}