Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ Encoding of JPEG images is not currently supported
from pydicom import dcmread
from pydicom.data import get_testdata_file

import pylibjpeg

ds = dcmread(get_testdata_file('JPEG-LL.dcm'))
arr = ds.pixel_array
```

#### Standalone
#### Standalone JPEG decoding

You can also decode JPEG images to a [numpy ndarray][1]:

[1]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html

```python
from libjpeg import decode
Expand Down
6 changes: 6 additions & 0 deletions docs/release_notes/v1.0.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _v1.0.0:

1.0.0
=====

* Initial release
12 changes: 0 additions & 12 deletions libjpeg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
"""Set package shortcuts."""

import sys

from ._config import DICOM_ENCODERS, DICOM_DECODERS
from ._version import __version__
from .utils import decode, decode_pixel_data, get_parameters


# Add the testing data to libjpeg (if available)
try:
import data as _data
globals()['data'] = _data
# Add to cache - needed for pytest
sys.modules['libjpeg.data'] = _data
except ImportError:
pass
2 changes: 1 addition & 1 deletion libjpeg/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re


__version__ = '1.0.0.dev1'
__version__ = '1.0.0'


VERSION_PATTERN = r"""
Expand Down
11 changes: 11 additions & 0 deletions libjpeg/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@

import sys

try:
from . import pydicom_handler as handler
except ImportError:
pass

# Add the testing data to libjpeg (if available)
try:
import data as _data
globals()['data'] = _data
# Add to cache - needed for pytest
sys.modules['libjpeg.data'] = _data
except ImportError:
pass


def add_handler():
"""Add the pixel data handler to *pydicom*.
Expand Down
4 changes: 3 additions & 1 deletion libjpeg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def decode(arr, colour_transform=0, reshape=True):
| ``2`` : JPEG-LS pseudo RCT or RCT
| ``3`` : Freeform
reshape : bool, optional
Reshape and review the output array so it matches the image data
Reshape and re-view the output array so it matches the image data
(default), otherwise return a 1D array of ``np.uint8``.

Returns
Expand Down Expand Up @@ -116,6 +116,8 @@ def decode(arr, colour_transform=0, reshape=True):
def decode_pixel_data(arr, photometric_interp):
"""Return the decoded JPEG data from `arr` as a :class:`numpy.ndarray`.

Intended for use with *pydicom* ``Dataset`` objects.

Parameters
----------
arr : numpy.ndarray or bytes
Expand Down
16 changes: 6 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,28 +163,24 @@ def get_source_files():
license = "GPL V3.0",
keywords = (
"dicom pydicom python medicalimaging radiotherapy oncology imaging "
"jpg jpeg jpg-ls jpeg-ls libjpeg pylibjpeg"
"radiology nuclearmedicine jpg jpeg jpg-ls jpeg-ls libjpeg pylibjpeg"
),
project_urls = {
# Might give it it's own docs eventually
'Documentation' : 'https://pydicom.github.io/pydicom/'
},
classifiers = [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Intended Audience :: Developers",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"Development Status :: 3 - Alpha",
#"Development Status :: 3 - Alpha",
#"Development Status :: 4 - Beta",
#"Development Status :: 5 - Production/Stable",
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Programming Language :: C++",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Operating System :: MacOS :: MacOS X", # Tested OK
"Operating System :: POSIX :: Linux", # Tested OK
"Operating System :: Microsoft :: Windows", # Tested OK
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Software Development :: Libraries",
],
Expand Down