Ejemplo n.º 1
0
        public ImageArray(int xSize, int ySize)
        //Open a new integer array without a file connection
        //  get and store the width and height in pixels for changes
        //  close the TSX window
        {
            //Might want to check for excessively large array here
            ccdsoftImage tsx_im = new ccdsoftImage();

            tsx_im.New(xSize, ySize, pixeldepth);
            var img = tsx_im.DataArray;
            var pix = new int[img.Length];

            for (int i = 0; i < img.Length; i++)
            {
                pix[i] = Convert.ToInt32(img[i]);
            }
            imagePixels          = pix;
            pixelSizeX           = tsx_im.WidthInPixels;
            pixelSizeY           = tsx_im.HeightInPixels;
            tsx_im.DetachOnClose = 0;
            tsx_im.Close();
            tsx_im = null;
            pix    = null;
            GC.Collect();
            return;
        }
Ejemplo n.º 2
0
        public void Store(string filepath)
        //Saves the image data as a new file through TSX
        //Adjust to 256 bit depth because TSX DataArray is still broken
        //  Change later
        {
            double       bitdepth = 256;
            ccdsoftImage tsx_im   = new ccdsoftImage();

            tsx_im.New(pixelSizeX, pixelSizeY, pixeldepth);
            var imgarr = tsx_im.DataArray;

            for (int i = 0; i < imagePixels.Length; i++)
            {
                imgarr[i] = imagePixels[i] / bitdepth;
            }
            tsx_im.DataArray = imgarr;
            tsx_im.Path      = filepath;
            tsx_im.Save();
            tsx_im.DetachOnClose = 0;
            tsx_im.Close();
            tsx_im = null;
            GC.Collect();
            return;
        }