public bool EnsureCentralImage(string Name, out FitsImage Image) { string ImagePath = Path.Combine(RunDir, Name + ".fits"); if (File.Exists(ImagePath)) { Image = new FitsImage(MMapFitsFile.OpenReadFile(ImagePath)); return(true); } FICHV values = Headers[0]; MMapFitsFile file = MMapFitsFile.OpenWriteFile(ImagePath, values.Header); Image = new FitsImage(file); return(false); }
private void DetectionDebugMap(string RunDir, int i, List <ImageDetection> LocalDetectionList, FitsImage DetectionSource) { FICHV Header = DetectionSource.CopyHeader().ChangeBitPix(16); MMapFitsFile DeOutput = MMapFitsFile.OpenWriteFile(RunDir + "DOutMap" + i.ToString() + ".fits", Header.Header); FitsImage DeOutIm = new FitsImage(DeOutput); var DeData = DeOutIm.LockData(new System.Drawing.Rectangle(0, 0, (int)DetectionSource.Width, (int)DetectionSource.Height), false, false); foreach (ImageDetection xi in LocalDetectionList) { int kat = 200 + LocalDetectionList.IndexOf(xi); if (xi.TryFetchProperty(out ObjectPoints pts)) { foreach (var pt in pts.PixelPoints) { try { DeData.Data[(int)pt.Y, (int)pt.X] = kat; } catch { break; } } } } DeOutIm.ExitLock(DeData); Logger("Exported detections map"); }