Exemple #1
0
        internal void Initialise(List <HeaderEntry> allCards, string fileHash, string cardsHash, FitsTimestampHelper timestampHelper)
        {
            m_AllCards        = allCards;
            m_FilesHash       = fileHash;
            m_CardNamesHash   = cardsHash;
            m_TimeStampHelper = timestampHelper;

            cbxTimeStamp.Items.AddRange(m_AllCards.ToArray());
            cbxSecondCard.Items.AddRange(m_AllCards.ToArray());

            cbxTimestampType.SelectedIndex = 0;

            UpdateControls();
        }
        internal void Initialise(List <HeaderEntry> allCards, string fileHash, string cardsHash, FitsTimestampHelper timestampHelper)
        {
            m_AllCards = allCards;
            m_AllCards.Sort((x, y) => string.Compare(x.Card.Key, y.Card.Key, StringComparison.InvariantCultureIgnoreCase));
            m_FilesHash       = fileHash;
            m_CardNamesHash   = cardsHash;
            m_TimeStampHelper = timestampHelper;

            cbxTimeStamp.Items.AddRange(m_AllCards.ToArray());
            cbxSecondCard.Items.AddRange(m_AllCards.ToArray());

            cbxTimestampType.SelectedIndex = 0;

            UpdateControls();
        }
Exemple #3
0
        public frmDefineFitsCube3D(BasicHDU imageHDU, string filesHash, VideoController videoController)
            : this()
        {
            m_VideoController = videoController;

            m_ImageHDU  = imageHDU;
            m_FilesHash = filesHash;

            var hasher = new SHA1CryptoServiceProvider();

            hasher.Initialize();
            var orderedCardNames = new List <string>();

            var cursor = m_ImageHDU.Header.GetCursor();

            while (cursor.MoveNext())
            {
                var card = m_ImageHDU.Header.FindCard((string)cursor.Key);
                if (card != null)
                {
                    m_AllCards.Add(new HeaderEntry(card));
                }
                orderedCardNames.Add((string)cursor.Key);
            }

            orderedCardNames.Sort();
            byte[] combinedCardNamesBytes = Encoding.UTF8.GetBytes(string.Join("|", orderedCardNames));
            var    hash = hasher.ComputeHash(combinedCardNamesBytes, 0, combinedCardNamesBytes.Length);

            m_CardNamesHash = Convert.ToBase64String(hash);

            cbxNaxisOrder.SelectedIndex = 0;
            cbxExposure.Items.AddRange(m_AllCards.ToArray());

            cbxExposureUnits.Items.Clear();
            cbxExposureUnits.Items.AddRange(Enum.GetNames(typeof(TangraConfig.ExposureUnit)));

            cbxExposureUnits.SelectedIndex = 0;

            m_TimeStampHelper = new FitsTimestampHelper(m_FilesHash, m_AllCards, UseRecentFitsConfig);
            ucTimestampControl.Initialise(m_AllCards, m_FilesHash, m_CardNamesHash, m_TimeStampHelper);
            m_TimeStampHelper.TryIdentifyPreviousConfigApplyingForCurrentFiles();
        }
Exemple #4
0
        public frmChooseTimeHeaders(string fileName, string filesHash, VideoController videoController)
            : this()
        {
            m_VideoController = videoController;

            FITSData fitsData;

            m_VideoController.SetCursor(Cursors.WaitCursor);
            try
            {
                fitsData = FITSHelper2.LoadFitsFile(fileName, null, 0);

                BZero           = FITSHelper2.GetBZero(fitsData.HDU);
                m_BelowZeroCorr = Math.Max(BZero, Math.Abs(fitsData.PixelStats.MinPixelValue) - BZero);

                fitsData = FITSHelper2.LoadFitsFile(fileName, null, BZero - m_BelowZeroCorr);
            }
            finally
            {
                m_VideoController.SetCursor(Cursors.Default);
            }

            m_FilesHash = filesHash;

            var hasher = new SHA1CryptoServiceProvider();

            hasher.Initialize();
            var orderedCardNames = new List <string>();

            var cursor = fitsData.HDU.Header.GetCursor();

            while (cursor.MoveNext())
            {
                var card = fitsData.HDU.Header.FindCard((string)cursor.Key);
                if (card != null)
                {
                    m_AllCards.Add(new HeaderEntry(card));
                }
                orderedCardNames.Add((string)cursor.Key);
            }

            orderedCardNames.Sort();
            byte[] combinedCardNamesBytes = Encoding.UTF8.GetBytes(string.Join("|", orderedCardNames));
            var    hash = hasher.ComputeHash(combinedCardNamesBytes, 0, combinedCardNamesBytes.Length);

            m_CardNamesHash = Convert.ToBase64String(hash);

            cbxExposure.Items.AddRange(m_AllCards.ToArray());

            cbxExposureUnits.Items.Clear();
            cbxExposureUnits.Items.AddRange(Enum.GetNames(typeof(TangraConfig.ExposureUnit)));
            cbxExposureUnits.SelectedIndex = 0;

            m_TimeStampHelper = new FitsTimestampHelper(m_FilesHash, m_AllCards, UseRecentFITSConfig);
            ucTimestampControl.Initialise(m_AllCards, m_FilesHash, m_CardNamesHash, m_TimeStampHelper);
            ucTimestampControl2.Initialise(m_AllCards, m_FilesHash, m_CardNamesHash, m_TimeStampHelper);
            ucTimestampControl2.SetTimeStampType(TangraConfig.TimeStampType.EndExposure, false);
            m_TimeStampHelper.TryIdentifyPreviousConfigApplyingForCurrentFiles();

            if (fitsData.PixelStats.HasNegativePixels)
            {
                NegPixCorrection = fitsData.PixelStats.MinPixelValue;
            }
            else
            {
                // No requirement to review the pixel mapping if there are no negative pixels
                // We can go with the defaults
                m_PixelMappingReviewed = true;
                NegPixCorrection       = 0;
            }

            Pixels            = fitsData.PixelsFlat;
            MinPixelValue     = fitsData.PixelStats.MinPixelValue;
            MaxPixelValue     = fitsData.PixelStats.MaxPixelValue;
            HasNegativePixels = fitsData.PixelStats.HasNegativePixels;
            BitPix            = fitsData.PixelStats.BitPix;
        }