Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to pydicom 3.0 #51

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 5 additions & 1 deletion rap_sitkcore/read_dcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def _read_dcm_pydicom(filename: Path) -> sitk.Image:
img = sitk.GetImageFromArray(~arr, isVector=False)
elif ds.PhotometricInterpretation in ["YBR_FULL_422", "YBR_FULL", "RGB"]:
if ds.PhotometricInterpretation != "RGB":
from pydicom.pixel_data_handlers.util import convert_color_space
try:
# requires pydicom 3.0
from pydicom.pixels import convert_color_space
except ImportError:
from pydicom.pixel_data_handlers.util import convert_color_space

arr = convert_color_space(ds.pixel_array, ds.PhotometricInterpretation, "RGB")

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SimpleITK >=2.1.0, <2.5.0

numpy
pydicom
pydicom>=2.1.0
requests>=2.31.0

# additional packages for pydicom to expand supported files
Expand Down
Loading