Skip to content

Commit d4c803d

Browse files
authored
Update README to include RLE support (#61)
1 parent bc205ea commit d4c803d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
## pylibjpeg
77

8-
A Python 3.6+ framework for decoding JPEG images, with a focus on providing JPEG support for [pydicom](https://github.com/pydicom/pydicom).
8+
A Python 3.6+ framework for decoding JPEG images and RLE datasets, with a focus on providing support for [pydicom](https://github.com/pydicom/pydicom).
99

1010

1111
### Installation
@@ -25,14 +25,15 @@ python -m pip install pylibjpeg
2525

2626
### Plugins
2727

28-
One or more plugins are required before *pylibjpeg* is able to decode JPEG images. To decode a given JPEG format or DICOM Transfer Syntax
28+
One or more plugins are required before *pylibjpeg* is able to decode JPEG images or RLE datasets. To decode a given format or DICOM Transfer Syntax
2929
you first have to install the corresponding package:
3030

31-
#### JPEG Format
31+
#### Supported Formats
3232
| Format | Decode? | Encode? | Plugin | Based on |
3333
|---|------|---|---|---|
3434
| JPEG, JPEG-LS and JPEG XT | Yes | No | [pylibjpeg-libjpeg][1] | [libjpeg][2] |
3535
| JPEG 2000 | Yes | No | [pylibjpeg-openjpeg][3] | [openjpeg][4] |
36+
| RLE (PackBits) | Yes | No | [pylibjpeg-rle][5] | - |
3637

3738
#### DICOM Transfer Syntax
3839

@@ -46,7 +47,7 @@ you first have to install the corresponding package:
4647
| 1.2.840.10008.1.2.4.81 | JPEG-LS Lossy (Near-Lossless) Image Compression | [pylibjpeg-libjpeg][1]|
4748
| 1.2.840.10008.1.2.4.90 | JPEG 2000 Image Compression (Lossless Only) | [pylibjpeg-openjpeg][4] |
4849
| 1.2.840.10008.1.2.4.91 | JPEG 2000 Image Compression | [pylibjpeg-openjpeg][4] |
49-
| 1.2.840.10008.1.2.5 | RLE Lossless | Not yet supported |
50+
| 1.2.840.10008.1.2.5 | RLE Lossless | [pylibjpeg-rle][5] |
5051

5152
If you're not sure what the dataset's *Transfer Syntax UID* is, it can be
5253
determined with:
@@ -60,6 +61,7 @@ determined with:
6061
[2]: https://github.com/thorfdbg/libjpeg
6162
[3]: https://github.com/pydicom/pylibjpeg-openjpeg
6263
[4]: https://github.com/uclouvain/openjpeg
64+
[5]: https://github.com/pydicom/pylibjpeg-rle
6365

6466

6567
### Usage
@@ -77,6 +79,13 @@ jpg_arr = ds.pixel_array
7779
# With the pylibjpeg-openjpeg plugin
7880
ds = dcmread(get_testdata_file('JPEG2000.dcm'))
7981
j2k_arr = ds.pixel_array
82+
83+
# With the pylibjpeg-rle plugin and pydicom v2.2+
84+
ds = dcmread(get_testdata_file('OBXXXX1A_rle.dcm'))
85+
# pydicom defaults to the numpy handler for RLE so need
86+
# to explicitly specify the use of pylibjpeg
87+
ds.decompress("pylibjpeg")
88+
rle_arr = ds.pixel_array
8089
```
8190

8291
For datasets with multiple frames you can reduce your memory usage by

0 commit comments

Comments
 (0)