diff --git a/README.md b/README.md index 1f5add3..b83d8bb 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/release_notes/v1.0.0.rst b/docs/release_notes/v1.0.0.rst new file mode 100644 index 0000000..1e6dd77 --- /dev/null +++ b/docs/release_notes/v1.0.0.rst @@ -0,0 +1,6 @@ +.. _v1.0.0: + +1.0.0 +===== + +* Initial release diff --git a/libjpeg/__init__.py b/libjpeg/__init__.py index dae9db8..2c49b29 100644 --- a/libjpeg/__init__.py +++ b/libjpeg/__init__.py @@ -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 diff --git a/libjpeg/_version.py b/libjpeg/_version.py index f28eead..266adfa 100644 --- a/libjpeg/_version.py +++ b/libjpeg/_version.py @@ -3,7 +3,7 @@ import re -__version__ = '1.0.0.dev1' +__version__ = '1.0.0' VERSION_PATTERN = r""" diff --git a/libjpeg/tests/__init__.py b/libjpeg/tests/__init__.py index e07af70..93ea214 100644 --- a/libjpeg/tests/__init__.py +++ b/libjpeg/tests/__init__.py @@ -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*. diff --git a/libjpeg/utils.py b/libjpeg/utils.py index 2129cfa..9968262 100644 --- a/libjpeg/utils.py +++ b/libjpeg/utils.py @@ -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 @@ -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 diff --git a/setup.py b/setup.py index b761885..3db2390 100644 --- a/setup.py +++ b/setup.py @@ -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", ],