Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def processPatient(self, dcm_info, log_file, data_directory):
# get information of interest
patient_id = self.processDicomField(dcm_info, "PatientID")
patient_name = self.processDicomField(dcm_info, "PatientName")
self.dp.qprint('Processing %s...' % patient_id)
# log it
log_file.write(' PatientID: ' + patient_id + '\n')
log_file.write(' PatientName: ' + patient_name + '\n')
# create patient directory
patient_directory = pypx.utils.patientPath(data_directory, patient_id, patient_name)
self.mkdir(patient_directory, self.log_error)
# Save a mapping from this series_uid to the acutal FS location
# where the file will be written
str_mapFile = os.path.join(self.patient_mapDir, '%s.json' % patient_id)
if not os.path.exists(str_mapFile):
self.mapFile_save( {patient_id : patient_directory}, str_mapFile )
# create patient.info file
patient_info = configparser.ConfigParser()
patient_info['PATIENT'] = {
'PatientID': patient_id,
'PatientName': patient_name,
'Location': patient_directory
}