{"id":18366239,"url":"https://github.com/pydicom/pylibjpeg-openjpeg","last_synced_at":"2025-04-09T15:08:43.077Z","repository":{"id":44638275,"uuid":"245553777","full_name":"pydicom/pylibjpeg-openjpeg","owner":"pydicom","description":"A J2K and JP2 plugin for pylibjpeg","archived":false,"fork":false,"pushed_at":"2024-12-01T21:36:01.000Z","size":413,"stargazers_count":21,"open_issues_count":4,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-09T15:08:34.865Z","etag":null,"topics":["decoding","dicom","j2k","jp2","jpeg2000","openjpeg","pydicom","pylibjpeg","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pydicom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-07T02:22:37.000Z","updated_at":"2025-03-24T21:30:35.000Z","dependencies_parsed_at":"2024-01-13T07:35:25.619Z","dependency_job_id":"7b7c2e2a-160f-41b8-97bb-0d8afe200177","html_url":"https://github.com/pydicom/pylibjpeg-openjpeg","commit_stats":{"total_commits":48,"total_committers":3,"mean_commits":16.0,"dds":0.125,"last_synced_commit":"bfb3362bd8f4454d2999287434d8b8cd61769986"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpylibjpeg-openjpeg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpylibjpeg-openjpeg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpylibjpeg-openjpeg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpylibjpeg-openjpeg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pydicom","download_url":"https://codeload.github.com/pydicom/pylibjpeg-openjpeg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055282,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decoding","dicom","j2k","jp2","jpeg2000","openjpeg","pydicom","pylibjpeg","python"],"created_at":"2024-11-05T23:16:49.539Z","updated_at":"2025-04-09T15:08:43.048Z","avatar_url":"https://github.com/pydicom.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/pydicom/pylibjpeg-openjpeg/actions?query=workflow%3Aunit-tests\"\u003e\u003cimg alt=\"Build status\" src=\"https://github.com/pydicom/pylibjpeg-openjpeg/workflows/unit-tests/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/pydicom/pylibjpeg-openjpeg\"\u003e\u003cimg alt=\"Test coverage\" src=\"https://codecov.io/gh/pydicom/pylibjpeg-openjpeg/branch/main/graph/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/pylibjpeg-openjpeg/\"\u003e\u003cimg alt=\"PyPI versions\" src=\"https://img.shields.io/pypi/v/pylibjpeg-openjpeg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.python.org/\"\u003e\u003cimg alt=\"Python versions\" src=\"https://img.shields.io/pypi/pyversions/pylibjpeg-openjpeg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n## pylibjpeg-openjpeg\n\nA Python 3.8+ wrapper for\n[openjpeg](https://github.com/uclouvain/openjpeg), with a focus on use as a plugin for [pylibjpeg](http://github.com/pydicom/pylibjpeg).\n\nLinux, OSX and Windows are all supported.\n\n### Installation\n#### Dependencies\n[NumPy](http://numpy.org)\n\n#### Installing the current release\n```bash\npython -m pip install -U pylibjpeg-openjpeg\n```\n\n#### Installing the development version\n\nMake sure [Python](https://www.python.org/), [Git](https://git-scm.com/) and [CMake](https://cmake.org/) are installed. For Windows, you also need to install\n[Microsoft's C++ Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools\u0026rel=16).\n```bash\ngit clone --recurse-submodules https://github.com/pydicom/pylibjpeg-openjpeg\npython -m pip install pylibjpeg-openjpeg\n```\n\n\n### Supported JPEG Formats\n#### Decoding\n\n| ISO/IEC Standard | ITU Equivalent | JPEG Format |\n| --- | --- | --- |\n| [15444-1](https://www.iso.org/standard/78321.html) | [T.800](https://www.itu.int/rec/T-REC-T.800/en) | [JPEG 2000](https://jpeg.org/jpeg2000/) |\n\n#### Encoding\n\nEncoding of NumPy ndarrays is supported for the following:\n\n* Array dtype: bool, uint8, int8, uint16, int16, uint32 and int32 (1-24 bit-depth only)\n* Array shape: (rows, columns) and (rows, columns, planes)\n* Number of rows/columns: up to 65535\n* Number of planes: 1, 3 or 4\n\n### Transfer Syntaxes\n| UID | Description |\n| --- | --- |\n| 1.2.840.10008.1.2.4.90 | JPEG 2000 Image Compression (Lossless Only) |\n| 1.2.840.10008.1.2.4.91 | JPEG 2000 Image Compression |\n| 1.2.840.10008.1.2.4.201 | High-Throughput JPEG 2000 Image Compression (Lossless Only) |\n| 1.2.840.10008.1.2.4.202 | High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only) |\n| 1.2.840.10008.1.2.4.203 | High-Throughput JPEG 2000 Image Compression |\n\n\n### Usage\n#### With pylibjpeg and pydicom\n\n```python\nfrom pydicom import dcmread\nfrom pydicom.data import get_testdata_file\n\nds = dcmread(get_testdata_file('JPEG2000.dcm'))\narr = ds.pixel_array\n```\n\n#### Standalone JPEG decoding\n\nYou can also decode JPEG 2000 images to a [numpy ndarray][1]:\n\n[1]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html\n\n```python\nfrom openjpeg import decode\n\nwith open('filename.j2k', 'rb') as f:\n    # Returns a numpy array\n    arr = decode(f)\n\n# Or simply...\narr = decode('filename.j2k')\n```\n\n#### Standalone JPEG encoding\n\nLossless encoding of RGB with multiple-component transformation:\n\n```python\n\nimport numpy as np\nfrom openjpeg import encode_array\n\narr = np.random.randint(low=0, high=65536, size=(100, 100, 3), dtype=\"uint8\")\nencode_array(arr, photometric_interpretation=1)  # 1: sRGB\n```\n\nLossy encoding of a monochrome image using compression ratios:\n\n```python\n\nimport numpy as np\nfrom openjpeg import encode_array\n\narr = np.random.randint(low=-2**15, high=2**15, size=(100, 100), dtype=\"int8\")\n# You must determine your own values for `compression_ratios`\n#   as these are for illustration purposes only\nencode_array(arr, compression_ratios=[5, 2])\n```\n\nLossy encoding of a monochrome image using peak signal-to-noise ratios:\n\n```python\n\nimport numpy as np\nfrom openjpeg import encode_array\n\narr = np.random.randint(low=-2**15, high=2**15, size=(100, 100), dtype=\"int8\")\n# You must determine your own values for `signal_noise_ratios`\n#   as these are for illustration purposes only\nencode_array(arr, signal_noise_ratios=[50, 80, 100])\n```\n\nSee the docstring for the [encode_array() function][2] for full details.\n\n[2]: https://github.com/pydicom/pylibjpeg-openjpeg/blob/main/openjpeg/utils.py#L429\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydicom%2Fpylibjpeg-openjpeg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpydicom%2Fpylibjpeg-openjpeg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydicom%2Fpylibjpeg-openjpeg/lists"}