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 .

Technology
©2019-2020 Toolsou All rights reserved,
Hundreds of millions of locusts rarely collide Locusts want to be self driving Heroes Share has surpassed Ningde Era !LG Chemical confirmation to spin off battery business unit TypeScript Data types in is enough Python Garbage collection and memory leak msf Generate Trojan horse attack android mobile phone Element-UI Implementation of secondary packaging TreeSelect Tree drop-down selection component element-ui+vue-treeselect Verification of drop down box Spring Boot Lesson 16 :SpringBoot Implementation of multithreading with injection class A guess number of small games , use JavaScript realization Unity3D Input Key system