Skip to main content

openjphpy

Note: This repository is currently work in progress. Please contact us for more details here.

What is openjphpy?

A Python wrapper for OpenJPH to enable encoding and/or decoding High-Throughput JPEG 2000 (HTJ2K) images.

In short, OpenJPH is an open-source implementation of the HTJ2K codec (JPEG2000 Part 15, ISO/IEC 15444-15, and ITU-T T.814), supporting features defined in JPEG 2000 Part 1. The code is written in C++ with color and wavelet transform steps taking advantage of SIMD instructions on Intel platforms. Unfortunately, this restricts encoding and/or decoding on image data directly from other commonly used programming languages. For example, another project openjphjs, developed by Chris Hafey, brings OpenJPH's capabilities to Javascript. Similarly, we aim to bring these capabilities to Python with direct support for HTJ2K encoding/decoding using openjphpy.

We use openjphpy in our implementation of the Medical Image Streaming Toolkit (MIST), an open-source toolkit to operationalize and democratize progressive resolution for large-scale medical imaging data infrastructures to accelerate data transmission and AI modelling. You can read our paper on MIST here.

Resources

For more resources regarding HTJ2K, please refer to:

Citation

If you use openjphpy in your publication, please cite the following:

  • GitHub
@software{openjphpy,
author = {Kulkarni, Pranav},
title = {{openjphpy}},
month = {July},
year = {2023},
url = {https://github.com/UM2ii/openjphpy}
}
  • Publication
@article{kulkarni2023one,
  title={One Copy Is All You Need: Resource-Efficient Streaming of Medical Imaging Data at Scale},
  author={Kulkarni, Pranav and Kanhere, Adway and Siegel, Eliot and Yi, Paul H and Parekh, Vishwa S},
  journal={arXiv preprint arXiv:2307.00438},
  year={2023}
}

Getting Started

Currently, openjphpy can only be installed manually from source.

git clone --recurse-submodules https://github.com/UM2ii/openjphpy
pip install -e openjphpy/

Documentation for openjphpy is available here.

Note: openjphpy is only supported on Linux based environments with support for other environments coming in the future.

Example Notebook

We have provided an example notebook in this repository, along with 10 test images, to experiment with. You can find the example notebook here.

We also provide 15 sample medical images across X-ray, MRI, and CT modalities (5 images per modality), with data sourced from the NIH Chest X-Ray 14 and Medical Segmentation Decathlon (MSD) datasets. For portability, all data is stored as npy files.

Note: CT data is stored as uint16 and not in Hounsfield units.

Limitations

Currently, openjphpy does not support encoding signed data and can only encode imaging data with types 8-bit and 16-bit unsigned integers (uint8 and uint16). If pixel values fall outside the range [0, 65,535], an error may be raised (strict mode) or values will be clipped (non-strict mode). Precision is automatically chosen based on image data's dynamic range.

Future Work

In the future, we intend to extend support to non-Linux environments. Similarly, we intend to employ a similar approach used by openjphjs to integrate native C++ code directly into Python. While our current implementation supports the entire feature set of OpenJPH, it is not computationally optimized. We invite collaborators in the open-source community to help integrate with OpenJPH's native C++ code with direct encode/decode capabilities in Python.

Contact

If you have any questions about openjphpy, please contact us here.

Metadata

Release files for openjphpy 0.1.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 openjphpy 0.1.0
File Size Uploaded
openjphpy-0.1.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openjphpy 0.1.0
File Interpreter ABI Platform
openjphpy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / openjphpy-0.1.0.tar.gz

Download URL openjphpy-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f2815a2b3fc9b8ff8395e9bd3887a8412499668e643c34624f1f0073a6613248
BLAKE2b-256 checksum
How to use checksums
20e8125f1b86fb54aa31f653898ec23449faab744da3ce1c01f696bfeec298a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / openjphpy-0.1.0-py3-none-any.whl

Download URL openjphpy-0.1.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2be2367ef4a69552a1941ac000239481cb068568a2ae9e8c2f5b7f87a00209f5
BLAKE2b-256 checksum
How to use checksums
55000571183b52beab9f3509c1cfc46be2fd2d39c1eb2c4085a26d49df634793
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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