The functions implemented here are very simple , It's the same as the title : a pile DICOM Medical image files for , Whose files are these , Age and gender , It is convenient to query the following information .

Three steps :

* read dicom file , Access to internal information , include ID, Gender and age ;
Judge whether it is the same as before , If not , Just keep it , Otherwise, skip it ( Here I am CT, By default, they are processed in sequence , If it's messy , Need advice list take ID Storage , Find after ID Does it already exist , If it doesn't exist , Then save , Otherwise, skip );
* Save information to CSV Within the document .
The code is as follows :
def rename_temp(): img_PATH = r"./test" flag = "(1)" csvfile =
open(r'./patientID.csv', 'w', newline='') for path, dirs, files in
os.walk(img_PATH): for filename in files: # Traverse all files num =
((filename.split("_")[1]).split(")")[0]).split("(")[-1] file_path =
os.path.join(path, filename) ds = pydicom.dcmread(file_path, force=True) #
read dcm patient_id = str(ds.PatientID) patient_sex = str(ds.PatientSex)
patient_age = str(ds.PatientAge) if patient_id != flag: print(num)
print("{}***{}***{}".format(patient_id, patient_sex, patient_age)) writer =
csv.writer(csvfile) writer.writerow([num, patient_id,patient_sex,patient_age])
flag = patient_id else: pass csvfile.close()
The results are not shown here , The result is simple , Everyone's information , Save one of the lines CSV file . record , Easy to find later .

©2019-2020 Toolsou All rights reserved,
vue Changes in data Interface not updated Python realization js And Django Front and back interaction in the background JavaSwing To achieve a simple Lianliankan games C# Making a simplified version of calculator elementui Shuttle box el-transfer Display list content text too long JVM summary Regression of dependent variable order categories (R language )【C#】 The realization of student achievement information management system use css Design a simple style html login interface C language --------- Tetris ( source code )