Esempio n. 1
0
        private void DebugPlotImage(FitsDataModel fits)
        {
            FitsEntry primary = fits.GetPrimary();

            int width  = primary.GetParam <int>("NAXIS1");
            int height = primary.GetParam <int>("NAXIS2");
            int bpp    = primary.GetParam <int>("BITPIX") / 8;

            Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    byte b1     = primary.data[(y * width + x) * bpp + 0];
                    byte b2     = primary.data[(y * width + x) * bpp + 1];
                    int  val    = ((int)b1 << 8) | b2;
                    int  rgbVal = 255 - b2;

                    bitmap.SetPixel(x, y, Color.FromArgb(rgbVal, rgbVal, rgbVal));
                }
            }

            pictureBox2.Image = bitmap;
            pictureBox2.Invalidate();
        }
Esempio n. 2
0
        private void loadFITSToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialogFits.ShowDialog() == DialogResult.OK)
            {
                byte[]        fitsData = File.ReadAllBytes(openFileDialogFits.FileName);
                FitsDataModel fits     = new FitsDataModel(fitsData);

                fits.Dump();
                DebugPlotImage(fits);
            }
        }