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,
【 Explain in detail 】 Interview must ask :SpringBoot Automatic configuration principle 【 Hyper detail 】Java Realization of student information management system 2020 The 11th National Blue Bridge Cup Python group JavaScript note ( five )---- Branch statement MYSQL database SQL Sentence practice experiment EXERCISES. 1 SIMPLE COMMANDSMySQL Basics Commonly used sentence ( Add / delete / modify query )C++ of string of compare usage vue limit input Only positive numbers can be entered C Language of a Gobang game implementation Programmer refused due to low salary offer,HR become shame , Netizens instantly blew up ..