Beispiel #1
0
        public Study(DicomDataGenerator parent, Person person, ModalityStats modalityStats, Random r)
        {
            /////////////////////// Generate all the Study Values ////////////////////
            Parent    = parent;
            StudyUID  = DicomUID.Generate();
            StudyDate = person.GetRandomDateDuringLifetime(r).Date;

            var stats = DicomDataGeneratorStats.GetInstance(r);

            //if we know about the frequency of tag values for this modality?
            if (stats.TagValuesByModalityAndTag.ContainsKey(modalityStats.Modality))
            {
                foreach (KeyValuePair <DicomTag, BucketList <string> > dict in stats.TagValuesByModalityAndTag[modalityStats.Modality])
                {
                    //for each tag we know about

                    //if it's a study level one record it here
                    if (dict.Key == DicomTag.StudyDescription)
                    {
                        StudyDescription = dict.Value.GetRandom();
                    }
                }
            }

            AccessionNumber = stats.GetRandomAccessionNumber(r);
            StudyTime       = stats.GetRandomTimeOfDay(r);

            /////////////////////  Generate all the Series (will also generate images) /////////////////////

            //have a random number of series (based on average and standard deviation for that modality)
            //but have at least 1 series!
            int seriesCount = Math.Max(1, (int)modalityStats.SeriesPerStudyNormal.Sample());

            Series = new ReadOnlyCollection <Series>(_series);

            for (int i = 0; i < seriesCount; i++)
            {
                _series.Add(new Series(this, person, modalityStats, r));
            }
        }
Beispiel #2
0
        internal Series(Study study, Person person, ModalityStats modalityStats, Random r)
        {
            SeriesUID = DicomUID.Generate();

            this.Study         = study;
            this.person        = person;
            this.ModalityStats = modalityStats;

            //todo: for now just use the Study date, in theory secondary capture images could be generated later
            SeriesDate = study.StudyDate;

            //have a random number of images (based on average and standard deviation for that modality)
            //but have at least 1 image!
            int imageCount = Math.Max(1, (int)modalityStats.ImagesPerSeriesNormal.Sample());

            for (int i = 0; i < imageCount; i++)
            {
                _datasets.Add(Study.Parent.GenerateTestDataset(person, this));
            }

            Datasets = new ReadOnlyCollection <DicomDataset>(_datasets);
        }