Accepting request 1255425 from home:DocB:branches:devel:languages:python

- version 3.0.1
  * patch removed: pydicom-pr1908-fixpillow.patch
  * patch removed: pydicom-pr2076-np2.patch
  * some tests disabled
  * changes in 3.0.1:
    * Changed logging of missing plugin imports to use :attr:`logging.DEBUG` (:issue:`2128`).
    * Include all :mod:`~pydicom.examples` module datasets with the package (:issue:`2128`, :issue:`2131`)
    * Fixed an invalid VR value in the private data dictionary (:issue:`2132`).
    * Fixed checking for *Bits Stored* when converting *Float Pixel Data* and *Double Float
      Pixel Data* using the :mod:`~pydicom.pixels` backend (:issue:`2135`).
    * Fixed decoding of pixel data for images with *Bits Allocated* of 1 when frame boundaries are not aligned with byte boundaries (:issue:`2134`).
  * changes in 3.0: seer release_notes/v3.0.0.rst

OBS-URL: https://build.opensuse.org/request/show/1255425
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydicom?expand=0&rev=34
This commit is contained in:
2025-03-24 09:08:15 +00:00
committed by Git OBS Bridge
commit 688267a168
8 changed files with 478 additions and 0 deletions
+211
View File
@@ -0,0 +1,211 @@
-------------------------------------------------------------------
Sun Mar 23 17:15:52 UTC 2025 - Axel Braun <axel.braun@gmx.de>
- version 3.0.1
* patch removed: pydicom-pr1908-fixpillow.patch
* patch removed: pydicom-pr2076-np2.patch
* some tests disabled
* changes in 3.0.1:
* Changed logging of missing plugin imports to use :attr:`logging.DEBUG` (:issue:`2128`).
* Include all :mod:`~pydicom.examples` module datasets with the package (:issue:`2128`, :issue:`2131`)
* Fixed an invalid VR value in the private data dictionary (:issue:`2132`).
* Fixed checking for *Bits Stored* when converting *Float Pixel Data* and *Double Float
Pixel Data* using the :mod:`~pydicom.pixels` backend (:issue:`2135`).
* Fixed decoding of pixel data for images with *Bits Allocated* of 1 when frame boundaries are not aligned with byte boundaries (:issue:`2134`).
* changes in 3.0: seer release_notes/v3.0.0.rst
-------------------------------------------------------------------
Wed Sep 4 07:18:47 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Add pydicom-pr2076-np2.patch backport of gh#pydicom/pydicom#2076
-------------------------------------------------------------------
Mon Feb 19 10:16:16 UTC 2024 - Andreas Schwab <schwab@suse.de>
- Skip TestPillowHandler_JPEG2K also on riscv64
-------------------------------------------------------------------
Thu Jan 25 17:55:25 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Update to 2.4.4
## Changes
* Removed support for Python 3.6 (EOL since December 2021)
## Enhancements
* Added attribute alphabetic (#1634)
* Added attribute json_key (#1648)
* Added value validation for numerical VRs, add type validation
for all validated VRs (#1414)
* CLI commands now accept pydicom charset test files and CLI help
shows Python Version (#1674)
* Added support for Python 3.11 (#1658)
* Added ISfloat to allow non-strict reading of existing files
with float IS values (#1661)
* Improved speed of creating and accessing highly nested
structures (#1728, #1734)
* Switched to a pyproject.toml build process (#1792)
* Updated DICOM and UID dicts to DICOM 2023b (#1803)
## Fixes
* Fixed length validation of DS values with maximum length
without a leading zero (#1632)
* Increased download speed with progress bar for test data
(#1611)
* Fixed crash due to invalid private creator (#1638)
* Fixed extremely long BytesLengthException error messages
(#1683)
* In codify, ensure unique variable names for DICOM keywords
repeated in sequences, and handle unicode characters correctly
(#1670)
* Fixed handling of some invalid values in to_json_dict() if
suppress_invalid_tags is set to True (#1693)
* Fixed reading of data with 8 bits allocated, encoded in Big
Endian transfer syntax using VR OW (#1680)
* Fixed crash if reading regular dataset that has the SOP Class
of a DICOMDIR (#1702)
* Fixed wrong waveform data calculation when as_raw=False and
baseline!=0 (#1667)
* Fixed reading LUTData to expected size (#1747)
* Fixed handling of AT VRs when codifying data elements (#1738)
## Pydicom Internals
* In test suites, renamed setup and teardown methods,
deprecated starting in pytest 7.2
* Use own fork of CharPyLS to handle builds with Python 3.11
(#1788)
- Go back do %{?sle15_python_module_pythons}. python- prefixed
packages for Python 3.6 should be handled by separate maintenance
request to python3-pydicom on SLE side
- Add pydicom-pr1908-fixpillow.patch
* gh#pydicom/pydicom#1908 fixes gh#pydicom/pydicom#1907
-------------------------------------------------------------------
Tue Jan 16 09:57:21 UTC 2024 - Axel Braun <axel.braun@gmx.de>
- switch to wheel and enable %{?sle15allpythons}
-------------------------------------------------------------------
Sat Dec 3 20:04:13 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to version 2.3.1:
* Small fix to make 2.3.X compatible with Python 3.11.
-------------------------------------------------------------------
Mon Oct 10 07:20:51 UTC 2022 - John Vandenberg <jayvdb@gmail.com>
- Add BD pydicom-data test data, and unskip many tests that now pass
-------------------------------------------------------------------
Sat Sep 24 02:04:40 UTC 2022 - John Vandenberg <jayvdb@gmail.com>
- Skip a lot of tests, mostly due to missing test data, but there
are over 1900 still passing.
- Update to v2.3.0
* See https://github.com/pydicom/pydicom/tree/master/doc/release_notes
-------------------------------------------------------------------
Fri Dec 10 07:41:02 UTC 2021 - pgajdos@suse.com
- do not require pytest-runner for build
-------------------------------------------------------------------
Tue Mar 10 09:14:48 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.4.2:
* no upstream changelog
-------------------------------------------------------------------
Tue Jul 23 09:10:15 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.3.0:
* no upstream changelog
-------------------------------------------------------------------
Fri Mar 8 06:49:41 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Reinstate test unit test_code_file which appears to be stable now
- Use PyPI sdist as source
-------------------------------------------------------------------
Wed Jan 2 12:07:30 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.2.2:
* more python 3.7 fixes
-------------------------------------------------------------------
Thu Nov 1 14:01:20 UTC 2018 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.2.0:
* No obvious upstream changelog
- Drop python37.patch should be fixed upstream
-------------------------------------------------------------------
Thu Aug 30 08:34:34 UTC 2018 - Tomáš Chvátal <tchvatal@suse.com>
- Disable test_code_file as it randomly fails in OBS
-------------------------------------------------------------------
Wed Aug 29 12:04:20 UTC 2018 - tchvatal@suse.com
- Update to 1.1.0:
* License is distributed
* Various speed improvements
- Add patch to work with python 3.7:
* python37.patch
-------------------------------------------------------------------
Mon Sep 11 15:14:49 UTC 2017 - jengelh@inai.de
- Make package description neutral and compact it.
-------------------------------------------------------------------
Mon Sep 11 14:47:43 UTC 2017 - toddrme2178@gmail.com
- Implement single-spec version
-------------------------------------------------------------------
Thu Oct 13 19:45:31 UTC 2016 - toddrme2178@gmail.com
- Update to version 0.9.9
+ Major changes / enhancements
* All dicom dictionaries updated (standard dictionary, UID
dictionary, and private dictionaries)
* Dicom commands also added to dictionary
* Ability to work with DICOMDIR: read_dicomdir() function and
DicomDir class. Example file show_dicomdir.py file added to
examples subdirectory.
* codify.py: Produce python/pydicom source code from a dicom
file.
* a number of python 3 compatibility enhancements
* setup.py uses ez_setup only if setuptools not already
installed
* exceptions carry tag info with them, to aid in debugging
+ Contrib file changes
* pydicom_series: force parameter added (Nil Goyette)
* dcm_qt_tree: switch to OrderedDict to preserve ordering of
tags (Padraig Looney)
- Rename package to python-dicom to python-pydicom to conform to python
package naming policies.
- spec file completely rewritten.
- Remove unneeded python-dicom-remove-obsolete-distribute-support.patch
-------------------------------------------------------------------
Tue Dec 17 17:34:04 UTC 2013 - p.drouand@gmail.com
- Update to version 0.9.8
+ No changelog available
- Add python-dicom-remove-obsolete-distribute-support.patch; setup
script try to import setuptools from distribute
-------------------------------------------------------------------
Thu Oct 24 11:01:12 UTC 2013 - speilicke@suse.com
- Require python-setuptools instead of distribute (upstreams merged)
-------------------------------------------------------------------
Fri Aug 17 21:15:59 UTC 2012 - scorot@free.fr
- fix build for SLE 11 x86_64
-------------------------------------------------------------------
Tue Aug 7 13:23:47 UTC 2012 - toddrme2178@gmail.com
- Initial version
+113
View File
@@ -0,0 +1,113 @@
#
# spec file for package python-pydicom
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-pydicom
Version: 3.0.1
Release: 0
Summary: Pure python package for DICOM medical file reading and writing
License: MIT
URL: https://github.com/darcymason/pydicom
Source: https://github.com/pydicom/pydicom/archive/refs/tags/v%{version}.tar.gz#/pydicom-%{version}-gh.tar.gz
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module flit-core >= 3.2}
BuildRequires: %{python_module pip}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module pydicom-data}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
%if 0%{?suse_version} > 1550
# GDCM is not multiflavor in Tumbleweed
BuildRequires: python3-gdcm
%endif
# /SECTION
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun): update-alternatives
%python_subpackages
%description
pydicom is a pure python package for parsing DICOM files
into natural pythonic structures for further manipulation.
Modified datasets can be written again to DICOM format files.
DICOM is a standard (http://medical.nema.org) for communicating
medical images and related information such as reports
and radiotherapy objects.
%prep
%autosetup -p1 -n pydicom-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/pydicom
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
export LANG=en_US.UTF-8
%{python_expand # see https://github.com/pydicom/pydicom/issues/1697
mkdir build/locallib
cp -r %{$python_sitelib}/data_store %{$python_sitelib}/pydicom_data*.dist-info build/locallib/
}
export PYTHONPATH=$PWD/build/locallib
# these assume that a cache is updatable from online downloads
skips="test_fetch_data_files"
skips="$skips or test_get_testdata_file_external_hash_mismatch"
skips="$skips or test_get_testdata_files_local_external_and_cache"
skips="$skips or test_get_testdata_files_hash_match"
skips="$skips or test_get_testdata_files_hash_mismatch"
skips="$skips or test_get_testdata_files_external_ignore_hash"
skips="$skips or test_decoder_base"
skips="$skips or test_decoder_native"
skips="$skips or test_utils"
skips="$skips or test_dataset"
if [ "$RPM_ARCH" = "ppc64le" -o "$RPM_ARCH" = "aarch64" -o "$RPM_ARCH" = "riscv64" ]; then
skips="$skips or TestPillowHandler_JPEG2K"
fi
if [ $(getconf LONG_BIT) -eq 32 ]; then
# Failures on i586
skips="$skips or test_write_file_id or test_file_id or test_encapsulate_bot_large_raises or (TestPillowHandler_JPEG2K and test_array)"
fi
%pytest -rsfR $ignores -k "not ($skips)"
%post
%python_install_alternative pydicom
%postun
%python_uninstall_alternative pydicom
%files %{python_files}
%doc README.md
%license LICENSE
%python_alternative %{_bindir}/pydicom
%{python_sitelib}/pydicom
%{python_sitelib}/pydicom-%{version}.dist-info
%changelog
+23
View File
@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
+1
View File
@@ -0,0 +1 @@
.osc
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:42c06ed74331174111dd42c89db774a13fc472abe18015f22c5aba80cddb7843
size 2203904
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:848ae8e36f34750cf837e48ca5cdf6f7a472145724946d5f28f529279fe11f4e
size 2899710
+23
View File
@@ -0,0 +1,23 @@
From 11f7bd260137a18496bdfd00ddb742ef0cf2d2fd Mon Sep 17 00:00:00 2001
From: scaramallion <scaramallion@users.noreply.github.com>
Date: Mon, 16 Oct 2023 10:35:46 +1100
Subject: [PATCH 1/4] Fix Pillow raising AttributeError due to Image.mode being
read-only
Index: pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py
===================================================================
--- pydicom-2.4.4.orig/pydicom/pixel_data_handlers/pillow_handler.py
+++ pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py
@@ -129,7 +129,11 @@ def _decompress_single_frame(
image.tile[0][2],
(color_mode, ''),
)]
- image.mode = color_mode
+ # Pillow 10.1+ made Image.mode read-only
+ if hasattr(image, "_mode"):
+ image._mode = color_mode
+ else:
+ image.mode = color_mode
image.rawmode = color_mode
return image
+101
View File
@@ -0,0 +1,101 @@
Index: pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py
===================================================================
--- pydicom-2.4.4.orig/pydicom/pixel_data_handlers/pillow_handler.py
+++ pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py
@@ -255,14 +255,14 @@ def get_pixeldata(ds: "Dataset") -> "num
if ds.PixelRepresentation == 1:
# Pillow converts signed data to unsigned
# so we need to undo this conversion
- arr -= 2**(bits_allocated - 1)
+ arr -= numpy.uint32(2**(bits_allocated - 1))
if shift:
arr = numpy.right_shift(arr, shift)
else:
# Corrections based on dataset elements
if ds.PixelRepresentation == 1:
- arr -= 2**(bits_allocated - 1)
+ arr -= numpy.uint32(2**(bits_allocated - 1))
if shift:
arr = numpy.right_shift(arr, shift)
Index: pydicom-2.4.4/pydicom/pixel_data_handlers/pylibjpeg_handler.py
===================================================================
--- pydicom-2.4.4.orig/pydicom/pixel_data_handlers/pylibjpeg_handler.py
+++ pydicom-2.4.4/pydicom/pixel_data_handlers/pylibjpeg_handler.py
@@ -66,11 +66,7 @@ except ImportError:
HAVE_PYLIBJPEG = False
if HAVE_PYLIBJPEG:
- try:
- from pylibjpeg.utils import get_pixel_data_decoders
- except ImportError:
- # Old import, deprecated in 1.2, removal in 2.0
- from pylibjpeg.pydicom.utils import get_pixel_data_decoders
+ from pylibjpeg.utils import get_pixel_data_decoders, Decoder
try:
import openjpeg
@@ -249,7 +245,7 @@ def generate_frames(
"elements are missing from the dataset: " + ", ".join(missing)
)
- decoder = _DECODERS[tsyntax]
+ decoder = cast(Decoder, _DECODERS[tsyntax])
LOGGER.debug(f"Decoding {tsyntax.name} encoded Pixel Data using {decoder}")
nr_frames = getattr(ds, "NumberOfFrames", 1)
@@ -260,7 +256,7 @@ def generate_frames(
bits_allocated = cast(int, ds.BitsAllocated)
for frame in generate_pixel_data_frame(ds.PixelData, nr_frames):
- arr = decoder(frame, pixel_module)
+ arr = decoder(frame, ds=pixel_module)
if (
tsyntax in [JPEG2000, JPEG2000Lossless]
Index: pydicom-2.4.4/pydicom/tests/test_encoders_pydicom.py
===================================================================
--- pydicom-2.4.4.orig/pydicom/tests/test_encoders_pydicom.py
+++ pydicom-2.4.4/pydicom/tests/test_encoders_pydicom.py
@@ -444,7 +444,7 @@ class TestRLEEncodeFrame:
assert ds.SamplesPerPixel == 3
assert ds.PixelRepresentation == 0
- arr = ref.newbyteorder('>')
+ arr = ref.view(ref.dtype.newbyteorder('>'))
assert id(arr) != id(ref)
assert arr.dtype == '>u2'
encoded = rle_encode_frame(arr)
Index: pydicom-2.4.4/pydicom/pixel_data_handlers/util.py
===================================================================
--- pydicom-2.4.4.orig/pydicom/pixel_data_handlers/util.py
+++ pydicom-2.4.4/pydicom/pixel_data_handlers/util.py
@@ -200,7 +200,7 @@ def apply_color_lut(
# IVs >= `first_map` are mapped by the Palette Color LUTs
# `first_map` may be negative, positive or 0
mapped_pixels = arr >= first_map
- clipped_iv[mapped_pixels] = arr[mapped_pixels] - first_map
+ clipped_iv[mapped_pixels] = arr[mapped_pixels] - np.int32(first_map)
# IVs > number of entries get set to last entry
np.clip(clipped_iv, 0, nr_entries - 1, out=clipped_iv)
@@ -276,7 +276,7 @@ def apply_modality_lut(arr: "np.ndarray"
# IVs >= `first_map` are mapped by the Modality LUT
# `first_map` may be negative, positive or 0
mapped_pixels = arr >= first_map
- clipped_iv[mapped_pixels] = arr[mapped_pixels] - first_map
+ clipped_iv[mapped_pixels] = arr[mapped_pixels] - np.int32(first_map)
# IVs > number of entries get set to last entry
np.clip(clipped_iv, 0, nr_entries - 1, out=clipped_iv)
@@ -458,7 +458,7 @@ def apply_voi(
# IVs >= `first_map` are mapped by the VOI LUT
# `first_map` may be negative, positive or 0
mapped_pixels = arr >= first_map
- clipped_iv[mapped_pixels] = arr[mapped_pixels] - first_map
+ clipped_iv[mapped_pixels] = arr[mapped_pixels] - np.int32(first_map)
# IVs > number of entries get set to last entry
np.clip(clipped_iv, 0, nr_entries - 1, out=clipped_iv)