Beispiel #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);
        }
Beispiel #2
0
        public static StudyBuilder CreateMixedMultiframeUltrasound
        (
            string patientId,
            string patientsName,
            string studyDescription,
            string studyInstanceUid,
            int seriesNumber,
            string seriesDescription,
            int numberSingleImages,
            int numberMultiframes,
            bool createSeriesDisplaySet,
            bool createSingleImageDisplaySets
        )
        {
            var studyBuilder = new StudyBuilder
            {
                PatientId        = patientId,
                PatientsName     = patientsName,
                StudyDescription = studyDescription,
                StudyInstanceUid = studyInstanceUid
            };

            if (numberMultiframes <= 0 && numberSingleImages <= 0)
            {
                throw new ArgumentException();
            }

            SeriesBuilder seriesBuilder;

            studyBuilder.Series.Add(seriesBuilder = new SeriesBuilder
            {
                SeriesDescription = seriesDescription,
                Modality          = "US",
                SeriesNumber      = seriesNumber
            });

            int instanceNumber = 1;

            for (int i = 0; i < numberSingleImages; i++, instanceNumber++)
            {
                seriesBuilder.Images.Add(new ImageBuilder
                {
                    InstanceNumber = instanceNumber,
                    SopClassUid    = SopClass.UltrasoundImageStorageUid
                });
            }

            for (int i = 0; i < numberMultiframes; i++, instanceNumber++)
            {
                seriesBuilder.Images.Add(new ImageBuilder
                {
                    InstanceNumber = instanceNumber,
                    NumberOfFrames = 3,
                    SopClassUid    = SopClass.UltrasoundMultiFrameImageStorageUid
                });
            }

            if (createSingleImageDisplaySets)
            {
                studyBuilder.DisplaySetFactory = new BasicDisplaySetFactory {
                    CreateSingleImageDisplaySets = true
                }
            }
            ;
            //Only use the mixed multi-frame factory if it's going to work.
            else if (!createSeriesDisplaySet && (numberMultiframes > 1 || (numberMultiframes > 0 && numberSingleImages > 0)))
            {
                studyBuilder.DisplaySetFactory = new MixedMultiFrameDisplaySetFactory();
            }

            return(studyBuilder);
        }
Beispiel #3
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);
        }