예제 #1
0
        protected void InitializeAnnotationList(string studyInstanceUID)
        {
            if (_annotationDictionary.ContainsStudy(studyInstanceUID))
            {
                return;
            }

            StudyItemList studyAnnotations = GetAnnotationsList(studyInstanceUID);             // TODO - switch to using SR IOD when we have it

            if (studyAnnotations == null || studyAnnotations.Count == 0)
            {
                return;
            }

            using (IDataStoreReader reader = DataAccessLayer.GetIDataStoreReader())
            {
                foreach (StudyItem studyItem in studyAnnotations)
                {
                    ClearCanvas.Dicom.DataStore.Study study = reader.GetStudy(studyItem.StudyInstanceUid) as ClearCanvas.Dicom.DataStore.Study;
                    if (study != null)
                    {
                        IEnumerable <ISeries> allSeries = study.GetSeries();
                        foreach (ISeries series in allSeries)
                        {
                            if (series != null && series.Modality == "SR")
                            {
                                IEnumerable <ISopInstance> sopInstances = series.GetSopInstances();
                                foreach (ISopInstance sopInstance in sopInstances)
                                {
                                    if (sopInstance != null)
                                    {
                                        DicomUri fileUri = sopInstance.GetLocationUri();
                                        if (fileUri.IsFile)
                                        {
                                            _annotationDictionary.Add(study.StudyInstanceUid, series.SeriesInstanceUid, sopInstance.SopInstanceUid, fileUri.LocalDiskPath);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                // TODO:
                // 1. Find and load all annotations (read-only?)
                //      LocalDataStoreActivityMonitor.Instance.
            }
        }
        protected void InitializeAnnotationList(string studyInstanceUID)
        {
            if (_annotationDictionary.ContainsStudy(studyInstanceUID))
            {
                return;
            }

            var studyAnnotations = GetAnnotationsList(studyInstanceUID);

            if (studyAnnotations == null || studyAnnotations.Count == 0)
            {
                return;
            }

            using (var reader = DataAccessLayer.GetIDataStoreReader())
            {
                foreach (var studyItem in studyAnnotations)
                {
                    var study = reader.GetStudy(studyItem.StudyInstanceUid) as ClearCanvas.Dicom.DataStore.Study;
                    if (study != null)
                    {
                        var allSeries = study.GetSeries();
                        foreach (var series in allSeries)
                        {
                            if (series != null && series.Modality == "SR")
                            {
                                var sopInstances = series.GetSopInstances();
                                foreach (var sopInstance in sopInstances)
                                {
                                    if (sopInstance != null)
                                    {
                                        var fileUri = sopInstance.GetLocationUri();
                                        if (fileUri.IsFile)
                                        {
                                            _annotationDictionary.Add(study.StudyInstanceUid, series.SeriesInstanceUid, sopInstance.SopInstanceUid, fileUri.LocalDiskPath);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        public static AimInstanceDictionary GetAimInstanceDictionaryForStudy(string studyInstanceUID)
        {
            var annotationDictionary = new AimInstanceDictionary();
            var studyAnnotations     = RetrieveAnnotationsInformationForStudy(studyInstanceUID);

            if (studyAnnotations == null || studyAnnotations.Count == 0)
            {
                return(annotationDictionary);
            }

            using (var reader = DataAccessLayer.GetIDataStoreReader())
            {
                foreach (var studyItem in studyAnnotations)
                {
                    var study = reader.GetStudy(studyItem.StudyInstanceUid) as ClearCanvas.Dicom.DataStore.Study;
                    if (study != null)
                    {
                        var allSeries = study.GetSeries();
                        foreach (var series in allSeries)
                        {
                            if (series != null && series.Modality == "SR")
                            {
                                var sopInstances = series.GetSopInstances();
                                foreach (var sopInstance in sopInstances)
                                {
                                    if (sopInstance != null)
                                    {
                                        var fileUri = sopInstance.GetLocationUri();
                                        if (fileUri.IsFile)
                                        {
                                            annotationDictionary.Add(study.StudyInstanceUid, series.SeriesInstanceUid, sopInstance.SopInstanceUid, fileUri.LocalDiskPath);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(annotationDictionary);
        }