跳转到主要内容

napari制作动画的插件

项目描述

napari-animation

License PyPI Python Version tests codecov

napari-animation 是一个用于在 napari 中制作动画的插件。


Merlin Lange 使用 napari-animation 创建了 2022年9月《自然》最佳科学图像之一


此插件基于 naparimovie 开发,由 @guiwitz 提供。naparimovie 在 napari 插件基础设施存在之前被提交到 napari,提交号为 PR#851


概览

napari-animation 为在 napari 中创建动画提供了一个框架。该插件包含

  • 一个易于使用的GUI,用于交互式创建动画;
  • 一个Python包,用于程序化创建动画。

此插件仍在开发中,欢迎贡献,请提出问题以讨论潜在改进。

您可以在 https://napari.org/napari-animation 阅读文档

安装

PyPI

napari-animation 可通过Python包索引安装,使用 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://forge.conda.org.cn/docs/#what-is-conda-forge) (`conda install -c conda-forge ffmpeg`)
or using [`homebrew`](https://brew.sh.cn) (`brew install ffmpeg`).

Conda

napari-animation 还可通过 conda-forge通道 使用 conda 进行安装。

conda install -c conda-forge napari-animation

本地

您可以克隆此存储库,并使用以下命令本地安装:

pip install -e .

交互式使用

napari-animation 可以用于交互式。

通过捕获包含当前查看器状态的 关键帧 来创建动画。

要激活GUI,从 插件菜单 中选择 napari-animation: 向导

脚本化

napari-animation 还可以通过编程方式运行,允许以可重复的方式创建动画脚本。

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)

示例

示例可在我们的 示例画廊 中找到,由 示例脚本 生成。以下是对交互式和非交互式使用此插件的简单示例。

贡献

欢迎贡献,详细的贡献指南即将推出。在此期间,请克隆此存储库,并使用 pip 以可编辑模式安装。

pip install -e .

我们建议使用虚拟环境,例如 conda

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)

要设置开发安装,请克隆此存储库,导航到克隆文件夹,并使用 pip 以可编辑模式安装 napari-animation。

conda create -n nap-anim python=3.10
conda activate nap-anim
pip install -e ".[dev]" PyQt5

测试使用 pytest 运行。您可以通过在存储库内部运行 pytest . 来确保您的 [dev] 安装正常工作。

We use [`pre-commit`](https://pre-commit.git-scm.cn) 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`

文档

文档可在 https://napari.org/napari-animation 查阅

napari-animation 的文档使用 Sphinxnapari Sphinx Theme 构建。

本地构建文档

使用以下命令安装文档依赖项后

pip install ".[doc]"

您可以通过运行以下命令查看本地文档版本:

make docs

在浏览器中打开 docs/_build/index.html 文件,您将看到文档的主页。

部署文档

每当主分支更新或发布新版本时,napari-animation 文档会自动构建并部署到网站。这由 deploy_docs.yml GitHub Actions 脚本控制。

您还可以通过 GitHub Actions选项卡 手动触发文档重新构建和部署。

许可证

根据BSD-3许可协议分发,napari-animation是免费和开源软件。

问题

如果您遇到任何问题,请附上详细描述提交问题

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分发

napari_animation-0.0.8.tar.gz (819.2 kB 查看哈希值)

上传时间 源代码

构建分发

napari_animation-0.0.8-py3-none-any.whl (33.8 kB 查看哈希值)

上传时间 Python 3

由以下组织支持

AWSAWS 云计算和安全赞助商 DatadogDatadog 监控 FastlyFastly CDN GoogleGoogle 下载分析 MicrosoftMicrosoft PSF 赞助商 PingdomPingdom 监控 SentrySentry 错误记录 StatusPageStatusPage 状态页面