Ejemplo n.º 1
0
        private void InitializeModalityFrequency(Random r)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Frequency", typeof(int));
            dt.Columns.Add("AverageSeriesPerStudy", typeof(double));
            dt.Columns.Add("StandardDeviationSeriesPerStudy", typeof(double));
            dt.Columns.Add("AverageImagesPerSeries", typeof(double));
            dt.Columns.Add("StandardDeviationImagesPerSeries", typeof(double));

            DicomDataGenerator.EmbeddedCsvToDataTable(typeof(DicomDataGenerator), "DicomDataGeneratorModalities.csv", dt);

            ModalityFrequency = new BucketList <ModalityStats>(r);

            int idx = 0;

            foreach (DataRow dr in dt.Rows)
            {
                string modality = (string)dr["Modality"];
                ModalityFrequency.Add((int)dr["Frequency"],
                                      new ModalityStats(
                                          modality,
                                          (double)dr["AverageSeriesPerStudy"],
                                          (double)dr["StandardDeviationSeriesPerStudy"],
                                          (double)dr["AverageImagesPerSeries"],
                                          (double)dr["StandardDeviationImagesPerSeries"],
                                          r
                                          ));

                ModalityIndexes.Add(modality, idx++);
            }
        }
Ejemplo n.º 2
0
        private void InitializeTagValuesByModalityAndTag(Random r)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Frequency", typeof(int));

            DicomDataGenerator.EmbeddedCsvToDataTable(typeof(DicomDataGenerator), "DicomDataGeneratorTags.csv", dt);

            foreach (DataRow dr in dt.Rows)
            {
                var modality = (string)dr["Modality"];
                var tag      = DicomDictionary.Default[(string)dr["Tag"]];

                if (!TagValuesByModalityAndTag.ContainsKey(modality))
                {
                    TagValuesByModalityAndTag.Add(modality, new Dictionary <DicomTag, BucketList <string> >());
                }

                if (!TagValuesByModalityAndTag[modality].ContainsKey(tag))
                {
                    TagValuesByModalityAndTag[modality].Add(tag, new BucketList <string>(r));
                }

                int frequency = (int)dr["Frequency"];
                TagValuesByModalityAndTag[modality][tag].Add(frequency, (string)dr["Value"]);
            }
        }
Ejemplo n.º 3
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));
            }
        }