Skip to main content

Parse the XIM image format from Varian

Project description

xim_reader

This tool is a python extension library to read the XIM image format, written in Rust for improved speed. I haven't had a chance to test this with many images, yet, so this library is in an alpha state. This is basically just a parsing library at the moment, so it is better used as a reader to something like the XIM class in pylinac.

Installation

If just using pip,

pip install xim_reader

I recommend uv as a python projection manager, where

uv add xim_reader

will work.

Usage

from xim_reader import XIMImage
import numpy as np

path = "/path/to/image.xim"
xim = XIMImage(path)

#Items parsed from header
header = xim.header
print(header.identifier)
print(header.version)
print(header.width)
print(header.height)
print(header.bits_per_pixel)
print(header.bytes_per_pixel)

#A 2D numpy array read-only view with the shape (header.height, header.width) representing the image
pixels: np.ndarray[np.int8] | np.ndarray[np.int16] | np.ndarray[np.int32] | np.ndarray[np.int64] = xim.numpy

#A list where each index represents a bin of an XIM Histogram
histogram: list[int] = xim.histogram

#Properties contained in XIM image. No processing done on these aside from reading them into a dictionary.
properties: dict[str | int | float | list[float] | list[str]] = xim.properties

Building from source

Aside from needing uv, the rust compiler must be installed an availible on PATH. I have decided to use the 2024 rust edition, meaning at the moment, only the latest rustc version(1.85) is supported. Future versions should compile the package, though. After that, running

uv build

would build the package.

To install the Rust package into the environment with a debug build, run. Refer to the maturin documentation for more info.

maturin develop

Contributing

Feel free to contribute and improve this. Testing this with different data types and compression images would be helpful as well. I currently have only tested with a 32 bit compressed image.

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

xim_reader_rs-0.0.1.tar.gz (48.7 kB view details)

Uploaded Source

Built Distributions

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

xim_reader_rs-0.0.1-cp38-abi3-win_amd64.whl (185.5 kB view details)

Uploaded CPython 3.8+Windows x86-64

xim_reader_rs-0.0.1-cp38-abi3-win32.whl (181.0 kB view details)

Uploaded CPython 3.8+Windows x86

xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_x86_64.whl (481.1 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_i686.whl (507.4 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ i686

xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_armv7l.whl (584.7 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARMv7l

xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_aarch64.whl (482.3 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (311.0 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (405.0 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (337.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64le

xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (321.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (303.1 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (329.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.5+ i686

xim_reader_rs-0.0.1-cp38-abi3-macosx_11_0_arm64.whl (275.5 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

xim_reader_rs-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl (287.3 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: xim_reader_rs-0.0.1.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for xim_reader_rs-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6f133583c8d2460e69006ae8b44f1ccd41e3237e7aa45fbb694642cff84dc285
MD5 f577745fd5bb101b21023e18a00248f1
BLAKE2b-256 a5ba6a0c757ef850e78dab4c936ebb6756a19ebb1ddcfa7db232f16687beb10a

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fcec1beaa3f9d5273253b3ed9a10f64e1a840c3237d2bda32196f26e9ceb7217
MD5 c989a6c8d5aff61f7195bf547159f725
BLAKE2b-256 41c4febc30f5c366fddbde2a3b3cdd67cd47eac5b5578d72e26a86ebbf9f29c1

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-win32.whl.

File metadata

  • Download URL: xim_reader_rs-0.0.1-cp38-abi3-win32.whl
  • Upload date:
  • Size: 181.0 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 aebcdf6513a28c0f86b0d2155abc3a3bf43f838332f81aad18fc08e242029266
MD5 1c11acf26d29b56819cdf9a89e044a00
BLAKE2b-256 f6c53b7f0744cfb0c00ef0e592652738d993777b09d673cb25e25bf35724451e

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7a317757e5204d03683f2c0d255dc8b9c47b11ac5889efa533a48c5b6861f3d2
MD5 ad9a50fe5d58ec82b89b3918839b4611
BLAKE2b-256 aeb31c5eb04db400dc315c42c48737126f71bb3949583b50ed9d224253decb8f

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 9cc0bbd00b05ce56f5cd1997926e149a96d107d26296c4e7b150f47a58c678a1
MD5 652f63f0457f30f4489fa4f86331ff79
BLAKE2b-256 df22420527d7ee373d75916e2edf740ab3b5ef54f7574c95ab98f03b853e9a29

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 e9ba06c3084cdf89bf391ee8ac3cf395213c6ad89db5b3ba118cffd78095b813
MD5 3b3bd779dc91063e60682e52dc610496
BLAKE2b-256 31d373be6657f1b699bd146c4e339e40caa2700b8b1528eb29710a05491638f9

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8ac34e7cf083d2373e5725963bc020f120f9d5eaa6945e7ad149da5843a42ade
MD5 debdae9878505fc99002a0275beac4a8
BLAKE2b-256 6edc65973635a450635aa7787e05964c5aed7011e4bbf946a3affd34aaccc3ef

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af3ab9f43c4ab9b03402db47b94de3bcd23f2a4b3a9568afb602a4bad343c4b9
MD5 b33bdb153d380c28ea508b048b167f0d
BLAKE2b-256 ba3618e3612f888e491bc93570743b0bad058437c3d0545466b73486877a5156

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 9ae6b9049a2d49fdc98983c840ecd5e03f7532974ed9edcc61777683549c864f
MD5 cefd2b9ebbf4ceecb1929a4786a73723
BLAKE2b-256 95817e3365bca56557f71771035820386be2bff093f43699ed15804bbd79268f

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 20c6ae79525fc8d4f0a803643b3dd784cf0fa9af110616781fe140b22aeda373
MD5 7d481e9b21c65e0fd0e2e1806c709510
BLAKE2b-256 cbae814f71b4e8a616d26db03b5ccf6c391471cb21a53f2d2cd2cb8757af8da8

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 f38a4a22647c0a34c16e4334fdbd0f87c1c769bab6d1d4262d9fa6490c7627f1
MD5 a7a6d0a9cfded5c493a8bcf0a12b68ee
BLAKE2b-256 470646beab8f8656ab899e6e1b5087031678cae0424949eac738dfe35f520a54

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0d19e6f0775a11ef4aca9f27c3fc9b72b607261fac2229ab5a72670847a21ef
MD5 acdfad2f5c39a52f3b789c0a0bf14a9d
BLAKE2b-256 de5d8a6d7815074e6fc06a11950bcfb8fbd6999eb1fbad9574f78ee7830019c8

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 3a5122709628dea89bde80abfb64907f0528d3b5c0cb54858f565ab18a1feddc
MD5 8cb7ccebadfcf3ee931911e8e5fa3066
BLAKE2b-256 c4fa68f6c8af814aaa76bb99f84340a53a020cf143cce7af566eec1afd7eee10

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c057566d8287c7b334541086594aa05f0dff24e92caadf8ffc243b410754c449
MD5 edbf5ce93665457ec3816718204bfbf1
BLAKE2b-256 599be9b74989d0d69cd48438e8f8486c837a83556dc0614017b4eef17148c761

See more details on using hashes here.

File details

Details for the file xim_reader_rs-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xim_reader_rs-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 602064877628685c2fcb22c77661863faf616933c2e1e8995ecbb9267265ac9c
MD5 6eca01288c2a547841ccaa471afee16f
BLAKE2b-256 33db623134989c4f51a020b877ba56f157b2b36da8f9efc0720f2925f9908710

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