| Total Complexity | 5 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from DICOM.validate import DICOM_validator |
||
| 2 | from DICOM.elements import DICOM_updateElement |
||
| 3 | |||
| 4 | |||
| 5 | def DICOM_anonymizer(path, PSCID): |
||
| 6 | """ |
||
| 7 | Anonymize the DICOMS to remove any identifiable information |
||
| 8 | :param path: |
||
| 9 | :param PSCID: |
||
| 10 | :return: |
||
| 11 | """ |
||
| 12 | |||
| 13 | return DICOM_anonymizer_save_as(path, PSCID, path) |
||
| 14 | |||
| 15 | |||
| 16 | def DICOM_anonymizer_save_as(path, PSCID, out_path): |
||
| 17 | """ |
||
| 18 | Anonymize the DICOMS to remove any identifiable information |
||
| 19 | :param path: |
||
| 20 | :param PSCID: |
||
| 21 | :return: |
||
| 22 | """ |
||
| 23 | |||
| 24 | success, dataset = DICOM_validator(path) |
||
| 25 | if not success: |
||
| 26 | return False |
||
| 27 | |||
| 28 | success1, _ = DICOM_updateElement(path, "PatientID", PSCID, out_path) |
||
| 29 | success2, _ = DICOM_updateElement(path, "PatientName", PSCID, out_path) |
||
| 30 | |||
| 31 | if success1 and success2: |
||
| 32 | return True |
||
| 33 | else: |
||
| 34 | return False |
||
| 35 | return True |
||
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.