diff --git a/rap_sitkcore/read_dcm.py b/rap_sitkcore/read_dcm.py index 8aa1532..860e526 100644 --- a/rap_sitkcore/read_dcm.py +++ b/rap_sitkcore/read_dcm.py @@ -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 @@ -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: diff --git a/requirements.txt b/requirements.txt index 0ae4ac7..52da1f4 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -SimpleITK >=2.1.0, <2.3 +SimpleITK >=2.1.0, <2.4.0 numpy pydicom diff --git a/test/data/1.3.6.1.4.1.25403.163683357445804.11044.20131119114627.12.dcm b/test/data/1.3.6.1.4.1.25403.163683357445804.11044.20131119114627.12.dcm index 3fa6de9..b8848ff 100755 --- a/test/data/1.3.6.1.4.1.25403.163683357445804.11044.20131119114627.12.dcm +++ b/test/data/1.3.6.1.4.1.25403.163683357445804.11044.20131119114627.12.dcm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2460e336d90c28c405b7cfa39e4ca94085a98ad4e25ec7f879f77c1422fe283d -size 12248104 +oid sha256:8590b4344ef36a93a3ca0d306a8ca65b47e7a68f27ea815a79f150a68492231d +size 12248686 diff --git a/test/unit/test_dicom_util.py b/test/unit/test_dicom_util.py index 28d7a64..83749d9 100644 --- a/test/unit/test_dicom_util.py +++ b/test/unit/test_dicom_util.py @@ -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" diff --git a/test/unit/test_is_dicom_xray.py b/test/unit/test_is_dicom_xray.py index 5b4e6f9..77265fd 100644 --- a/test/unit/test_is_dicom_xray.py +++ b/test/unit/test_is_dicom_xray.py @@ -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 diff --git a/test/unit/test_resize.py b/test/unit/test_resize.py index 664ab7b..4892512 100644 --- a/test/unit/test_resize.py +++ b/test/unit/test_resize.py @@ -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))