Пример #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 ImageRecord AddImageItem(DicomDataset dicom)
        {
            string seriesUID = dicom.GetSingleValue <string>(DicomTag.SeriesInstanceUID);
            var    series    = SeriesCollection.FirstOrDefault(s => s.SeriesUID == seriesUID);

            if (series == null)
            {
                series = DicomRecord.ToSeries(dicom);
                _seriesItems.Add(series);
                // Add new series.
                AddNewSeriesEvent(this);
            }

            string      imageUID = dicom.GetSingleValue <string>(DicomTag.SOPInstanceUID);
            ImageRecord image    = series.ImageCollection.FirstOrDefault(i => i.SOPInstanceUID == imageUID);

            if (image == null)
            {
                image = new ImageRecord();
                image.SOPInstanceUID = dicom.GetSingleValue <string>(DicomTag.SOPInstanceUID);
                image.ImageNumber    = dicom.GetSingleValueOrDefault <string>(DicomTag.InstanceNumber, null);
                // Add new image.
                series.AddImage(image);
                AddNewImageEvent(this);
            }
            else
            {
            }
            return(image);
        }