diff --git a/medimages4tests/dummy/dicom/__init__.py b/medimages4tests/dummy/dicom/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/medimages4tests/dummy/dicom/mri/__init__.py b/medimages4tests/dummy/dicom/mri/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/medimages4tests/dummy/dicom/mri/dwi/__init__.py b/medimages4tests/dummy/dicom/mri/dwi/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/__init__.py b/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/__init__.py new file mode 100644 index 0000000..f486423 --- /dev/null +++ b/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/__init__.py @@ -0,0 +1,3 @@ +from .data import get_data + +__all__ = ["get_data"] diff --git a/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/data.py b/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/data.py new file mode 100644 index 0000000..25853a0 --- /dev/null +++ b/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/data.py @@ -0,0 +1,16 @@ +import typing as ty +from pathlib import Path +import tempfile +from .header import get_image_header +from ..base import generate_raw_data + + +def get_data(out_dir: Path = None, **kwargs) -> ty.List[Path]: + tmp_dir = Path(tempfile.mkdtemp()) + dicom_hdr_fspath = next(get_image_header(tmp_dir, **kwargs).iterdir()) + return generate_raw_data( + dicom_hdr_fspath=dicom_hdr_fspath, + out_dir=out_dir, + ) + + diff --git a/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/header.py b/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/header.py new file mode 100644 index 0000000..02b703b --- /dev/null +++ b/medimages4tests/dummy/raw/pet/siemens/biograph_vision/vr20b/pet_calibration/header.py @@ -0,0 +1,91 @@ +from medimages4tests.dummy.dicom.base import ( + generate_dicom, + default_dicom_dir, + evolve_header, +) + + +def get_image_header(out_dir, **kwargs): + hdr = evolve_header(constant_hdr, **kwargs) + return generate_dicom(out_dir, num_vols, hdr, collated_data, {}) + + +num_vols = 1 + + +constant_hdr = { + "00080005": {"vr": "CS", "Value": ["ISO_IR 100"]}, + "00080008": {"vr": "CS", "Value": ["ORIGINAL", "PRIMARY", "PET_CALIBRATION"]}, + "00080012": {"vr": "DA", "Value": ["20230725"]}, + "00080013": {"vr": "TM", "Value": ["071306.000000"]}, + "00080016": {"vr": "UI", "Value": ["1.3.12.2.1107.5.9.1"]}, + "00080018": { + "vr": "UI", + "Value": ["1.3.12.2.1107.5.1.4.10016.30000023072501543220300000001"], + }, + "00080020": {"vr": "DA", "Value": ["20230725"]}, + "00080021": {"vr": "DA", "Value": ["20230725"]}, + "00080022": {"vr": "DA", "Value": ["20230725"]}, + "00080030": {"vr": "TM", "Value": ["114938.720000"]}, + "00080031": {"vr": "TM", "Value": ["115432.206000"]}, + "00080032": {"vr": "TM", "Value": ["071306.000000"]}, + "00080050": {"vr": "SH"}, + "00080060": {"vr": "CS", "Value": ["PT"]}, + "00080070": {"vr": "LO", "Value": ["SIEMENS"]}, + "00080080": {"vr": "LO", "Value": ["An institute"]}, + "00080081": {"vr": "ST", "Value": ["Address of said institute"]}, + "00080090": {"vr": "PN"}, + "00081010": {"vr": "SH", "Value": ["QUADRA10016"]}, + "00081030": {"vr": "LO", "Value": ["Researcher^Project"]}, + "0008103E": {"vr": "LO", "Value": ["PET Raw Data"]}, + "00081040": {"vr": "LO", "Value": ["PET"]}, + "00081090": {"vr": "LO", "Value": ["Biograph128_Vision Quadra Edge-1232"]}, + "00082111": {"vr": "ST", "Value": ["PETCT"]}, + "00100010": {"vr": "PN", "Value": ["FirstName^LastName"]}, + "00100020": {"vr": "LO", "Value": ["Session Label"]}, + "00100030": {"vr": "DA", "Value": ["19700101"]}, + "00100040": {"vr": "CS", "Value": ["O"]}, + "00101010": {"vr": "AS", "Value": ["053Y"]}, + "00101030": {"vr": "DS", "Value": [1.27]}, + "00181000": {"vr": "LO", "Value": ["10016"]}, + "00181020": {"vr": "LO", "Value": ["VR20B"]}, + "00181030": {"vr": "LO", "Value": ["Onco (Adult)"]}, + "00181200": {"vr": "DA", "Value": ["20230725", "20230611"]}, + "00181201": {"vr": "TM", "Value": ["071306.000000", "134228.000000"]}, + "00185100": {"vr": "CS", "Value": ["HFS"]}, + "0020000D": { + "vr": "UI", + "Value": ["1.3.12.2.1107.5.1.4.10016.30000023072501493873200000001"], + }, + "0020000E": { + "vr": "UI", + "Value": ["1.3.12.2.1107.5.1.4.10016.30000023072501543220300000002"], + }, + "00200010": {"vr": "SH", "Value": ["PROJECT_ID"]}, + "00200011": {"vr": "IS", "Value": [602]}, + "00200012": {"vr": "IS", "Value": [1]}, + "00200013": {"vr": "IS", "Value": [1]}, + "00200052": { + "vr": "UI", + "Value": ["1.3.12.2.1107.5.1.4.10016.30000023072501494590400000000"], + }, + "00204000": {"vr": "LT", "Value": ["PET Normalization"]}, + "00290010": {"vr": "LO", "Value": ["SIEMENS CSA NON-IMAGE"]}, + "00290011": {"vr": "LO", "Value": ["SIEMENS CSA HEADER"]}, + "00290012": {"vr": "LO", "Value": ["SIEMENS MEDCOM HEADER"]}, + "00291008": {"vr": "CS", "Value": ["PET_CALIB_T"]}, + "00291009": {"vr": "LO", "Value": ["1.3"]}, + "00291108": {"vr": "CS", "Value": ["PET_HDR_QC"]}, + "00291109": {"vr": "LO", "Value": ["1.3"]}, + "7FE10010": {"vr": "LO", "Value": ["SIEMENS CSA NON-IMAGE"]}, + "00104000": {"vr": "LT", "Value": ["Patient comments string"]}, + "00081048": {"vr": "PN", "Value": [{"Alphabetic": "Some Phenotype"}]}, +} + + +collated_data = { + "00291010": {"vr": "OB", "BinaryLength": 3168}, + "00291110": {"vr": "OB", "BinaryLength": 1220}, + "00291220": {"vr": "OB", "BinaryLength": 80}, + "7FE11010": {"vr": "OB", "BinaryLength": 352}, +} diff --git a/medimages4tests/import_tools.py b/medimages4tests/import_tools.py index cfbc2de..a012039 100644 --- a/medimages4tests/import_tools.py +++ b/medimages4tests/import_tools.py @@ -119,7 +119,7 @@ def raw_pet_to_gen_code(fspath: Path, out_dir: Path): num_vols=1, constant_hdr=json.dumps(constant_hdr, indent=" "), varying_hdr=json.dumps(varying_hdr), - collated_data=json.dumps([data]), + collated_data=json.dumps(data), ) ) init_fspath = out_dir / "__init__.py" diff --git a/tests/test_raw_pet.py b/tests/test_raw_pet.py index 4bf9721..6ff3de7 100644 --- a/tests/test_raw_pet.py +++ b/tests/test_raw_pet.py @@ -33,4 +33,4 @@ def test_siemens_raw_pet_data_creation(siemens_raw_pet_data: ModuleType): out_dir = Path(tempfile.mkdtemp()) # Generate raw PET data files - siemens_raw_pet_data.get_image(out_dir) + siemens_raw_pet_data.get_data(out_dir)