Beispiel #1
0
        /// <summary>
        /// Reads data from file.
        /// </summary>
        /// <param name="imData">Data container.</param>
        void ReadData(ImageData imData)
        {
            Rectangle rp = imData.Position;

            rp.Intersect(new Rectangle(0, 0, (int)Width - 1, (int)Height - 1));
            IntPtr Pointer;
            var    ImPos = GetPositionInFile(rp);

            Pointer = File.GetDataView(ImageNumber - 1, ImPos.Item1, ImPos.Item2);
            Reader(Pointer, imData.Data, rp.Y - imData.Position.Y, rp.Bottom - imData.Position.Y, rp.X - imData.Position.X, rp.Right - imData.Position.X, (int)Width * BytesPerPixel);
            File.ReleaseView(Pointer);

            double Scale = ReadHeaderFloat("BSCALE", 1, Header);
            double Zero  = ReadHeaderFloat("BZERO", 0, Header);

            for (int i = 0; i < imData.Data.GetLength(0); i++)
            {
                for (int j = 0; j < imData.Data.GetLength(1); j++)
                {
                    imData.Data[i, j] = imData.Data[i, j] * Scale + Zero;
                }
            }

            if (PropertiesDictionary.ContainsKey(typeof(KnownKeywords.SWarpScaling)))
            {
                (PropertiesDictionary[typeof(KnownKeywords.SWarpScaling)] as KnownKeywords.SWarpScaling).ScaleData(imData.Data);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Reads data from file.
        /// </summary>
        /// <param name="imData">Data container.</param>
        void ReadData(ImageData imData)
        {
            Rectangle rp = imData.Position;

            rp.Intersect(new Rectangle(0, 0, (int)Width - 1, (int)Height - 1));
            IntPtr Pointer;
            var    ImPos = GetPositionInFile(rp);

            Pointer = File.GetDataView(ImageNumber - 1, ImPos.Item1, ImPos.Item2);
            Reader(Pointer, imData.Data, rp.Y - imData.Position.Y, rp.Bottom - imData.Position.Y, rp.X - imData.Position.X, rp.Right - imData.Position.X, (int)Width * BytesPerPixel);
            File.ReleaseView(Pointer);

            if (PropertiesDictionary.ContainsKey(typeof(KnownKeywords.SWarpScaling)))
            {
                (PropertiesDictionary[typeof(KnownKeywords.SWarpScaling)] as KnownKeywords.SWarpScaling).ScaleData(imData.Data);
            }
        }