private void SetStudyTags() { StudyInstanceUid = DicomUid.GenerateUid().UID; _theFile.DataSet[DicomTags.StudyInstanceUid].SetStringValue(StudyInstanceUid); _theFile.DataSet[DicomTags.StudyDate].SetStringValue(DateParser.ToDicomString(StudyDate)); _theFile.DataSet[DicomTags.StudyTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now)); _theFile.DataSet[DicomTags.PerformedProcedureStepStartDate].SetStringValue(DateParser.ToDicomString(StudyDate)); _theFile.DataSet[DicomTags.PerformedProcedureStepStartTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now)); _theFile.DataSet[DicomTags.AccessionNumber].SetStringValue(ModalityHospital.GetNextAccession()); _studyNumber++; _theFile.DataSet[DicomTags.StudyId].SetStringValue(string.Format("S{0:0000}", _studyNumber)); _theFile.DataSet[DicomTags.ReferringPhysiciansName].SetStringValue(GetPatient()); string name = GetPatient(); _theFile.DataSet[DicomTags.PatientsName].SetStringValue(name); _theFile.DataSet[DicomTags.PatientId].SetStringValue(string.Format("{0} {1}", Math.Abs(name.GetHashCode()), ModalityHospital.Name)); _theFile.DataSet[DicomTags.IssuerOfPatientId].SetStringValue(ModalityHospital.Name); DateTime birthdate = GetBirthdate(name); TimeSpan age = StudyDate.Subtract(birthdate); _theFile.DataSet[DicomTags.PatientsBirthDate].SetStringValue(DateParser.ToDicomString(birthdate)); _theFile.DataSet[DicomTags.PatientsAge].SetStringValue(String.Format("{0:000}Y", age.Days / 365)); _theFile.DataSet[DicomTags.PatientsSex].SetStringValue("M"); _theFile.DataSet[DicomTags.StudyDescription].SetStringValue(_studyDescription[Rand.Next(_studyDescription.Count)]); }
private void DrawString() { //textGraphics = Graphics.FromImage(image.ToList().ToBitmap(Width, Height)); //textGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; //textGraphics.DrawString($"Stduy date: {StudyDate.ToString("dd.MM.yyyy")}", SerifFont, Brushes.White, 0, 0); Console.WriteLine($"Stduy date: {StudyDate.ToString("dd.MM.yyyy")}"); //DrawImage(); }
private DateTime GetBirthdate(string name) { return(StudyDate.AddDays(-1 * (Math.Abs(name.GetHashCode()) % 30000))); }