Skip to main content

variable length spatial index - encode arbitary length bytes in nifti + data sidecar file

Project description

vlsi

Variable-Length-Spatial-Index (or velvet-silk) is an implementation of variable length datatype for 3-dimensional array. It is designed with write-once-read-many paradigm, and is thus optimized for fast and memory efficient read operations.

Background

see background.md

Specification

see specifications.md

Usages

A trivial example is included below. For more realistic usages, please refer to e2e tests.

import numpy as np
from vlsi import WritableSpatialIndex, ReadableSpatialIndex, SpatialIndexWriteExc

def main():

    windex = WritableSpatialIndex("testfile")
    windex.write(
        [
            [0, 0, 0],
            [42, 42, 42],
        ],
        [b"origin of life", b"meaning of life"],
    )
    windex.write([[0, 0, 0]], [b"another write"])
    windex.save(np.eye(4), shape=(100, 200, 100))

    try:
        windex.write([[0, 0, 0]], [b"should fail"])
    except SpatialIndexWriteExc:
        ...

    try:
        windex.save(np.eye(4), shape=(100, 200, 100))
    except SpatialIndexWriteExc:
        ...

        
    rindex = ReadableSpatialIndex("testfile")
    assert rindex.read([[0, 0, 0]]) == [b"origin of lifeanother write"]
    assert rindex.read([[42, 42, 42]]) == [b"meaning of life"]
    assert rindex.read([[1, 1, 1]]) == []

if __name__ == "__main__":
    main()

Similar projects

sparseindex in siibra-python (original inspiration of this project)

v2 sparsedex in siibra-python (first implementation of vlsi)

vlen codec in numcodecs

numpy.save

LICENSE

apache 2.0

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

vlsi-0.0.6.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

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

vlsi-0.0.6-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file vlsi-0.0.6.tar.gz.

File metadata

  • Download URL: vlsi-0.0.6.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for vlsi-0.0.6.tar.gz
Algorithm Hash digest
SHA256 bc0055af5a496e506fcc859d2fcf691ab5a63eeaf8a3c7f4f83769d736ff082a
MD5 0f1749760a8c8db9420dfe6b29ce4e78
BLAKE2b-256 d429d217d6680c35b284f92b34acd78c663ec4891a5c8a133dad1520e2a8df9f

See more details on using hashes here.

File details

Details for the file vlsi-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: vlsi-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for vlsi-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4bde6be5babeeaf5f6eddc6ed49bea91258139908affe52410483e430276d1b9
MD5 06dd8158fe057144a193438afeb5a7a4
BLAKE2b-256 5fb2f82da68aae0d354a7c598cb4bfedc04767506e1c47194a60f97b44b930b4

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