| Total Complexity | 7 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import csv |
||
| 2 | from PythonUtils.folder import recursive_list |
||
| 3 | from DICOM.validate import DICOM_validate |
||
| 4 | from DICOM.elements import DICOM_elements |
||
| 5 | |||
| 6 | output=[] |
||
| 7 | |||
| 8 | |||
| 9 | def BatchDateCalculation(path): |
||
| 10 | file_list = recursive_list(path) |
||
| 11 | for file in file_list: |
||
| 12 | |||
| 13 | if DICOM_validate.file(file): |
||
| 14 | |||
| 15 | # Try to extract these information from the files. |
||
| 16 | success1, StudyDate = DICOM_elements.retrieve(file, "StudyDate") |
||
| 17 | success2, PatientBirthDate = DICOM_elements.retrieve(file, "PatientBirthDate") |
||
| 18 | success3, age = DICOM_elements.computeScanAge(file) |
||
| 19 | |||
| 20 | # Skip this file if it is not successful. |
||
| 21 | if not success1 or not success2 or not success3: |
||
| 22 | continue |
||
| 23 | |||
| 24 | # Print, store and append the information acquired. |
||
| 25 | A = [file, StudyDate, PatientBirthDate, str(age)] |
||
| 26 | print(A) |
||
| 27 | output.append(A) |
||
| 28 | |||
| 29 | with open("output.csv",'w') as resultFile: |
||
| 30 | wr = csv.writer(resultFile, dialect='excel') |
||
| 31 | wr.writerow(output) |
||
| 32 | |||
| 33 | |||
| 34 | if __name__ == "__main__": |
||
| 35 | BatchDateCalculation(r"C:\FullyAnonymizedSubjects\BDP Subjects\BDP_TSE_T2") |
||
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.