Skip to main content

PyNVJPEG2K

PyNVJPEG2K is a work in progress Python library to accelerate decompression and compression of JPEG2000 encoded images. Python bindings have not yet been implemented, but there is support for accelerated decoding using a standaclone C++ program. Only decompression of single channel inputs has been implemented.

Usage

Encoding

Only 16 bit grayscale inputs are supported. Only lossless encoding is supported. Number of frames must be divisible by the batch size.

Encoding a 8x512x512 3D volume w/ batch size 8

import pynvjpeg as pynv

num_frames, rows, cols = 8, 512, 512 
batch_size = 4
data = np.random.randint(0, 1024, (num_frames, rows, cols), dtype=np.uint16)
encoded = pynv.encode_jpeg2k(x, batch_size)
assert len(encoded) == num_frames
assert all(isinstance(f, bytes) for f in encoded)

Decoding

Only 16 bit grayscale images are supported. Number of frames must be divisible by the batch size. The decoding process assumes that the output image dimensions (rows, columns, number of frames) are known ahead of time. For DICOMs, this information will be present in the metadata.

Single frame decoding

import pynvjpeg as pynv
decoded = pynv.decode_jpeg2k(frame, len(frame), rows, cols)

Multi-frame batched decoding

import pynvjpeg as pynv

# number of decoded frames must be divisible by batch size.
# it is assumed that the number of frames is known ahead of time
batch_size = 4
decoded = pynv.decode_frames_jpeg2k(data, len(data), rows, columns, 4)

Troubleshooting

If you have problems building, try the following:

  • Make sure you have PythonX.YZ-dev installed
  • Verify that CUDA is installed properly

TODO

  • Can we relax the constraint that image dimensions are known ahead of time without much performance hit?
  • Can we relax the constraint that batch size be a divsior of the number of frames?
  • Can we accelerate JPEG Lossless transfer syntaxes?

Metadata

Release files for pynvjpeg2k 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pynvjpeg2k 1.0.0
File Size Uploaded Provenance Actions
pynvjpeg2k-1.0.0.tar.gz 108.2 kB Without provenance Details for pynvjpeg2k-1.0.0.tar.gz

Release files / pynvjpeg2k-1.0.0.tar.gz

Download URL pynvjpeg2k-1.0.0.tar.gz
Size 108.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c2b8d8f757c3118b137a3861a25810bb3824fb01b3853016d82ae29a280b38ca
BLAKE2b-256 checksum
How to use checksums
0243ff81bf5c112777b1fbb3ef3d412abcc5f93fbe609c9c9f5daadc08be382d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.12

Security for pynvjpeg2k 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page