Commit 3063c6fa authored by Gabriel Couture's avatar Gabriel Couture

Allow dose grid with 0.2mm spacing

parent 7e855e85
...@@ -100,25 +100,26 @@ def get_rtdose(dose_gradient: str, spacing: float) -> pydicom.FileDataset: ...@@ -100,25 +100,26 @@ def get_rtdose(dose_gradient: str, spacing: float) -> pydicom.FileDataset:
Dose gradient: {'AP', 'SI'}. Dose gradient: {'AP', 'SI'}.
AP := Anterior Posterior, SI := Superior Inferior. AP := Anterior Posterior, SI := Superior Inferior.
spacing spacing
Spacing in millimeters: {1, 2, 3}. Spacing in millimeters: {0.2, 1, 2, 3}.
Returns Returns
------- -------
List of DICOM file data set. List of DICOM file data set.
""" """
_valid_dose_grading(dose_gradient), _valid_spacing(spacing) _valid_dose_grading(dose_gradient), _valid_spacing(spacing)
if spacing == 0.2:
raise InvalidSpacingError("Should be {1, 2, 3}")
directory, _ = os.path.split(__file__) directory, _ = os.path.split(__file__)
rtdose_path = join(directory, 'data', 'RTDOSE') rtdose_path = join(directory, 'data', 'RTDOSE')
dicom_files = filter( dicom_files = filter(
lambda i: _format_dose_gradient(dose_gradient) in i, lambda i: _format_dose_gradient(dose_gradient) in i,
filter( list(filter(
lambda i: f'{spacing}mm'.replace('.0', '') in i, lambda i: f'{spacing}mm'.replace('.0', '') in i,
os.listdir(rtdose_path) os.listdir(rtdose_path)
) )) + [] if spacing != 0.2 else [
'Linear_AntPost_0-4_0-2_0-4_mm_Aligned.dcm',
'Linear_SupInf_0-4_0-2_0-4_mm_Aligned.dcm',
]
) )
dicom_paths = [join(rtdose_path, i) for i in dicom_files] dicom_paths = [join(rtdose_path, i) for i in dicom_files]
......
...@@ -8,7 +8,7 @@ from dicomgenerator import writer ...@@ -8,7 +8,7 @@ from dicomgenerator import writer
A_TARGET_DIRECTORY = './tests/data' A_TARGET_DIRECTORY = './tests/data'
A_GEOMETRY = 'cone' A_GEOMETRY = 'cone'
A_SPACING = 1.0 A_SPACING = 0.2
A_DOSE_GRADIENT = 'AP' A_DOSE_GRADIENT = 'AP'
A_ROI = 'axial' A_ROI = 'axial'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment