Example #1
0
        public SeriesFormatAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_SERIESFORMAT, container)
        {
            series = (SeriesRecord)rs.GetNext();
            rs.GetNext();
            BRAIRecord       ai;
            SeriesTextRecord sText;

            while (rs.PeekNextChartSid() == BRAIRecord.sid)
            {
                sText = null;
                ai    = (BRAIRecord)rs.GetNext();
                if (rs.PeekNextChartSid() == SeriesTextRecord.sid)
                {
                    sText = (SeriesTextRecord)rs.GetNext();
                }
                dic4AI.Add(ai, sText);
            }
            if (rs.PeekNextChartSid() == DataFormatRecord.sid)
            {
                while (rs.PeekNextChartSid() == DataFormatRecord.sid)
                {
                    ssList.Add(new SSAggregate(rs, this));
                }
            }
            if (rs.PeekNextChartSid() == SerToCrtRecord.sid)
            {
                serToCrt = (SerToCrtRecord)rs.GetNext();
            }
            else
            {
                if (rs.PeekNextChartSid() == SerParentRecord.sid)
                {
                    serParent = (SerParentRecord)rs.GetNext();
                    if (rs.PeekNextChartSid() == SerAuxTrendRecord.sid)
                    {
                        serAuxTrend = (SerAuxTrendRecord)rs.GetNext();
                    }
                    else
                    {
                        serAuxErrBar = (SerAuxErrBarRecord)rs.GetNext();
                    }
                }
            }

            if (rs.PeekNextChartSid() == LegendExceptionRecord.sid)
            {
                while (rs.PeekNextChartSid() == LegendExceptionRecord.sid)
                {
                    leList.Add(new LegendExceptionAggregate(rs, this));
                }
            }

            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
Example #2
0
        private static SeriesRecord ToSeries(DicomDataset record)
        {
            SeriesRecord series = new SeriesRecord();

            series.SeriesUID    = record.GetSingleValue <string>(DicomTag.SeriesInstanceUID);
            series.SeriesNumber = record.GetSingleValueOrDefault <string>(DicomTag.SeriesNumber, null);
            series.SeriesDate   = record.GetSingleValueOrDefault <string>(DicomTag.SeriesDate, null);
            series.SeriesTime   = record.GetSingleValueOrDefault <string>(DicomTag.SeriesTime, null);
            series.Modality     = record.GetSingleValueOrDefault <string>(DicomTag.Modality, null);
            return(series);
        }
Example #3
0
        private static SeriesRecord CreateSeriesRecord()
        {
            SeriesRecord r = new SeriesRecord();

            r.CategoryDataType = (SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC);
            r.ValuesDataType   = (SeriesRecord.VALUES_DATA_TYPE_NUMERIC);
            r.NumCategories    = ((short)32);
            r.NumValues        = ((short)31);
            r.BubbleSeriesType = (SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC);
            r.NumBubbleValues  = ((short)0);
            return(r);
        }
        public void TestLoad()
        {

            SeriesRecord record = new SeriesRecord(TestcaseRecordInputStream.Create(0x1003, data));
            Assert.AreEqual(SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, record.CategoryDataType);
            Assert.AreEqual(SeriesRecord.VALUES_DATA_TYPE_NUMERIC, record.ValuesDataType);
            Assert.AreEqual(27, record.NumCategories);
            Assert.AreEqual(27, record.NumValues);
            Assert.AreEqual(SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC, record.BubbleSeriesType);
            Assert.AreEqual(0, record.NumBubbleValues);


            Assert.AreEqual(16, record.RecordSize);
        }
Example #5
0
        public void TestLoad()
        {
            SeriesRecord record = new SeriesRecord(TestcaseRecordInputStream.Create(0x1003, data));

            Assert.AreEqual(SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, record.CategoryDataType);
            Assert.AreEqual(SeriesRecord.VALUES_DATA_TYPE_NUMERIC, record.ValuesDataType);
            Assert.AreEqual(27, record.NumCategories);
            Assert.AreEqual(27, record.NumValues);
            Assert.AreEqual(SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC, record.BubbleSeriesType);
            Assert.AreEqual(0, record.NumBubbleValues);


            Assert.AreEqual(16, record.RecordSize);
        }
        public void TestStore()
        {
            SeriesRecord record = new SeriesRecord();
            record.CategoryDataType = (SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC);
            record.ValuesDataType = (SeriesRecord.VALUES_DATA_TYPE_NUMERIC);
            record.NumCategories = ((short)27);
            record.NumValues = ((short)27);
            record.BubbleSeriesType = (SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC);
            record.NumBubbleValues = ((short)0);

            byte[] recordBytes = record.Serialize();
            Assert.AreEqual(recordBytes.Length - 4, data.Length);
            for (int i = 0; i < data.Length; i++)
                Assert.AreEqual(data[i], recordBytes[i + 4], "At offset " + i);
        }
Example #7
0
        /// <summary>
        /// Create a series record from <see cref="DicomDataset"/>.
        /// </summary>
        /// <param name="dcmData"><see cref="DicomDataset"/></param>
        /// <returns>Series record <see cref="{DataModel.SeriesRecord}"/></returns>
        public static SeriesRecord CreateSeries(this DicomDataset dcmData)
        {
            string studyUID  = dcmData.GetString(DicomTag.StudyInstanceUID);
            string seriesUID = dcmData.Get <string>(DicomTag.SeriesInstanceUID);
            var    record    = new SeriesRecord(seriesUID, studyUID);                             // 0, 1

            record.SeriesNumber = dcmData.Get <string>(DicomTag.SeriesNumber, 0, null);           // 2
            record.SeriesType   = dcmData.Get <string>(DicomTag.SeriesType, 0, null);             //  3
            record.ImageCount   = dcmData.Get <ushort>(new DicomTag(0x1011, 0x0008), 0, 0);       // 4

            record.Kernel            = dcmData.Get <string>(DicomTag.ConvolutionKernel, 0, null); // 5
            record.SeriesDescription = dcmData.Get <string>(DicomTag.SeriesDescription, 0, null); // 6
            record.ProtocolName      = dcmData.Get <string>(DicomTag.ProtocolName, 0, null);      // 7
            record.BodyPartExamined  = dcmData.Get <string>(DicomTag.BodyPartExamined, 0, null);  // 8

            return(record);
        }
Example #8
0
        public void TestStore()
        {
            SeriesRecord record = new SeriesRecord();

            record.CategoryDataType = (SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC);
            record.ValuesDataType   = (SeriesRecord.VALUES_DATA_TYPE_NUMERIC);
            record.NumCategories    = ((short)27);
            record.NumValues        = ((short)27);
            record.BubbleSeriesType = (SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC);
            record.NumBubbleValues  = ((short)0);

            byte[] recordBytes = record.Serialize();
            Assert.AreEqual(recordBytes.Length - 4, data.Length);
            for (int i = 0; i < data.Length; i++)
            {
                Assert.AreEqual(data[i], recordBytes[i + 4], "At offset " + i);
            }
        }
        public static void SaveSeria(ETS_Data.Series series, FileStream stream)
        {
            using (StreamWriter sr = new StreamWriter(stream))
            {
                //Name
                sr.WriteLine("Seria name;" + series.Name + ";");
                //Config
                SeriesConfig config = series.Config;
                sr.WriteLine("Config;");
                sr.WriteLine("Name;" + config.Name + ";");
                sr.WriteLine("Max interval;" + config.MaxInt + ";");
                sr.WriteLine("Min interval;" + config.MinInt + ";");
                sr.WriteLine("Order type;" + config.StringOrderType + ";");
                sr.WriteLine("Text before;" + config.TextBefore + ";");
                sr.WriteLine("Text after;" + config.TextAfter + ";");
                //Stimuluses
                sr.WriteLine("Stimuluses set;");
                sr.WriteLine("Name;Filename;Type;");
                foreach (Stimulus s in series.Config.StimulusSet)
                {
                    SerializeStimulus(s, sr);
                }
                //Templates
                for (int i = 0; i < series.Templates.Count; i++)
                {
                    Template t = (Template)series.Templates[i];
                    sr.WriteLine("Template;" + t.Name + ";");
                    ArrayList coords = (ArrayList)series.TemplateCoords[i];
                    sr.Write("Time;");
                    for (int j = 0; j < coords.Count; j++)
                    {
                        SeriesRecord r = (SeriesRecord)coords[j];
                        if (r != null)
                        {
                            sr.Write(Util.MsToStandardTimeRepresentation((int)r.Time) + ";");
                        }
                    }
                    sr.WriteLine();
                    sr.Write("X;");
                    for (int j = 0; j < coords.Count; j++)
                    {
                        SeriesRecord r = (SeriesRecord)coords[j];
                        if (r != null)
                        {
                            sr.Write(r.X + ";");
                        }
                    }
                    sr.WriteLine();
                    sr.Write("Y;");
                    for (int j = 0; j < coords.Count; j++)
                    {
                        SeriesRecord r = (SeriesRecord)coords[j];
                        if (r != null)
                        {
                            sr.Write(r.Y + ";");
                        }
                    }
                    sr.WriteLine();
                }
                if (series.TemplateCoords.Count > 0)
                {
                    ArrayList coords = (ArrayList)series.TemplateCoords[0];
                    if (coords.Count > 0)
                    {
                        sr.Write("Stimuluses;");

                        for (int j = 0; j < coords.Count; j++)
                        {
                            SeriesRecord r    = (SeriesRecord)coords[j];
                            int          time = (int)r.Time;
                            Stimulus     s    = series.GetStimulusForTime(time);
                            if (s == null)
                            {
                                sr.Write(";");
                            }
                            else
                            {
                                sr.Write(s.Name + ";");
                            }
                        }
                    }
                }
            }
            try
            {
                stream.Close();
            }
            catch (Exception e)
            {
            }
        }
Example #10
0
 private SeriesRecord CreateSeriesRecord()
 {
     SeriesRecord r = new SeriesRecord();
     r.CategoryDataType = (SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC);
     r.ValuesDataType = (SeriesRecord.VALUES_DATA_TYPE_NUMERIC);
     r.NumCategories = ((short)32);
     r.NumValues = ((short)31);
     r.BubbleSeriesType = (SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC);
     r.NumBubbleValues = ((short)0);
     return r;
 }
Example #11
0
 /* package */
 public HSSFSeries(SeriesRecord series)
 {
     this.series = series;
 }
Example #12
0
		/* package */ HSSFSeries(SeriesRecord series) {
			this.series = series;
		}