public bool InitializeOperation(IVideoController videoController, Panel controlPanel, IFramePlayer framePlayer, Form topForm) { m_Status = ConvertVideoToFitsState.Configuring; m_VideoController = (VideoController)videoController; // We don't allow loading of calibration frames for now. Doing so with complicate the export TangraContext.Current.CanLoadFlatFrame = false; TangraContext.Current.CanLoadDarkFrame = false; TangraContext.Current.CanLoadBiasFrame = false; if (m_ControlPanel == null) { lock (m_SyncRoot) { if (m_ControlPanel == null) { m_ControlPanel = new ucConvertVideoToFits(this, (VideoController)videoController); } } } controlPanel.Controls.Clear(); controlPanel.Controls.Add(m_ControlPanel); m_ControlPanel.Dock = DockStyle.Fill; return(true); }
private void FinishExport(string message) { m_ConvertVideoToFitsController.FinishExport(); m_ControlPanel.ExportFinished(); m_Status = ConvertVideoToFitsState.Finished; m_VideoController.ShowMessageBox(message, "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Information); }
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); }
internal void NextFrame(int frameNo, ConvertVideoToFitsState state) { m_CurrFrameNo = frameNo; if (state == ConvertVideoToFitsState.Configuring) { nudFirstFrame.SetNUDValue(frameNo); } else if (state == ConvertVideoToFitsState.Converting) { pbar.Value = Math.Max(Math.Min(frameNo, pbar.Maximum), pbar.Minimum); pbar.Update(); } }
public bool InitializeOperation(IVideoController videoController, Panel controlPanel, IFramePlayer framePlayer, Form topForm) { m_Status = ConvertVideoToFitsState.Configuring; m_VideoController = (VideoController)videoController; // We don't allow loading of calibration frames for now. Doing so with complicate the export TangraContext.Current.CanLoadFlatFrame = false; TangraContext.Current.CanLoadDarkFrame = false; TangraContext.Current.CanLoadBiasFrame = false; if (m_ControlPanel == null) { lock (m_SyncRoot) { if (m_ControlPanel == null) { m_ControlPanel = new ucConvertVideoToFits(this, (VideoController)videoController); } } } controlPanel.Controls.Clear(); controlPanel.Controls.Add(m_ControlPanel); m_ControlPanel.Dock = DockStyle.Fill; if (topForm.Height < 736) { // Make sure all controls of the panel are visible topForm.Height = 736; } var videoFileFormat = m_VideoController.GetVideoFileFormat(); if (videoFileFormat == VideoFileFormat.AAV && m_VideoController.CurrentFrameIndex == m_VideoController.VideoFirstFrame) { m_VideoController.StepForward(); } return(true); }
public bool HasEmbeddedTimeStamps(out bool hasDatePart) { hasDatePart = false; if (m_VideoController.HasEmbeddedTimeStamps()) { return(true); } m_VideoController.InitializeTimestampOCR(); if (m_VideoController.HasTimestampOCR()) { hasDatePart = m_VideoController.OCRTimeStampHasDatePart(); return(true); } else { m_Status = ConvertVideoToFitsState.EnteringTimes; return(false); } }
public void NextFrame(int frameNo, MovementType movementType, bool isLastFrame, AstroImage astroImage, int firstFrameInIntegrationPeriod, string fileName) { m_ControlPanel.NextFrame(frameNo, m_Status); if (m_Status == ConvertVideoToFitsState.Converting) { var timestamp = DateTime.MinValue; float exposureSeconds = 0; if (m_VideoController.HasTimestampOCR()) { m_OCRedTimeStamp = m_VideoController.OCRTimestamp(); timestamp = m_OCRedTimeStamp; if (m_AttachDateToOCR.HasValue) { timestamp = m_AttachDateToOCR.Value.Date.Add(timestamp.TimeOfDay); if (m_PrevOCRedTimeStamp.HasValue && m_PrevOCRedTimeStamp.Value > timestamp && timestamp.Hour == 23 && timestamp.Hour == 0) { timestamp = timestamp.AddDays(1); m_AttachDateToOCR = m_AttachDateToOCR.Value.AddDays(1); } } if (m_PrevOCRedTimeStamp.HasValue) { exposureSeconds = (float)new TimeSpan(timestamp.Ticks - m_PrevOCRedTimeStamp.Value.Ticks).TotalSeconds; } else { var nextTimeStamp = m_VideoController.GetNextFrameOCRTimestamp(); if (nextTimeStamp != DateTime.MinValue) { exposureSeconds = (float)new TimeSpan(nextTimeStamp.TimeOfDay.Ticks - timestamp.TimeOfDay.Ticks).TotalSeconds; } } m_PrevOCRedTimeStamp = timestamp; } else { if (m_VideoController.HasEmbeddedTimeStamps()) { timestamp = astroImage.Pixelmap.FrameState.CentralExposureTime; exposureSeconds = astroImage.Pixelmap.FrameState.ExposureInMilliseconds / 1000.0f; } else { timestamp = m_StartFrameTime.AddTicks((long)(frameNo - m_StartTimeFrame) * (m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) / (m_EndTimeFrame - m_StartTimeFrame)); exposureSeconds = (float)(new TimeSpan((m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) / (m_EndTimeFrame - m_StartTimeFrame)).TotalSeconds); } } m_ConvertVideoToFitsController.ProcessFrame(frameNo, astroImage, timestamp, exposureSeconds); if (isLastFrame || m_LastFrame == frameNo) { m_ConvertVideoToFitsController.FinishExport(); m_ControlPanel.ExportFinished(); m_Status = ConvertVideoToFitsState.Finished; m_VideoController.ShowMessageBox("Export completed.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (m_LastFrame == frameNo) { m_VideoController.StopVideo(); } } }
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); }
public void NextFrame(int frameNo, MovementType movementType, bool isLastFrame, AstroImage astroImage, int firstFrameInIntegrationPeriod, string fileName) { m_ControlPanel.NextFrame(frameNo, m_Status); if (m_Status == ConvertVideoToFitsState.Converting) { var timestamp = DateTime.MinValue; float exposureSeconds = 0; if (m_VideoController.HasTimestampOCR()) { m_OCRedTimeStamp = m_VideoController.OCRTimestamp(); timestamp = m_OCRedTimeStamp; if (m_PrevOCRedTimeStamp.HasValue) exposureSeconds = (float)new TimeSpan(timestamp.Ticks - m_PrevOCRedTimeStamp.Value.Ticks).TotalSeconds; m_PrevOCRedTimeStamp = timestamp; } else { if (m_VideoController.HasEmbeddedTimeStamps()) { timestamp = astroImage.Pixelmap.FrameState.CentralExposureTime; exposureSeconds = astroImage.Pixelmap.FrameState.ExposureInMilliseconds / 1000.0f; } else { timestamp = m_StartFrameTime.AddTicks((long)(frameNo - m_StartTimeFrame) * (m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) / (m_EndTimeFrame - m_StartTimeFrame)); exposureSeconds = (float)(new TimeSpan((m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) / (m_EndTimeFrame - m_StartTimeFrame)).TotalSeconds); } } m_ConvertVideoToFitsController.ProcessFrame(frameNo, astroImage, timestamp, exposureSeconds); if (isLastFrame || m_LastFrame == frameNo) { m_ConvertVideoToFitsController.FinishExport(); m_ControlPanel.ExportFinished(); m_Status = ConvertVideoToFitsState.Finished; m_VideoController.ShowMessageBox("Export completed.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (m_LastFrame == frameNo) m_VideoController.StopVideo(); } }
public bool InitializeOperation(IVideoController videoController, Panel controlPanel, IFramePlayer framePlayer, Form topForm) { m_Status = ConvertVideoToFitsState.Configuring; m_VideoController = (VideoController)videoController; // We don't allow loading of calibration frames for now. Doing so with complicate the export TangraContext.Current.CanLoadFlatFrame = false; TangraContext.Current.CanLoadDarkFrame = false; TangraContext.Current.CanLoadBiasFrame = false; if (m_ControlPanel == null) { lock (m_SyncRoot) { if (m_ControlPanel == null) { m_ControlPanel = new ucConvertVideoToFits(this, (VideoController)videoController); } } } controlPanel.Controls.Clear(); controlPanel.Controls.Add(m_ControlPanel); m_ControlPanel.Dock = DockStyle.Fill; return true; }
public bool HasEmbeddedTimeStamps() { if (m_VideoController.HasEmbeddedTimeStamps()) return true; m_VideoController.InitializeTimestampOCR(); if (m_VideoController.HasTimestampOCR()) return true; else { m_Status = ConvertVideoToFitsState.EnteringTimes; return false; } }