Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def processStudy(self, dcm_info, log_file, patient_directory):
# get information of interest
study_description = self.processDicomField(dcm_info, "StudyDescription")
study_date = self.processDicomField(dcm_info, "StudyDate")
study_uid = self.processDicomField(dcm_info, "StudyInstanceUID")
self.dp.qprint('Processing %s...' % study_uid)
# log it
log_file.write(' StudyDescription: ' + study_description + '\n')
log_file.write(' StudyDate: ' + study_date + '\n')
log_file.write(' StudyInstanceUID: ' + study_uid + '\n')
# create study directory
study_directory = pypx.utils.studyPath(
patient_directory, study_description, study_date, study_uid)
self.mkdir(study_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.study_mapDir, '%s.json' % study_uid)
if not os.path.exists(str_mapFile):
self.mapFile_save( {study_uid : study_directory}, str_mapFile )
# create study.info file
study_info = configparser.ConfigParser()
study_info['STUDY'] = {
'StudyDescription': study_description,
'StudyDate': study_date,
'StudyInstanceUID': study_uid,
'Location': study_directory