//SERIALIZATION CONSTRUCTOR public dicomInfoTools(SerializationInfo info, StreamingContext context) { dateFormat = (string)info.GetValue("DateFormat", typeof(string)); timeFormat = (string)info.GetValue("TimeFormat", typeof(string)); imageWidth = (int)info.GetValue("ImageWidth", typeof(int)); imageHeight = (int)info.GetValue("ImageHeight", typeof(int)); imageTransferSyntax = (string)info.GetValue("ImageTransferSyntax", typeof(string)); defaultDicomTransferSyntax = (string)info.GetValue("DefaultDicomTransferSyntax", typeof(string)); imageRescaleSlope = (int)info.GetValue("ImageRescaleSlope", typeof(int)); imageRescaleIntercept = (int)info.GetValue("ImageRescaleIntercept", typeof(int)); imageWindowWidth = (int)info.GetValue("ImageWindowWidth", typeof(int)); imageWindowCenter = (int)info.GetValue("ImageWindowCenter", typeof(int)); imageOrientationPatient = (double[])info.GetValue("ImageOrientationPatient", typeof(double[])); orientationPatient = (string)info.GetValue("OrientationPatient", typeof(string)); patientId = (int)info.GetValue("PatientId", typeof(int)); patientAge = (int)info.GetValue("PatientAge", typeof(int)); patientBd = (DateTime)info.GetValue("PatientBd", typeof(DateTime)); patientSex = (string)info.GetValue("PatientSex", typeof(string)); patientName = (string)info.GetValue("PatientName", typeof(string)); studyId = (int)info.GetValue("StudyId", typeof(int)); studyTime = (DateTime)info.GetValue("StudyTime", typeof(DateTime)); studyDate = (DateTime)info.GetValue("StudyDate", typeof(DateTime)); studyDescription = (string)info.GetValue("StudyDescription", typeof(string)); studySeriesDescription = (string)info.GetValue("StudySeriesDescription", typeof(string)); studyProtocolName = (string)info.GetValue("StudyProtocolName", typeof(string)); studySliceThickness = (float)info.GetValue("StudySliceThickness", typeof(float)); studyDoctorName = (string)info.GetValue("StudyDoctorName", typeof(string)); modality = (string)info.GetValue("Modality", typeof(string)); modalityManufacturer = (string)info.GetValue("ModalityManufacturer", typeof(string)); strings = (dicomInfoString)info.GetValue("Strings", typeof(dicomInfoString)); GetDicomInfoString(); }
//READ METADATA public void GetDicomInfoString() { string patientIdString; string patientAgeString; string studyIdString; string studyDateString; string studyTimeString; string patientBdString; string studySliceThicknessString; if (patientId != 0) { patientIdString = patientId.ToString(); } else { patientIdString = "N/A"; } if (patientAge != 0) { patientAgeString = patientAge.ToString(); } else { patientAgeString = "N/A"; } if (studyId != 0) { studyIdString = studyId.ToString(); } else { studyIdString = "N/A"; } if (studyDate != DateTime.MinValue) { studyDateString = studyDate.ToString(dateFormat); } else { studyDateString = "N/A"; } if (studyTime != DateTime.MinValue) { studyTimeString = studyTime.ToString(timeFormat); } else { studyTimeString = "N/A"; } if (patientBd != DateTime.MinValue) { patientBdString = patientBd.ToString(dateFormat); } else { patientBdString = "N/A"; } if (studySliceThickness != 0) { studySliceThicknessString = studySliceThickness.ToString(); } else { studySliceThicknessString = "N/A"; } string patInfo = "<b>Patient Info:\n\n</b>" + $"ID: {patientIdString}\nGender: {patientSex}\nAge: {patientAgeString}\n" + $"Name: {patientName}\nBirth Date: {patientBdString}\n"; string styInfo = "<b>Study Info:</b>\n\n" + $"ID: {studyIdString}\nDescription: {studyDescription}\n" + $"Series: {studySeriesDescription}\nThickness: {studySliceThicknessString} mm\nOrientation: {orientationPatient}\n" + $"Date: {studyDateString}\nTime: {studyTimeString}\n" + $"Referring Physician: {studyDoctorName}\n"; string mdInfo = "<b>Modality Info:</b>\n\n" + $"Modality: {modality}\nManufacturer: {modalityManufacturer}\n"; strings = new dicomInfoString(patInfo, styInfo, mdInfo); //Debug.Log(info); /*Debug.Log(dumpPatientId); * Debug.Log(dumpPatientSex); * Debug.Log(dumpPatientName); * Debug.Log(dumpPatientBd); * Debug.Log(dumpStudyId); * Debug.Log(dumpStudyDate); * Debug.Log(dumpStudyTime); * Debug.Log(dumpDoctorName); * Debug.Log(dumpModality); * Debug.Log(dumpModalityManufacturer);*/ return; }