Skip to main content

Python library for Neurovolume. Build VDBs for scientific visualizations

Reason this release was yanked:

Redundant release, git issues

Project description

Render of a non-skull stripped MNI Template

Neurovolume is a Python library for manipulating and visualizing volumetric data. It includes a custom-built, scientific data-focused, VDB writer. The VDB writer is written in Zig with no external dependencies. Currently some NIfTI1 files can be parsed natively.

While this project focuses on neuroscience, it includes ndarray to VDB to support virtually any volumetric data pipeline.

This project is very much a work in progress. (see "Missing Features" below). As of now, I do not recommend regarding the images created by this software as scientifically accurate.

🐍 ndArray Example

The following following is an example of how you might use this project in a neuroscience pipeline. (While it requires external dependencies, this implementation actually runs faster than the native NIfTI1 parsing implementation)

import nibabel as nib
import neurovolume_lib as nv
import numpy as np
from datetime import datetime

static_testfile = "./media/sub-01_T1w.nii"

def normalize_array(arr):
    return (arr - np.min(arr)) / (np.max(arr) - np.min(arr))

img = nib.load(static_testfile)
data = np.array(img.get_fdata(), order='C', dtype=np.float64)
norm = normalize_array(data).astype(np.float64)

norm = np.transpose(norm, (1, 2, 0))
norm = np.ascontiguousarray(norm)

output = "./output/from_nib.vdb"
nv.ndarray_to_VDB(norm, output, img.affine)

Note that all data must be normalized from 0.0-1.0 before being written to a VDB.

☁️ Why VDB?

VDBs are a highly performant, art-directable, volumetric data structure that supports animations. Our volume-based approach aims to provide easy access to the original density data throughout the visualization and analysis pipeline. Unlike the openVDB repo, our smaller version is much more readable and does not need to be run in a docker container.

🛠️ Missing Features

While a comprehensive road-map will be published soon, there are a few important considerations to take into account now.

  • Presently the VDB writer isn't sparse nor does it support multiple grids. Tiles and multiple grids are in development.
  • Neurovolume currently only natively supports NIfTI1 files (and only some variants). Full coverage and NIfTI2 will be supported soon. Until then, you can use an ndarray as an intermediary (see Python Usage).
  • Frame interpolation (present in the original Go prototype) is currently under development on this branch. If you wish to access the old Go code, check out the archive
  • Documentation has not been written yet.

🧠 Dataset Citation

This software was tested using the following datasets.

Isaac David and Victor Olalde-Mathieu and Ana Y. Martínez and Lluviana Rodríguez-Vidal and Fernando A. Barrios (2021). Emotion Category and Face Perception Task Optimized for Multivariate Pattern Analysis. OpenNeuro. [Dataset] doi: 10.18112/openneuro.ds003548.v1.0.1

OpenNeuro Study Link

Direct Download Link for T1 Anat test file

Direct Download Link for BOLD test file

The MNI Template can be found Here

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

neurovolume-0.1.0a4.tar.gz (485.9 kB view details)

Uploaded Source

Built Distribution

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

neurovolume-0.1.0a4-py3-none-any.whl (485.6 kB view details)

Uploaded Python 3

File details

Details for the file neurovolume-0.1.0a4.tar.gz.

File metadata

  • Download URL: neurovolume-0.1.0a4.tar.gz
  • Upload date:
  • Size: 485.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for neurovolume-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 1a3b780f2ec57dd900c3bf6e9aac5b00845f837baaaa471fbf8072de67a48ed7
MD5 108c5b58f22854b1cbf63839f9190794
BLAKE2b-256 60545582491c44c38f1636f84ac7524828ab6cb5490a4e983b3c4716e02893fc

See more details on using hashes here.

File details

Details for the file neurovolume-0.1.0a4-py3-none-any.whl.

File metadata

  • Download URL: neurovolume-0.1.0a4-py3-none-any.whl
  • Upload date:
  • Size: 485.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for neurovolume-0.1.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 829d9dfa03a394494e5f5994ad28ad5aec2b7d67ba9f326806b6f5176e35b58d
MD5 82006031ffb9d8ca7775d5b0bcc8cc18
BLAKE2b-256 f3fb831fd9698c9d8145f4b856f8ff6ba03ea24abd01f2dad8c138e9e3dadb10

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