示例#1
0
        public static DicomStudy CreateFromDicom(DicomDataset dicom)
        {
            string studyUID        = dicom.GetSingleValue <string>(DicomTag.StudyInstanceUID);
            string studyId         = dicom.GetSingleValueOrDefault <string>(DicomTag.StudyID, null);
            string studyDate       = dicom.GetSingleValueOrDefault <string>(DicomTag.StudyDate, null);
            string studyTime       = dicom.GetSingleValueOrDefault <string>(DicomTag.StudyTime, null);
            string accessionNumber = dicom.GetSingleValueOrDefault <string>(DicomTag.AccessionNumber, null);
            string description     = dicom.GetSingleValueOrDefault <string>(DicomTag.StudyDescription, null);

            PatientRecord patient = DicomRecord.ToPatient(dicom);
            var           result  = new DicomStudy(studyUID, studyId, studyDate, studyTime, accessionNumber, patient, description);

            SeriesRecord series = DicomRecord.ToSeries(dicom);
            ImageRecord  image  = new ImageRecord();

            image.SOPInstanceUID = dicom.GetSingleValue <string>(DicomTag.SOPInstanceUID);
            image.ImageNumber    = dicom.GetSingleValueOrDefault <string>(DicomTag.InstanceNumber, null);
            series.AddImage(image);
            result._seriesItems.Add(series);

            // Notice the event.
            AddNewStudyEvent(result);

            return(result);
        }
示例#2
0
        public static SeriesRecord ToSeries(DicomDataset record)
        {
            SeriesRecord series = new SeriesRecord();

            series.SeriesUID    = record.GetSingleValue <string>(DicomTag.SeriesInstanceUID);
            series.SeriesNumber = record.GetSingleValueOrDefault <string>(DicomTag.SeriesNumber, null);
            series.SeriesDate   = record.GetSingleValueOrDefault <string>(DicomTag.SeriesDate, null);
            series.SeriesTime   = record.GetSingleValueOrDefault <string>(DicomTag.SeriesTime, null);
            series.Modality     = record.GetSingleValueOrDefault <string>(DicomTag.Modality, null);
            return(series);
        }
示例#3
0
        public static void WriteSeries(this DicomDataset dataset, string studyUID, SeriesRecord series)
        {
            dataset.AddOrUpdate(DicomTag.StudyInstanceUID, studyUID);

            dataset.AddOrUpdate(DicomTag.SeriesInstanceUID, series.SeriesUID);
            dataset.AddOrUpdate(DicomTag.SeriesNumber, series.SeriesNumber);
            dataset.AddOrUpdate(DicomTag.SeriesDate, series.SeriesDate);
            dataset.AddOrUpdate(DicomTag.SeriesTime, series.SeriesTime);
            dataset.AddOrUpdate(DicomTag.Modality, series.Modality);

            dataset.AddOrUpdate(DicomTag.NumberOfSeriesRelatedInstances, series.ImageCollection.Count.ToString());
        }