Updated dicom metadata and pdf document title
This commit is contained in:
parent
57e16bbc43
commit
1098d76180
16
dicom_sr.py
16
dicom_sr.py
@ -95,14 +95,16 @@ def apply(retina_net, dicom,
|
||||
instance_number = 1
|
||||
)
|
||||
|
||||
sr_object.StudyDate = dicom.StudyDate
|
||||
sr_object.StudyTime = dicom.StudyTime
|
||||
sr_object.StudyDate = dicom.get("StudyDate", "")
|
||||
sr_object.StudyTime = dicom.get("StudyTime", "")
|
||||
sr_object.StudyDescription = dicom.get("StudyDescription", "")
|
||||
sr_object.SeriesDate = datetime.now().strftime("%Y%m%d")
|
||||
sr_object.SeriesTime = datetime.now().strftime("%H%M%S")
|
||||
sr_object.PatientID = dicom.PatientID
|
||||
sr_object.PatientName = dicom.PatientName
|
||||
sr_object.PatientSex = dicom.PatientSex
|
||||
sr_object.PatientBirthDate = dicom.PatientBirthDate
|
||||
sr_object.ReferringPhysicianName = sr_object.ReferringPhysicianName
|
||||
sr_object.SeriesDescription = "Mammography Structured Report"
|
||||
sr_object.PatientID = dicom.get("PatientID", "")
|
||||
sr_object.PatientName = dicom.get("PatientName", "")
|
||||
sr_object.PatientSex = dicom.get("PatientSex", "")
|
||||
sr_object.PatientBirthDate = dicom.get("PatientBirthDate", "")
|
||||
sr_object.ReferringPhysicianName = dicom.get("ReferringPhysicianName", "")
|
||||
|
||||
return sr_object
|
||||
|
||||
@ -53,6 +53,9 @@ def create_pdf(image_path, measurements, sr, pdf_path):
|
||||
"""Creates a PDF with the mammography image and extracted measurements."""
|
||||
c = canvas.Canvas(pdf_path)
|
||||
|
||||
# Set PDF metadata
|
||||
c.setTitle("Mammography Report")
|
||||
|
||||
# Set font for the title
|
||||
c.setFont("Helvetica-Bold", 16)
|
||||
|
||||
@ -112,6 +115,7 @@ def create_dcm_pdf(sr, pdf_path, instance_uid):
|
||||
ds.StudyInstanceUID = sr.StudyInstanceUID
|
||||
ds.StudyDate = sr.StudyDate
|
||||
ds.StudyTime = sr.StudyTime
|
||||
ds.StudyDescription = sr.StudyDescription
|
||||
ds.AccessionNumber = sr.AccessionNumber
|
||||
ds.ReferringPhysicianName = sr.ReferringPhysicianName
|
||||
ds.StudyID = sr.StudyID
|
||||
@ -119,11 +123,12 @@ def create_dcm_pdf(sr, pdf_path, instance_uid):
|
||||
ds.SeriesInstanceUID = generate_uid()
|
||||
ds.SeriesDate = sr.SeriesDate
|
||||
ds.SeriesTime = sr.SeriesTime
|
||||
ds.SeriesDescription = "Mammography PDF Report"
|
||||
ds.SeriesNumber = 1
|
||||
ds.Modality = "DOC"
|
||||
|
||||
ds.Manufacturer = "MammographyAI"
|
||||
ds.ConversionType = "DI"
|
||||
ds.ConversionType = "SD"
|
||||
|
||||
ds.SOPInstanceUID = instance_uid
|
||||
ds.SOPClassUID = EncapsulatedPDFStorage
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user