Пример #1
0
// ReSharper disable InconsistentNaming
        public static StudyBuilder CreateCRXRayBuilder
// ReSharper restore InconsistentNaming
        (
            string patientId,
            string patientsName,
            string studyDescription,
            string studyInstanceUid,
            string seriesDescription,
            int startSeriesNumber,
            bool oneSeries,
            bool oneImagePerSeries,
            bool createSingleImageDisplaySets
        )
        {
            if (!oneSeries && !oneImagePerSeries)
            {
                throw new ArgumentException("Multiple Series currently restricted to one image each");
            }

            var studyBuilder = new StudyBuilder
            {
                DisplaySetFactory = new BasicDisplaySetFactory {
                    CreateSingleImageDisplaySets = createSingleImageDisplaySets
                },
                PatientId        = patientId,
                PatientsName     = patientsName,
                StudyDescription = studyDescription,
                StudyInstanceUid = studyInstanceUid
            };

            var image1 = new ImageBuilder
            {
                ImageLaterality = "U",
                ViewPosition    = "AP",
                InstanceNumber  = 1,
                SopClassUid     = SopClass.ComputedRadiographyImageStorageUid
            };

            var image2 = new ImageBuilder
            {
                ImageLaterality = "U",
                ViewPosition    = "LL",
                InstanceNumber  = 1,
                SopClassUid     = SopClass.ComputedRadiographyImageStorageUid
            };

            if (oneSeries)
            {
                var seriesBuilder = new SeriesBuilder
                {
                    Modality          = "CR",
                    SeriesDescription = seriesDescription,
                    SeriesNumber      = startSeriesNumber,
                    Images            = new List <ImageBuilder> {
                        image1
                    }
                };

                if (!oneImagePerSeries)
                {
                    seriesBuilder.Images.Add(image2);
                }

                studyBuilder.Series.Add(seriesBuilder);
            }
            else
            {
                var seriesBuilder = new SeriesBuilder
                {
                    Modality          = "CR",
                    SeriesDescription = seriesDescription,
                    SeriesNumber      = startSeriesNumber,
                    Images            = new List <ImageBuilder> {
                        image1
                    }
                };

                studyBuilder.Series.Add(seriesBuilder);

                seriesBuilder = new SeriesBuilder
                {
                    Modality          = "CR",
                    SeriesDescription = seriesDescription,
                    SeriesNumber      = startSeriesNumber,
                    Images            = new List <ImageBuilder> {
                        image2
                    }
                };

                studyBuilder.Series.Add(seriesBuilder);
            }

            return(studyBuilder);
        }
Пример #2
0
        public static StudyBuilder CreateDigitalXRayBuilder
        (
            string patientId,
            string patientsName,
            string studyDescription,
            string studyInstanceUid,
            string seriesDescription,
            int startSeriesNumber,
            bool oneSeries,
            bool oneImagePerSeries,
            bool createSingleImageDisplaySets
        )
        {
            if (!oneSeries && !oneImagePerSeries)
            {
                throw new ArgumentException("Multiple Series currently restricted to one image each");
            }

            var studyBuilder = new StudyBuilder
            {
                DisplaySetFactory = new BasicDisplaySetFactory {
                    CreateSingleImageDisplaySets = createSingleImageDisplaySets
                },
                PatientId        = patientId,
                PatientsName     = patientsName,
                StudyDescription = studyDescription,
                StudyInstanceUid = studyInstanceUid
            };

            var image1 = new ImageBuilder
            {
                ImageLaterality        = "U",
                ViewPosition           = "AP",
                InstanceNumber         = 1,
                SopClassUid            = SopClass.DigitalXRayImageStorageForPresentationUid,
                PresentationIntentType = "FOR PRESENTATION"
            };

            var image2 = new ImageBuilder
            {
                ImageLaterality        = "U",
                ViewPosition           = "LL",
                InstanceNumber         = 1,
                SopClassUid            = SopClass.DigitalXRayImageStorageForPresentationUid,
                PresentationIntentType = "FOR PRESENTATION"
            };


            if (oneSeries)
            {
                var seriesBuilder = new SeriesBuilder
                {
                    Modality          = "DX",
                    SeriesDescription = seriesDescription,
                    SeriesNumber      = startSeriesNumber,
                    Images            = new List <ImageBuilder> {
                        image1
                    }
                };

                if (!oneImagePerSeries)
                {
                    seriesBuilder.Images.Add(image2);
                }

                studyBuilder.Series.Add(seriesBuilder);
            }
            else
            {
                var seriesBuilder = new SeriesBuilder
                {
                    Modality          = "DX",
                    SeriesDescription = seriesDescription,
                    SeriesNumber      = startSeriesNumber,
                    Images            = new List <ImageBuilder> {
                        image1
                    }
                };

                studyBuilder.Series.Add(seriesBuilder);

                seriesBuilder = new SeriesBuilder
                {
                    Modality          = "DX",
                    SeriesDescription = seriesDescription,
                    SeriesNumber      = startSeriesNumber,
                    Images            = new List <ImageBuilder> {
                        image2
                    }
                };

                studyBuilder.Series.Add(seriesBuilder);
            }

            return(studyBuilder);
        }