internal void StartExport(string fileName, bool fitsCube, Rectangle roi, UsedTimeBase timeBase, bool usesOCR, bool ocrHasDatePart) { m_FrameWidth = TangraContext.Current.FrameWidth; m_FrameHeight = TangraContext.Current.FrameHeight; m_IsFitsSequence = m_VideoController.IsFitsSequence; m_RegionOfInterest = roi; m_UsesROI = roi.Width != m_FrameWidth || roi.Height != m_FrameHeight; m_FitsCube = fitsCube; if (!fitsCube) { m_FolderName = fileName; if (!Directory.Exists(m_FolderName)) { Directory.CreateDirectory(m_FolderName); } } m_Note = string.Format("Converted from {0} file.", m_VideoController.GetVideoFileFormat()); if (m_Note.Length > HeaderCard.MAX_VALUE_LENGTH) { m_Note = m_Note.Substring(0, HeaderCard.MAX_VALUE_LENGTH); } if (m_UsesROI) { m_Note += string.Format(" Selected ROI: ({0},{1},{2},{3})", roi.Left, roi.Top, roi.Right, roi.Bottom); if (m_Note.Length > HeaderCard.MAX_VALUE_LENGTH) { m_Note = m_Note.Substring(0, HeaderCard.MAX_VALUE_LENGTH); } } if (timeBase == UsedTimeBase.UserEnterred) { m_DateObsComment = "Date and Time are user entered & computed"; } else if (timeBase == UsedTimeBase.EmbeddedTimeStamp) { if (usesOCR) { if (ocrHasDatePart) { m_DateObsComment = "Date and Time are ORC-ed"; } else { m_DateObsComment = "Time is ORC-ed, Date is user entered"; } } else if (!m_IsFitsSequence) { m_DateObsComment = "Date and Time are saved by recorder"; } } }
private void StartExport(UsedTimeBase timeBase) { var roiSelector = m_VideoController.CurrentImageTool as RoiSelector; Rectangle rect = (rbROI.Checked && roiSelector != null) ? roiSelector.SelectedROI : new Rectangle(0, 0, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight); if (rect.Width < 1 || rect.Height < 1) { m_VideoController.ShowMessageBox("Error in ROI size.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string selectedPath; if (m_VideoController.ShowBrowseFolderDialog("Select Output Directory", TangraConfig.Settings.LastUsed.FitsExportLastFolderLocation, out selectedPath) == DialogResult.OK) { btnExport.Enabled = false; if (roiSelector != null) { roiSelector.Enabled = false; } gbxFormat.Enabled = false; gbxFrameSize.Enabled = false; gbxSection.Enabled = false; pbar.Minimum = (int)nudFirstFrame.Value; pbar.Maximum = (int)nudLastFrame.Value; pbar.Visible = true; pnlEnterTimes.Visible = false; TangraConfig.Settings.LastUsed.FitsExportLastFolderLocation = selectedPath; TangraConfig.Settings.Save(); m_Operation.StartExport( selectedPath, rbCube.Checked, (int)nudFirstFrame.Value, (int)nudLastFrame.Value, INDEX_TO_VAL_MAP[cbxEveryFrame.SelectedIndex], rect, timeBase); } }
internal void StartExport(string fileName, bool fitsCube, int firstFrame, int lastFrame, int step, Rectangle roi, UsedTimeBase timeBase) { m_Status = ConvertVideoToFitsState.Converting; m_FirstFrame = firstFrame; m_LastFrame = lastFrame; m_ConvertVideoToFitsController.StartExport(fileName, fitsCube, roi, timeBase, m_VideoController.HasTimestampOCR(), m_VideoController.OCRTimeStampHasDatePart()); m_VideoController.PlayVideo(m_FirstFrame, (uint)step); }
public void ShowLightCurve(UsedTimeBase timebase) { if (m_VideoController.IsAstroAnalogueVideo && timebase != UsedTimeBase.NoTimesBaseAvailable) { List<string> cameras = InstrumentalDelayConfigManager.GetAvailableCameras(); var frm = new frmInstDelayConfigChooser(); frm.SetCameraModels(cameras, m_VideoController.AstroVideoCameraModel, m_VideoController.AstroVideoNativeVideoStandard); if (m_VideoController.ShowDialog(frm) == DialogResult.OK) { m_InstumentalDelaySelectedCamera = frm.SelectedCamera; if (m_InstumentalDelaySelectedCamera != null) m_InstumentalDelaySelectedConfig = InstrumentalDelayConfigManager.GetConfigurationForCamera(m_InstumentalDelaySelectedCamera); else m_InstumentalDelaySelectedConfig = null; } } LCFile file = FlushLightCurveFile(); if (file.Header.ReductionType == LightCurveReductionType.Asteroidal) UsageStats.Instance.TrackedAsteroidals++; else if (file.Header.ReductionType == LightCurveReductionType.MutualEvent) UsageStats.Instance.TrackedMutualEvents++; else if (file.Header.ReductionType == LightCurveReductionType.UntrackedMeasurement) UsageStats.Instance.UntrackedMeasurements++; else if (file.Header.ReductionType == LightCurveReductionType.TotalLunarDisappearance || file.Header.ReductionType == LightCurveReductionType.TotalLunarReppearance || file.Header.ReductionType == LightCurveReductionType.LunarGrazingOccultation) UsageStats.Instance.TotalLunarMeasurements++; if (TangraConfig.Settings.Tracking.SelectedEngine == TangraConfig.TrackingEngine.TrackingWithRefining) UsageStats.Instance.TrackingWithRecoverUsed++; else if (TangraConfig.Settings.Tracking.SelectedEngine == TangraConfig.TrackingEngine.AdHocTracking) UsageStats.Instance.SimplifiedTrackingUsed++; else if (TangraConfig.Settings.Tracking.SelectedEngine == TangraConfig.TrackingEngine.LetTangraChoose) UsageStats.Instance.AutomaticTrackingUsed++; if (file.Footer.ReductionContext.FullDisappearance) UsageStats.Instance.FullDisappearanceFlag++; if (file.Footer.ReductionContext.WindOrShaking) UsageStats.Instance.WindOrShakingFlag++; if (file.Footer.ReductionContext.HighFlickeringOrLargeStars) UsageStats.Instance.FlickeringFlag++; if (file.Footer.ReductionContext.FieldRotation) UsageStats.Instance.FieldRotationFlag++; if (file.Footer.ReductionContext.IsDriftThrough) UsageStats.Instance.DriftThroughFlag++; if (file.Footer.ReductionContext.NumberFramesToIntegrate > 1) UsageStats.Instance.SoftwareIntegrationUsed++; if (Math.Abs(TangraConfig.Settings.Photometry.EncodingGamma - 1) > 0.01) UsageStats.Instance.ReverseGammaUsed++; if (TangraConfig.Settings.Photometry.KnownCameraResponse != TangraConfig.KnownCameraResponse.Undefined) UsageStats.Instance.ReverseCameraResponseUsed++; if (file.Footer.ReductionContext.UseClipping || file.Footer.ReductionContext.UseStretching || file.Footer.ReductionContext.UseBrightnessContrast) UsageStats.Instance.PreProcessingUsed++; if (file.Footer.ReductionContext.DigitalFilter != TangraConfig.PreProcessingFilter.NoFilter) UsageStats.Instance.DigitalFilterUsed++; if (file.Footer.ReductionContext.ReductionMethod == TangraConfig.PhotometryReductionMethod.AperturePhotometry) UsageStats.Instance.AperturePhotometry++; if (file.Footer.ReductionContext.ReductionMethod == TangraConfig.PhotometryReductionMethod.PsfPhotometry) UsageStats.Instance.PSFPhotometryUsed++; if (file.Footer.ReductionContext.ReductionMethod == TangraConfig.PhotometryReductionMethod.OptimalExtraction) UsageStats.Instance.OptimalExtractionUsed++; if (file.Footer.ReductionContext.NoiseMethod == TangraConfig.BackgroundMethod.AverageBackground) UsageStats.Instance.AverageBackgroundUsed++; if (file.Footer.ReductionContext.NoiseMethod == TangraConfig.BackgroundMethod.BackgroundMode) UsageStats.Instance.BackgroundModeUsed++; if (file.Footer.ReductionContext.NoiseMethod == TangraConfig.BackgroundMethod.Background3DPolynomial) UsageStats.Instance._3DPolynomialFitUsed++; if (file.Footer.ReductionContext.NoiseMethod == TangraConfig.BackgroundMethod.PSFBackground) UsageStats.Instance.PSFFittingBackgroundUsed++; if (file.Footer.ReductionContext.NoiseMethod == TangraConfig.BackgroundMethod.BackgroundMedian) UsageStats.Instance.MedianBackgroundUsed++; UsageStats.Instance.TrackedObjects += file.Header.ObjectCount; UsageStats.Instance.TrackedFrames += file.Header.CountFrames; UsageStats.Instance.FramesWithBadTracking += m_NumberFramesWithBadTracking; m_VideoController.UpdateOCRStatistics(); UsageStats.Instance.Save(); m_Measuring = false; m_Refining = false; m_ViewingLightCurve = true; m_Configuring = false; m_StateMachine.ChangeState(LightCurvesState.Viewing); m_VideoController.InitializePlayingDirection(false); DoShowLightCurve(file); m_ControlPanel.SetupLCFileInfo(m_LightCurveController.LcFile); m_ControlPanel.UpdateState(); m_VideoController.SubmitOCRErrorsIfAny(); }
internal void StartExport(string fileName, bool fitsCube, Rectangle roi, UsedTimeBase timeBase, bool usesOCR, bool ocrHasDatePart) { m_FrameWidth = TangraContext.Current.FrameWidth; m_FrameHeight = TangraContext.Current.FrameHeight; m_IsFitsSequence = m_VideoController.IsFitsSequence; if (m_VideoController.IsAstroAnalogueVideo) { m_IntegrationRate = m_VideoController.AstroAnalogueVideoIntegratedAAVFrames; } else { m_IntegrationRate = 0; } m_NativeFormat = m_VideoController.GetVideoFormat(m_VideoController.GetVideoFileFormat()); m_VideoCamera = m_VideoController.AstroVideoCameraModel; m_RegionOfInterest = roi; m_UsesROI = roi.Width != m_FrameWidth || roi.Height != m_FrameHeight; m_ExportAs8BitFloat = false; m_NormalValue = m_VideoController.EffectiveMaxPixelValue; m_VideoFormat = m_VideoController.GetVideoFileFormat(); if (m_VideoFormat == VideoFileFormat.AAV || m_VideoFormat == VideoFileFormat.AAV2 || m_VideoFormat == VideoFileFormat.AVI) { if (m_VideoController.VideoBitPix == 8 || m_VideoController.EffectiveMaxPixelValue > 255) { // For video from analogue cameras we export as 8-bit floating point numbers m_ExportAs8BitFloat = true; } } m_AdditionalFileHeaders.Clear(); var fileHeaderProvider = m_VideoController.FramePlayer.Video as IFileHeaderProvider; if (fileHeaderProvider != null) { var AAV_HEADERS = new Dictionary <string, string> { { "LATITUDE", "LATITUDE" }, { "LONGITUDE", "LONGITUD" }, { "OBSERVER", "OBSERVER" }, { "TELESCOP", "TELESCOP" }, { "OBJECT", "OBJECT" }, { "RA_OBJ", "RA_OBJ" }, { "DEC_OBJ", "DEC_OBJ" }, { "RECORDER-SOFTWARE", "REC-SOFT" }, { "RECORDER-SOFTWARE-VERSION", "REC-VER" }, { "ADVLIB-VERSION", "ADVLIB" } }; var coppiedFromHeaderDescription = string.Format("Copied from {0} file headers", m_VideoFormat); var fileHeaders = fileHeaderProvider.GetFileHeaders(); fileHeaders .Where(kvp => AAV_HEADERS.ContainsKey(kvp.Key)) .Select(kvp => kvp) .ToList() .ForEach(kvp => m_AdditionalFileHeaders[AAV_HEADERS[kvp.Key]] = Tuple.Create(kvp.Value, coppiedFromHeaderDescription)); if (m_VideoFormat == VideoFileFormat.AAV || m_VideoFormat == VideoFileFormat.AAV2) { var camera = m_VideoCamera; if (camera.IndexOf(m_NativeFormat, StringComparison.InvariantCultureIgnoreCase) == -1) { camera = camera.Trim() + string.Format(" ({0})", m_NativeFormat); } var instumentalDelaySelectedConfig = InstrumentalDelayConfigManager.GetConfigurationForCamera(camera); float instDelay; if (instumentalDelaySelectedConfig.TryGetValue(m_VideoController.AstroAnalogueVideoIntegratedAAVFrames, out instDelay)) { m_AdditionalFileHeaders["INSTDELY"] = Tuple.Create( instDelay.ToString(CultureInfo.InvariantCulture), string.Format("Instr. delay in sec. for x{0} frames integration for '{1}' camera. This has not been applied to DATE-OBS", m_VideoController.AstroAnalogueVideoIntegratedAAVFrames, camera)); } } } m_FitsCube = fitsCube; if (!fitsCube) { m_FolderName = fileName; if (!Directory.Exists(m_FolderName)) { Directory.CreateDirectory(m_FolderName); } } m_Note = string.Format("Converted from {0} file.", m_VideoController.GetVideoFileFormat()); if (m_Note.Length > HeaderCard.MAX_VALUE_LENGTH) { m_Note = m_Note.Substring(0, HeaderCard.MAX_VALUE_LENGTH); } if (m_UsesROI) { m_Note += string.Format(" Selected ROI: ({0},{1},{2},{3})", roi.Left, roi.Top, roi.Right, roi.Bottom); if (m_Note.Length > HeaderCard.MAX_VALUE_LENGTH) { m_Note = m_Note.Substring(0, HeaderCard.MAX_VALUE_LENGTH); } } if (timeBase == UsedTimeBase.UserEnterred) { m_DateObsComment = "Date and Time are user entered & computed"; } else if (timeBase == UsedTimeBase.EmbeddedTimeStamp) { if (usesOCR) { if (ocrHasDatePart) { m_DateObsComment = "Date and Time are ORC-ed"; } else { m_DateObsComment = "Time is ORC-ed, Date is user entered"; } } else if (!m_IsFitsSequence) { m_DateObsComment = "Date and Time are saved by recorder"; } } }
private void StartExport(UsedTimeBase timeBase) { var roiSelector = m_VideoController.CurrentImageTool as RoiSelector; Rectangle rect = (rbROI.Checked && roiSelector != null) ? roiSelector.SelectedROI : new Rectangle(0, 0, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight); if (rect.Width < 1 || rect.Height < 1) { m_VideoController.ShowMessageBox("Error in ROI size.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (folderBrowserDialog.ShowDialog(this) == DialogResult.OK) { btnExport.Enabled = false; if (roiSelector != null) roiSelector.Enabled = false; gbxFormat.Enabled = false; gbxFrameSize.Enabled = false; gbxSection.Enabled = false; pbar.Minimum = (int)nudFirstFrame.Value; pbar.Maximum = (int)nudLastFrame.Value; pbar.Visible = true; pnlEnterTimes.Visible = false; m_Operation.StartExport( folderBrowserDialog.SelectedPath, rbCube.Checked, (int)nudFirstFrame.Value, (int)nudLastFrame.Value, INDEX_TO_VAL_MAP[cbxEveryFrame.SelectedIndex], rect, timeBase); } }
internal void StartExport(string fileName, bool fitsCube, Rectangle roi, UsedTimeBase timeBase, bool usesOCR) { m_FrameWidth = TangraContext.Current.FrameWidth; m_FrameHeight = TangraContext.Current.FrameHeight; m_RegionOfInterest = roi; m_UsesROI = roi.Width != m_FrameWidth || roi.Height != m_FrameHeight; m_FitsCube = fitsCube; if (!fitsCube) { m_FolderName = fileName; if (!Directory.Exists(m_FolderName)) Directory.CreateDirectory(m_FolderName); } m_Note = string.Format("Converted from {0} file.", m_VideoController.GetVideoFileFormat()); if (m_Note.Length > HeaderCard.MAX_VALUE_LENGTH) m_Note = m_Note.Substring(0, HeaderCard.MAX_VALUE_LENGTH); m_DateObsComment = "Date (yyyy-MM-dd)"; m_TimeObsComment = "Time (HH:mm:ss.fff)"; if (m_UsesROI) { m_Note += string.Format(" Selected ROI: ({0},{1},{2},{3})", roi.Left, roi.Top, roi.Right, roi.Bottom); if (m_Note.Length > HeaderCard.MAX_VALUE_LENGTH) m_Note = m_Note.Substring(0, HeaderCard.MAX_VALUE_LENGTH); } if (timeBase == UsedTimeBase.UserEnterred) { m_DateObsComment = "Date based on user entered VTI-OSD of a reference frame (yyyy-MM-dd)"; m_TimeObsComment = "Time based on user entered VTI-OSD of a reference frame (HH:mm:ss.fff)"; } else if (timeBase == UsedTimeBase.EmbeddedTimeStamp) { if (usesOCR) { m_DateObsComment = "Date based on the ORC-ed VTI-OSD timestamp of the frame (yyyy-MM-dd)"; m_TimeObsComment = "Time based on the ORC-ed VTI-OSD timestamp of the frame (HH:mm:ss.fff)"; } else { m_DateObsComment = "Date of the frame as saved by the video recorder (yyyy-MM-dd)"; m_TimeObsComment = "Time of the frame as saved by the video recorder (HH:mm:ss.fff)"; } } }
internal void StartExport(string fileName, bool fitsCube, int firstFrame, int lastFrame, int step, Rectangle roi, UsedTimeBase timeBase) { m_Status = ConvertVideoToFitsState.Converting; m_FirstFrame = firstFrame; m_LastFrame = lastFrame; m_ConvertVideoToFitsController.StartExport(fileName, fitsCube, roi, timeBase, m_VideoController.HasTimestampOCR()); m_VideoController.PlayVideo(m_FirstFrame, (uint)step); }