Skip to content

Commit

Permalink
Merge pull request #30 from niaid/use_simpleitk_23
Browse files Browse the repository at this point in the history
Allow SimpleITK 2.3  in requirements.
  • Loading branch information
blowekamp authored Dec 20, 2023
2 parents ae220a7 + 2db0e40 commit 071a851
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
5 changes: 3 additions & 2 deletions rap_sitkcore/read_dcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def _read_dcm_pydicom(filename: Path) -> sitk.Image:
# use complement to invert the pixel intensity.
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

Expand All @@ -49,7 +48,9 @@ def _read_dcm_pydicom(filename: Path) -> sitk.Image:
if tag in ds:
de = ds.data_element(tag)
key = f"{de.tag.group:04x}|{de.tag.elem:04x}"
if de.VR == "DS":
if de.value is None:
img[key] = ""
elif de.VR == "DS":
if de.VM > 1:
img[key] = convert_float_list_to_mv_ds(de.value)
else:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SimpleITK >=2.1.0, <2.3
SimpleITK >=2.1.0, <2.4.0

numpy
pydicom
Expand Down
Git LFS file not shown
1 change: 0 additions & 1 deletion test/unit/test_dicom_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def test_convert1():


def test_keyword_to_gdcm_tag():

assert keyword_to_gdcm_tag("PatientName") == "0010|0010"
assert keyword_to_gdcm_tag("SeriesDescription") == "0008|103e"
assert keyword_to_gdcm_tag("Modality") == "0008|0060"
Expand Down
1 change: 0 additions & 1 deletion test/unit/test_is_dicom_xray.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,5 @@ def test_is_dicom_xray4(test_file, is_xray, data_paths):
("test_file", "is_xray"), [("1.3.6.1.4.1.25403.163683357445804.11044.20131119114627.12.dcm", True)]
)
def test_is_dicom_xray5(test_file, is_xray, remote_data_paths):

url = remote_data_paths[test_file]
assert rap_sitkcore.is_dicom_xray(url, strict=True) == is_xray
1 change: 0 additions & 1 deletion test/unit/test_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
],
)
def test_resize_and_scale_uint8_1(file_name, thumbnail_size, md5_hash, data_paths):

filename = data_paths[file_name]
img = read_dcm(Path(filename))

Expand Down

0 comments on commit 071a851

Please sign in to comment.