Skip to main content

A plugin for making animations in napari

Project description

napari-animation

License PyPI Python Version tests codecov

napari-animation is a plugin for making animations in napari.


Merlin Lange used napari-animation to create one of Nature's best science images for September 2022


This plugin is built on naparimovie from @guiwitz. naparimovie was submitted to napari in PR#851 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

Installation

PyPI

napari-animation is available through the Python package index and can be installed using pip.

pip install napari-animation
`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.

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 containing the current viewer state.

To activate the GUI, select napari-animation: wizard from the plugins menu

Scripting

napari-animation can also be run programatically, allowing for reproducible, scripted creation of animations.

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, generated from our example scripts. 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 . --group dev

We recommend using a virtual environment.

Ensure you have a suitable Qt backend for napari! We recommend `PyQt6`.
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.

conda create -n nap-anim python=3.13
conda activate nap-anim
pip install -e . --group dev pyqt6

Tests are run with pytest. You can make sure your [dev] installation is working properly by running pytest . from within the repository.

We use [`pre-commit`](https://pre-commit.com) to sort imports and lint with
[`ruff`](https://github.com/astral-sh/ruff) 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

The documentation for napari-animation is built with Sphinx and the napari Sphinx Theme.

Building docs locally

After installing the documentation dependencies with

pip install -e . --group doc

you can see a local version of the documentation by running

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 github actions script.

You can also manually trigger a documenation re-build and deployment from the github actions tab.

License

Distributed under the terms of the BSD-3 license, napari-animation is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari_animation-0.0.10rc0.tar.gz (820.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_animation-0.0.10rc0-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file napari_animation-0.0.10rc0.tar.gz.

File metadata

  • Download URL: napari_animation-0.0.10rc0.tar.gz
  • Upload date:
  • Size: 820.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for napari_animation-0.0.10rc0.tar.gz
Algorithm Hash digest
SHA256 fd3a760c93f98de3ec482ae9b144178a5f2be46bf5b1d9227fa4723c042ec1dd
MD5 7820a294bae0c52ea7494a370195f4de
BLAKE2b-256 a3e09d7815a148ff3f0be3d488a56208b84cbedd9c1fc5fd8279ff74e400557b

See more details on using hashes here.

Provenance

The following attestation bundles were made for napari_animation-0.0.10rc0.tar.gz:

Publisher: test_and_deploy.yml on napari/napari-animation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file napari_animation-0.0.10rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_animation-0.0.10rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e64d9f65e989216684955a65988f84b590f1648ac7526d6256618ee71fe3a3b
MD5 c52519b1246605d1123d6c7aacf60560
BLAKE2b-256 c41f1659374ade96c82e9cb952f6af938517e67bc161db4a591da9aa6e7e7cf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for napari_animation-0.0.10rc0-py3-none-any.whl:

Publisher: test_and_deploy.yml on napari/napari-animation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page