Skip to main content

A plugin for making animations in napari

Project description

napari-animation (WIP under active development)

License PyPI Python Version tests codecov

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


This napari plugin was generated with Cookiecutter using with @napari's cookiecutter-napari-plugin template.

It is built off of great work from @guiwitz in naparimovie which was initially submitted to napari in PR#851.


Overview

napari-animation provides a framework for the creation of animations in napari and features:

  • an easy to use GUI for interactive creation of animations
  • Python tools for programmatic creation of animations

This plugin is currently pre-release and under active development. APIs are likely to change before it's first 0.0.1 release, but feedback and contributions are welcome.

Installation

You can clone this repository with install locally with

pip install -e .

Examples

Examples can be found in our examples folder. Simple examples for both interactive and headless use of the plugin follow.

Interactive

napari-animation can be used interactively by creating an AnimationWidget from a napari Viewer and adding it to the viewer as a dock widget.

from napari_animation import AnimationWidget

animation_widget = AnimationWidget(viewer)
viewer.window.add_dock_widget(animation_widget, area='right')

AnimationWidget image

Headless

napari-animation can also be run headless, 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)

Is everything animate-able?

Unfortunately, not yet! Currently differences in the following objects are tracked by the Animation class

  • Viewer.camera
  • Viewer.dims
  • Layer.scale
  • Layer.translate
  • Layer.rotate
  • Layer.shear
  • layer.opacity
  • Layer.blending
  • Layer.visible

Support for more layer attributes will be added in future releases.

Contributing

Contributions are very welcome and a detailed contributing guide is coming soon.

Tests are run with pytest.

We use pre-commit to sort imports with isort, format code with black, and lint with flake8 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

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.3.tar.gz (619.8 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.3-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file napari_animation-0.0.3.tar.gz.

File metadata

  • Download URL: napari_animation-0.0.3.tar.gz
  • Upload date:
  • Size: 619.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for napari_animation-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e02cbb9fa018f2c5cae42025c8e14c7027179bcc0fed50ff8eeaace838a5a95b
MD5 2197eeae5f1dbdcd3a38ecb720307fe6
BLAKE2b-256 c21d5c0dfcb9f6930862d1804188a0473e2a0670c1098da2d344b3d3cd94e3f8

See more details on using hashes here.

File details

Details for the file napari_animation-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_animation-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 be49e50c98574754c9a299f2af211aefaea3ac98db26032523c1617cacdf65c8
MD5 4bf3635a48b80e3e9a201a0c5d9dd450
BLAKE2b-256 5f8f942ea4ff041220bd1c6d8794e43930a359be9299f6ecac39e8ac2816e1c4

See more details on using hashes here.

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