jpegをDICOMに変換し、tagを編集する





jpeg2dicom

import os
command = 'img2dcm test.jpg test.dcm'
os.system(command)

pip install pydicom

import pydicom
ds = pydicom.read_file('test.dcm')
ds.PatientName = 'John Doe'
ds.PatientID = '12345'
ds.PatientBirthDate = '19991210'
ds.PatientSex = 'M'
ds.StudyDate = '20220127'
ds.Modality = 'OT'
ds.save_as('test2.dcm',write_like_original=False)

  • 後で読む

DICOMでJPEGを扱うときの注意点 - hatakeのブログ