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.1.tar.gz (35.2 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.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vlsi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 772056a06a0ff939e0c679e9d9c7326f8283eb3e2eb35340428c87db6809ad9f
MD5 7c4960dca5ba952af4a9384db5c44e74
BLAKE2b-256 fd56e8ada14c0e26b221a79bf01bf8efc7c21b3a215ff86b85de9a21702c9d6b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vlsi-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b9e6d0e746977c0f5641aedab4ec7d42b554c45680974f981d88dc35841c1293
MD5 ccc5c2b8f3dddc37f0a9f4c99beba7ea
BLAKE2b-256 b9e200da4f5e890fcfb9cb0fe84626f33ca8f6731a55ebc5949459c1050d1a1d

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