Skip to content

Commit

Permalink
Use CharPyLS fork pyjpegls with newer cython version
Browse files Browse the repository at this point in the history
- should fix Python 3.11 builds
- change Python version for PR tests to 3.11
- fix syntax in conf.py (taken from #1793)
- fixes #1788
  • Loading branch information
mrbean-bremen committed Apr 28, 2023
1 parent 0f8870d commit c854f9e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/merge-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ jobs:
python -m pip uninstall -y pillow
- name: Install and test jpeg_ls
if: ${{ matrix.python-version != '3.11' && matrix.python-version != '3.12-dev' }}
run: |
python -m pip install --upgrade cython
python -m pip install git+https://github.com/Who8MyLunch/CharPyLS
python -m pip install git+https://github.com/pydicom/pyjpegls
pytest ${{ matrix.pytest-args }} pydicom/tests/test_jpeg_ls_pixel_data.py pydicom/tests/test_JPEG_LS_transfer_syntax.py
python -m pip uninstall -y CharPyLS
python -m pip uninstall -y pyjpegls
- name: Install and test GDCM
run: |
Expand All @@ -92,7 +92,6 @@ jobs:
python -m pip uninstall -y python-gdcm
- name: Install and test pylibjpeg
if: ${{ matrix.python-version != '3.12-dev' }}
run: |
python -m pip install pylibjpeg
python -m pip uninstall -y pylibjpeg-openjpeg pylibjpeg-rle
Expand All @@ -101,10 +100,9 @@ jobs:
pytest ${{ matrix.pytest-args }} pydicom/tests/test_pylibjpeg.py
- name: Test all pixel handling
if: ${{ matrix.python-version != '3.11' && matrix.python-version != '3.12-dev' }}
run: |
python -m pip install pillow python-gdcm
python -m pip install git+https://github.com/Who8MyLunch/CharPyLS
python -m pip install git+https://github.com/pydicom/pyjpegls
pytest ${{ matrix.pytest-args }}
- name: Send coverage results
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10']
python-version: ['3.11']
include:
- os: 'ubuntu-latest'
send-coverage: true
Expand Down Expand Up @@ -155,9 +155,9 @@ jobs:
- name: Install and test jpeg_ls
run: |
python -m pip install --upgrade cython
python -m pip install git+https://github.com/Who8MyLunch/CharPyLS
python -m pip install git+https://github.com/pydicom/pyjpegls
pytest ${{ matrix.pytest-args }} pydicom/tests/test_JPEG_LS_transfer_syntax.py pydicom/tests/test_jpeg_ls_pixel_data.py
python -m pip uninstall -y CharPyLS
python -m pip uninstall -y pyjpegls
- name: Install and test GDCM
run: |
Expand All @@ -178,7 +178,7 @@ jobs:
- name: Test all pixel handling
run: |
python -m pip install --upgrade pillow python-gdcm
python -m pip install git+https://github.com/Who8MyLunch/CharPyLS
python -m pip install git+https://github.com/pydicom/pyjpegls
pytest ${{ matrix.pytest-args }}
- name: Send coverage results
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
'https://github.com/pydicom/%s',
None
),
"issue": ("https://github.com/pydicom/pydicom/issues/%s", "#"),
"pr": ("https://github.com/pydicom/pydicom/pull/%s", "#"),
"issue": ("https://github.com/pydicom/pydicom/issues/%s", "#%s"),
"pr": ("https://github.com/pydicom/pydicom/pull/%s", "#%s"),
}

# intersphinx configuration
Expand Down
7 changes: 3 additions & 4 deletions doc/old/image_data_handlers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following packages can be used with *pydicom*:
most compressed formats
* `Pillow <http://pillow.readthedocs.io/en/latest/>`_, ideally with
``jpeg`` and ``jpeg2000`` plugins
* `jpeg_ls <https://github.com/Who8MyLunch/CharPyLS>`_
* `jpeg_ls <https://github.com/pydicom/pyjpegls>`_
* :gh:`pylibjpeg <pylibjpeg>`, with the ``-libjpeg``, ``-openjpeg`` and
``-rle`` plugins

Expand Down Expand Up @@ -51,8 +51,8 @@ handled by the given packages:

+-------------------------------------------------------------+-------+-------------+----------+-----------------+-----------------+
| Transfer Syntax | NumPy | | NumPy + | | NumPy +| | NumPy + | | NumPy + |
+------------------------------------+------------------------+ | | JPEG-LS\ | | GDCM | | Pillow | | pylibjpeg |
| Name | UID | | :sup:`7` | | | |
+------------------------------------+------------------------+ | | JPEG-LS | | GDCM | | Pillow | | pylibjpeg |
| Name | UID | | | | | |
+====================================+========================+=======+=============+==========+=================+=================+
| Explicit VR Little Endian | 1.2.840.10008.1.2.1 | |chk| | |chk| | |chk| | |chk| | |chk| |
+------------------------------------+------------------------+-------+-------------+----------+-----------------+-----------------+
Expand Down Expand Up @@ -92,7 +92,6 @@ handled by the given packages:
| :sup:`4` *with the pylibjpeg-rle plugin and using the* :meth:`~pydicom.dataset.Dataset.decompress` *method, 4-5x faster than default*
| :sup:`5` *with the pylibjpeg-libjpeg plugin*
| :sup:`6` *with the pylibjpeg-openjpeg plugin*
| :sup:`7` *only up to Python 3.10*
Usage
.....
Expand Down
2 changes: 1 addition & 1 deletion doc/release_notes/v2.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ Pydicom Internals
-----------------
* In test suites, renamed 'setup' and 'teardown' methods, deprecated starting
in pytest 7.2
* Do not try to use `CharPyLS` with Python > 3.10 (:issue:`1788`)
* Use own fork of `CharPyLS` to handle builds with Python 3.11 (:issue:`1788`)
11 changes: 6 additions & 5 deletions doc/tutorials/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,23 @@ Through conda::
conda install pillow


Installing CharPyLS
Installing pyjpegls
-------------------

`CharPyLS <https://github.com/Who8MyLunch/CharPyLS>`_ is a Python interface to
`pyjpegls <https://github.com/pydicom/pyjpegls>`_ is a Python interface to
the `CharLS <https://github.com/team-charls/charls>`_ C++ library and can
decompress JPEG-LS images.
decompress JPEG-LS images. It is a fork of `CharPyLS <https://github.com/Who8MyLunch/CharPyLS>`_
created to provide compatibility with the latest Python versions.

Using pip::

pip install cython
pip install git+https://github.com/Who8MyLunch/CharPyLS
pip install git+https://github.com/pydicom/pyjpegls

Through conda::

conda install cython
pip install git+https://github.com/Who8MyLunch/CharPyLS
pip install git+https://github.com/pydicom/pyjpegls


.. _tut_install_gdcm:
Expand Down
4 changes: 2 additions & 2 deletions pydicom/pixel_data_handlers/jpeg_ls_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""
Use the `jpeg_ls (CharPyLS) <https://github.com/Who8MyLunch/CharPyLS>`_ Python
Use the `jpeg_ls (pyjpegls) <https://github.com/pydicom/pyjpegls>`_ Python
package to decode *Pixel Data*.
"""
from typing import TYPE_CHECKING, cast
Expand Down Expand Up @@ -29,7 +29,7 @@

DEPENDENCIES = {
'numpy': ('http://www.numpy.org/', 'NumPy'),
'jpeg_ls': ('https://github.com/Who8MyLunch/CharPyLS', 'CharPyLS'),
'jpeg_ls': ('https://github.com/pydicom/pyjpegls', 'pyjpegls'),
}

SUPPORTED_TRANSFER_SYNTAXES = [
Expand Down

0 comments on commit c854f9e

Please sign in to comment.