Openjphpy
A Python wrapper for OpenJPH for encoding/decoding High-Throughput JPEG 2000 (HTJ2K)
Install / Use
/learn @BioIntelligence-Lab/OpenjphpyREADME
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:
- HTJ2K White Paper
- High throughput JPEG 2000 (HTJ2K): Algorithm, performance and potential
- High throughput block coding in the HTJ2K compression standard
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 be installed from pip or installed manually from source.
pip install openjphpy
Manual Installation
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.
Related Skills
claude-opus-4-5-migration
108.8kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
348.0kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
mcp-for-beginners
15.8kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
TrendRadar
50.9k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
