Esempio n. 1
0
        public MasterSpectra(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            CombinedMeasurements = reader.ReadInt32();
            SignalAreaWidth      = reader.ReadInt32();
            MaxPixelValue        = reader.ReadUInt32();
            MaxSpectraValue      = reader.ReadUInt32();
            ZeroOrderPixelNo     = reader.ReadInt32();

            int pixelsCount = reader.ReadInt32();

            Points = new List <SpectraPoint>();
            for (int i = 0; i < pixelsCount; i++)
            {
                var point = new SpectraPoint(reader);
                Points.Add(point);
            }

            int width  = reader.ReadInt32();
            int height = reader.ReadInt32();

            Pixels = new float[width, height];
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    Pixels[x, y] = reader.ReadSingle();
                }
            }

            MeasurementInfo = new MeasurementInfo(reader);
            if (reader.ReadBoolean())
            {
                Calibration = new SpectraCalibration(reader);
            }

            int rawFramesCount = reader.ReadInt32();

            for (int i = 0; i < rawFramesCount; i++)
            {
                var frameMeasurement = new Spectra();
                RawMeasurements.Add(frameMeasurement);

                frameMeasurement.SignalAreaWidth  = reader.ReadInt32();
                frameMeasurement.MaxPixelValue    = reader.ReadUInt32();
                frameMeasurement.MaxSpectraValue  = reader.ReadUInt32();
                frameMeasurement.ZeroOrderPixelNo = reader.ReadInt32();

                frameMeasurement.ZeroOrderFWHM = float.NaN;
                if (version > 1)
                {
                    frameMeasurement.ZeroOrderFWHM = reader.ReadSingle();
                }

                int frameMeaCount = reader.ReadInt32();

                for (int j = 0; j < frameMeaCount; j++)
                {
                    var point = new SpectraPoint(reader);
                    frameMeasurement.Points.Add(point);
                }
            }

            ProcessingInfo  = new ProcessingInfo(reader);
            ObservationInfo = new ObservationInfo(reader);

            ZeroOrderFWHM = float.NaN;
            if (version > 1)
            {
                ZeroOrderFWHM = reader.ReadSingle();
            }
        }
Esempio n. 2
0
        public MasterSpectra(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            CombinedMeasurements = reader.ReadInt32();
            SignalAreaWidth = reader.ReadInt32();
            MaxPixelValue = reader.ReadUInt32();
            MaxSpectraValue = reader.ReadUInt32();
            ZeroOrderPixelNo = reader.ReadInt32();

            int pixelsCount = reader.ReadInt32();
            Points = new List<SpectraPoint>();
            for (int i = 0; i < pixelsCount; i++)
            {
                var point = new SpectraPoint(reader);
                Points.Add(point);
            }

            int width = reader.ReadInt32();
            int height = reader.ReadInt32();
            Pixels = new float[width,height];
            for (int x = 0; x < width; x++)
            for (int y = 0; y < height; y++)
            {
                Pixels[x, y] = reader.ReadSingle();
            }

            MeasurementInfo = new MeasurementInfo(reader);
            if (reader.ReadBoolean())
                Calibration = new SpectraCalibration(reader);

            int rawFramesCount = reader.ReadInt32();
            for (int i = 0; i < rawFramesCount; i++)
            {
                var frameMeasurement = new Spectra();
                RawMeasurements.Add(frameMeasurement);

                frameMeasurement.SignalAreaWidth = reader.ReadInt32();
                frameMeasurement.MaxPixelValue = reader.ReadUInt32();
                frameMeasurement.MaxSpectraValue = reader.ReadUInt32();
                frameMeasurement.ZeroOrderPixelNo = reader.ReadInt32();

                frameMeasurement.ZeroOrderFWHM = float.NaN;
                if (version > 1)
                {
                    frameMeasurement.ZeroOrderFWHM = reader.ReadSingle();
                }

                int frameMeaCount = reader.ReadInt32();

                for (int j = 0; j < frameMeaCount; j++)
                {
                    var point = new SpectraPoint(reader);
                    frameMeasurement.Points.Add(point);
                }
            }

            ProcessingInfo = new ProcessingInfo(reader);
            ObservationInfo = new ObservationInfo(reader);

            ZeroOrderFWHM = float.NaN;
            if (version > 1)
            {
                ZeroOrderFWHM = reader.ReadSingle();
            }
        }