|
1 | | -[](https://codecov.io/gh/pydicom/pylibjpeg) |
2 | | -[](https://github.com/pydicom/pylibjpeg/actions?query=workflow%3Abuild) |
3 | | -[](https://badge.fury.io/py/pylibjpeg) |
4 | | -[](https://img.shields.io/pypi/pyversions/pylibjpeg.svg) |
| 1 | +<p align="center"> |
| 2 | +<a href="https://github.com/pydicom/pylibjpeg/actions?query=workflow%3Aunit-tests"><img alt="Build status" src="https://github.com/pydicom/pylibjpeg/workflows/unit-tests/badge.svg"></a> |
| 3 | +<a href="https://codecov.io/gh/pydicom/pylibjpeg"><img alt="Test coverage" src="https://codecov.io/gh/pydicom/pylibjpeg/branch/main/graph/badge.svg"></a> |
| 4 | +<a href="https://pypi.org/project/pylibjpeg/"><img alt="PyPI versions" src="https://img.shields.io/pypi/v/pylibjpeg"></a> |
| 5 | +<a href="https://www.python.org/"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/pylibjpeg.svg"></a> |
| 6 | +<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> |
| 7 | +</p> |
5 | 8 |
|
6 | 9 | ## pylibjpeg |
7 | 10 |
|
8 | | -A Python 3.10+ framework for decoding JPEG images and decoding/encoding RLE datasets, with a focus on providing support for [pydicom](https://github.com/pydicom/pydicom). |
| 11 | +A Python 3.8+ framework for decoding JPEG images and decoding/encoding RLE datasets, with a focus on providing support for [pydicom](https://github.com/pydicom/pydicom). |
9 | 12 |
|
10 | 13 |
|
11 | 14 | ### Installation |
@@ -42,26 +45,29 @@ python -m pip install pylibjpeg |
42 | 45 | One or more plugins are required before *pylibjpeg* is able to handle JPEG images or RLE datasets. To handle a given format or DICOM Transfer Syntax |
43 | 46 | you first have to install the corresponding package: |
44 | 47 |
|
45 | | -#### Supported Formats |
46 | | -|Format |Decode?|Encode?|Plugin |Based on | |
47 | | -|--- |------ |--- |--- |--- | |
48 | | -|JPEG, JPEG-LS and JPEG XT|Yes |No |[pylibjpeg-libjpeg][1] |[libjpeg][2] | |
49 | | -|JPEG 2000 |Yes |No |[pylibjpeg-openjpeg][3]|[openjpeg][4]| |
50 | | -|RLE Lossless (PackBits) |Yes |Yes |[pylibjpeg-rle][5] |- | |
51 | | - |
52 | | -#### DICOM Transfer Syntax |
53 | | - |
54 | | -|UID | Description | Plugin | |
55 | | -|--- |--- |---- | |
56 | | -|1.2.840.10008.1.2.4.50|JPEG Baseline (Process 1) |[pylibjpeg-libjpeg][1] | |
57 | | -|1.2.840.10008.1.2.4.51|JPEG Extended (Process 2 and 4) |[pylibjpeg-libjpeg][1] | |
58 | | -|1.2.840.10008.1.2.4.57|JPEG Lossless, Non-Hierarchical (Process 14) |[pylibjpeg-libjpeg][1] | |
59 | | -|1.2.840.10008.1.2.4.70|JPEG Lossless, Non-Hierarchical, First-Order Prediction</br>(Process 14, Selection Value 1) | [pylibjpeg-libjpeg][1]| |
60 | | -|1.2.840.10008.1.2.4.80|JPEG-LS Lossless |[pylibjpeg-libjpeg][1] | |
61 | | -|1.2.840.10008.1.2.4.81|JPEG-LS Lossy (Near-Lossless) Image Compression |[pylibjpeg-libjpeg][1] | |
62 | | -|1.2.840.10008.1.2.4.90|JPEG 2000 Image Compression (Lossless Only) |[pylibjpeg-openjpeg][4]| |
63 | | -|1.2.840.10008.1.2.4.91|JPEG 2000 Image Compression |[pylibjpeg-openjpeg][4]| |
64 | | -|1.2.840.10008.1.2.5 |RLE Lossless |[pylibjpeg-rle][5] | |
| 48 | +#### Supported Image Formats |
| 49 | +|Format |Decode?|Encode?|Plugin | License |Based on | |
| 50 | +|--- |------ |--- |--- |--- |--- | |
| 51 | +|JPEG, JPEG-LS and JPEG XT|Yes |No |[pylibjpeg-libjpeg][1] | GPLv3 |[libjpeg][2] | |
| 52 | +|JPEG 2000 |Yes |No |[pylibjpeg-openjpeg][3]| MIT |[openjpeg][4]| |
| 53 | +|RLE Lossless (PackBits) |Yes |Yes |[pylibjpeg-rle][5] | MIT |- | |
| 54 | + |
| 55 | +#### Supported DICOM Transfer Syntaxes |
| 56 | + |
| 57 | +|UID | Description | Plugin | |
| 58 | +|--- |--- |---- | |
| 59 | +|1.2.840.10008.1.2.4.50 |JPEG Baseline (Process 1) |[pylibjpeg-libjpeg][1] | |
| 60 | +|1.2.840.10008.1.2.4.51 |JPEG Extended (Process 2 and 4) |[pylibjpeg-libjpeg][1] | |
| 61 | +|1.2.840.10008.1.2.4.57 |JPEG Lossless, Non-Hierarchical (Process 14) |[pylibjpeg-libjpeg][1] | |
| 62 | +|1.2.840.10008.1.2.4.70 |JPEG Lossless, Non-Hierarchical, First-Order Prediction</br>(Process 14, Selection Value 1) | [pylibjpeg-libjpeg][1]| |
| 63 | +|1.2.840.10008.1.2.4.80 |JPEG-LS Lossless |[pylibjpeg-libjpeg][1] | |
| 64 | +|1.2.840.10008.1.2.4.81 |JPEG-LS Lossy (Near-Lossless) Image Compression |[pylibjpeg-libjpeg][1] | |
| 65 | +|1.2.840.10008.1.2.4.90 |JPEG 2000 Image Compression (Lossless Only) |[pylibjpeg-openjpeg][3]| |
| 66 | +|1.2.840.10008.1.2.4.91 |JPEG 2000 Image Compression |[pylibjpeg-openjpeg][3]| |
| 67 | +|1.2.840.10008.1.2.4.201|High-Throughput JPEG 2000 Image Compression (Lossless Only) |[pylibjpeg-openjpeg][3]| |
| 68 | +|1.2.840.10008.1.2.4.202|High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only) |[pylibjpeg-openjpeg][3]| |
| 69 | +|1.2.840.10008.1.2.4.203|High-Throughput JPEG 2000 Image Compression |[pylibjpeg-openjpeg][3]| |
| 70 | +|1.2.840.10008.1.2.5 |RLE Lossless |[pylibjpeg-rle][5] | |
65 | 71 |
|
66 | 72 | If you're not sure what the dataset's *Transfer Syntax UID* is, it can be |
67 | 73 | determined with: |
@@ -103,19 +109,6 @@ ds.decompress("pylibjpeg") |
103 | 109 | rle_arr = ds.pixel_array |
104 | 110 | ``` |
105 | 111 |
|
106 | | -For datasets with multiple frames you can reduce your memory usage by |
107 | | -processing each frame separately using the ``generate_frames()`` generator |
108 | | -function: |
109 | | -```python |
110 | | -from pydicom import dcmread |
111 | | -from pydicom.data import get_testdata_file |
112 | | -from pydicom.pixel_data_handlers.pylibjpeg_handler import generate_frames |
113 | | - |
114 | | -ds = dcmread(get_testdata_file('color3d_jpeg_baseline.dcm')) |
115 | | -frames = generate_frames(ds) |
116 | | -arr = next(frames) |
117 | | -``` |
118 | | - |
119 | 112 | ##### Standalone JPEG decoding |
120 | 113 | You can also just use *pylibjpeg* to decode JPEG images to a [numpy ndarray](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html), provided you have a suitable plugin installed: |
121 | 114 | ```python |
|
0 commit comments