Skip to main content

vanilla-roll

Build Version Downloads Contributors Issues Codecov Apache License 2.0 License

vanilla-roll is volume renderer using array-api as backend.

Why vanilla-roll ?

VTK is one of the most excellent volume renderers in the world. It has good performance and many features. But I think that the installation process is not easy. So vanilla-roll is motivated to solve this problem.

Features

  • IO
    • MRA
    • NIFTI
    • DICOM
    • NRRD
  • Rendering Algorithm
    • Sampling
    • Shear-Warp
    • Raycast
  • Rendering Mode
    • MIP
    • MinP
    • Average
    • VolumeRendering
      • Ambient
      • Shading
  • Backend
    • numpy
    • pytorch
    • cupy
    • jax
    • numbda

Installation

$ pip install vanilla-roll

vanilla-roll supports following extras

  • torch
  • dicom
  • mha
  • nifti

Example

Code

import urllib.request
from pathlib import Path
from tempfile import TemporaryDirectory

import numpy as np
import skimage.io

import vanilla_roll as vr

# from A high-resolution 7-Tesla fMRI dataset from complex natural stimulation with an audio movie
# https://www.openfmri.org/dataset/ds000113/
MRA_FILE_URL = "https://s3.amazonaws.com/openneuro/ds000113/ds000113_unrevisioned/uncompressed/sub003/angio/angio001.nii.gz"  # noqa: E501


def fetch_mra_volume() -> vr.volume.Volume:
    with TemporaryDirectory() as tmpdir:
        mra_file = Path(tmpdir) / "mra.nii.gz"
        urllib.request.urlretrieve(MRA_FILE_URL, mra_file)
        return vr.io.read_nifti(mra_file)


def save_result(ret: vr.rendering.types.RenderingResult, path: str):
    img_array = vr.rendering.convert_image_to_array(ret.image)
    skimage.io.imsave(path, np.from_dlpack(img_array))  # type: ignore


def main():
    volume = fetch_mra_volume()
    ret = vr.render(volume, mode=vr.rendering.mode.MIP())
    save_result(ret, f"result.png")


if __name__ == "__main__":
    main()

Output

output

If you need more exmplaes, please check the examples.

For development

Install Poery plugins

$ poetry self add 'poethepoet[poetry_plugin]'

Install all extra packages

$ poetry poe install-all-extras

Run tests

$ poetry poe test

Run linter and formatter

$ poetry poe check

See Also

License

Apache-2.0

Metadata

Release files for vanilla-roll 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vanilla-roll 0.3.0
File Size Uploaded Provenance Actions
vanilla_roll-0.3.0.tar.gz 31.8 kB Without provenance Details for vanilla_roll-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vanilla-roll 0.3.0
File Interpreter ABI Platform Actions
vanilla_roll-0.3.0-py3-none-any.whl Python 3 none any Details for vanilla_roll-0.3.0-py3-none-any.whl

Total release size: 72.9 kB

Release files / vanilla_roll-0.3.0.tar.gz

Download URL vanilla_roll-0.3.0.tar.gz
Size 31.8 kB
Tags Source
SHA-256 checksum
How to use checksums
88d66f7c55eaba7d245b8bcadfdf1efcbf54a755735fab75e63abf9a16b09e8a
BLAKE2b-256 checksum
How to use checksums
07b868ffa199aedbe00e78d3b752b9643190275d276df2eb9c79f49d3950250f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1022-azure

Release files / vanilla_roll-0.3.0-py3-none-any.whl

Download URL vanilla_roll-0.3.0-py3-none-any.whl
Size 41.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c82bcb43ea98b7d791048794a65e517e14af4c20f90ded72ce042ac5dda026a
BLAKE2b-256 checksum
How to use checksums
ae3ac49532e026c47e03cde61fafb419ff2687ce8ccbbcace41ea207af8655ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1022-azure

Security for vanilla-roll 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page