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-rs

I recommend uv as a python projection manager, where

uv add xim-reader-rs

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.2.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.2-cp38-abi3-win_amd64.whl (185.5 kB view details)

Uploaded CPython 3.8+Windows x86-64

xim_reader_rs-0.0.2-cp38-abi3-win32.whl (181.1 kB view details)

Uploaded CPython 3.8+Windows x86

xim_reader_rs-0.0.2-cp38-abi3-musllinux_1_2_x86_64.whl (481.2 kB view details)

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

xim_reader_rs-0.0.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-cp38-abi3-macosx_11_0_arm64.whl (275.6 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

xim_reader_rs-0.0.2-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.2.tar.gz.

File metadata

  • Download URL: xim_reader_rs-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8b92f82a6259817a5645a67bb6733c7f74fe5b74f210b950f8d938b80f11ec9a
MD5 4fbfee64d97c7dbee2c8c7ae0faae10e
BLAKE2b-256 622857f1a1559cf4dbb6b5d2ed9db48065aa65cc1af54c1b82ae8c3ff820f1b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 55982d57b9b0031a3ed0cfe8f8a6533f1758ea4e10de4148d84235916f3185da
MD5 3e671d65270a2f96bdda5544abbdaee9
BLAKE2b-256 1c6ff60b89a02d018779654fbfb53f6d6a30149e4414e63d13972d8f026fc934

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xim_reader_rs-0.0.2-cp38-abi3-win32.whl
  • Upload date:
  • Size: 181.1 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.2-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 bca39ca17e0ee7b650e20d3049f3259c9af70c546fe5f2662d7862f29dc336f5
MD5 d2e38cb1948a8ac0d45447e947ba8a62
BLAKE2b-256 8ec7a1980b28ab771876a40fad78de19fd370c71b455d763dd31e938e834831e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 df4d040570bc3ca199a5817ffe66ec5147d04189e34640d889c090079c367f91
MD5 7b94f75e6f0cc7f5b2a66db86cf8431c
BLAKE2b-256 54077568f36f04400f90fe11ca9965e5f5b91e70ddb08ae6ef710b7f4c675637

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 ee2ab6ccab893709253eef0112d70ffc088f4ac360f4e33f8472dbad884c929c
MD5 f8276bcfce5fe222245c422dd214e9a3
BLAKE2b-256 5c57d1297b9b1afad2348adfd389a0d852ccb3e1163cfafe9456c9e3af4cccc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 2cf3945deac51fc0e7a9c4bbe6e0c844c15c43b3603e23c7333eae68b33a5b5e
MD5 8533c17eaf059ce11e4ff6a393122e74
BLAKE2b-256 459c1718d0e6903381ddd377a4f271defcec5c0960413505a9968eda1a14a585

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 31b6a776233f58a271d173e4cda02e170b0a1348d2f932069d90d71b05cb3c8c
MD5 531c88ecee6b6f2687943142ab064f8f
BLAKE2b-256 f9888e7c0f111634bc4b6d89ac7c0a10278836d1b10ba4de6e03c5dca0d9bc31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1d9894e33f3b19777d30bfff4522a0971067733e00ef7b3ab98ea1219f95d2f
MD5 0706ad86706e46f71738e2d565cbc3e7
BLAKE2b-256 bdf957c8695ac522ec74c02d8f3fa981ff4812598bb3a515833cfd55e17f5aa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 431b324f63cae1fdccc8b68db28006500f20bc6bb3a8a7f4cc16afe0d57165ee
MD5 782be103532c904e1ed1975f521f1954
BLAKE2b-256 7cea3707d1fd5550d3887c2b50d8151331dec9b31cea0c886a45591ba87b35fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 1574976bf681051d1cf7ced42f67fe2cd0a7ba89089ada1c64f43956fe98f83d
MD5 fb4d3777dde1d0985fc1a6bcb8e7a3e7
BLAKE2b-256 09317dc17411592d95ea70d30a58e6611ea1a462f17c701312ef4bcf0c496ce8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 e27be9d9caf23092698514c8fd7198799c643606a153be131a0ea62247071b6c
MD5 c1a07f90eeed18b4f7f8eef0eb556a86
BLAKE2b-256 9b454b0efb22fc5411222e09ec40f71ac0a324149ab78073bf54864fcabae777

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0cbb8d7cded40bc150792a0435dd0896f5cf85bd07b4b1a6166ba757e9805d5
MD5 2eb2d0b4a0020a7ac169e4873cec629d
BLAKE2b-256 06c5ed5d1139cb64087224dc98733ef4ad5dd0ffba2697c28c461f6c65802d56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 324672a93000be28db6a63ad9db7b542452d28c57b77e59a59c688bd75f61e31
MD5 30f2898b3df8385e85a74f021508449f
BLAKE2b-256 06c8a29584919f975e3c20ae0a32ae2a84615aae0210423eca7301adbf9f281b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6aea370d77f40365a1ce54d9fbe64acf8c025e7ff3db055fd958ff0c67a59bdd
MD5 8037b2e7a14bc0deee00058a32c243a6
BLAKE2b-256 5687c327e9970b40390cc3333f4331a1310f567ab0fbada3b12b349fb58e2b14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xim_reader_rs-0.0.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e4aed12f3981f93ee15e8977a137eeb303d0f4d75aee20844b580dae32c1718b
MD5 f9baf59ea8364d004bf139b02939dcdf
BLAKE2b-256 faa0e8597ee7667d02aac335d029cdd758f9455463c92211f52ba9187cedc014

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