internal void IndexEntry(int id, ref SySal.Scanning.Plate.IO.OPERA.LinkedZone.TrackIndexEntry tie) { s.Seek(TrackIndex_SP + id * MIPIndexedEmulsionTrack.IndexSize, System.IO.SeekOrigin.Begin); tie.Fragment = r.ReadInt32(); tie.View = r.ReadInt32(); tie.Track = r.ReadInt32(); }
public void AddMIPEmulsionTrack(SySal.Tracking.MIPEmulsionTrackInfo info, int id, int viewid, SySal.Scanning.Plate.IO.OPERA.LinkedZone.TrackIndexEntry tie, bool istop) { System.IO.FileStream t_strtk, t_strix; System.IO.BinaryWriter b_strtk, b_strix; int strtks = 0; if (istop) { t_strtk = t_toptk; b_strtk = b_toptk; t_strix = t_topix; b_strix = b_topix; strtks = toptks; } else { t_strtk = t_bottk; b_strtk = b_bottk; t_strix = t_botix; b_strix = b_botix; strtks = bottks; } if (id < 0) { throw new Exception("Only positive Ids are accepted. " + id + " is rejected."); } if (id >= strtks) { t_strtk.Seek(0, System.IO.SeekOrigin.End); t_strix.Seek(0, System.IO.SeekOrigin.End); while (strtks < id) { b_strtk.Write(empty_tk); b_strix.Write(empty_ix); strtks++; } } else { t_strtk.Seek(((long)id) * MIPIndexedEmulsionTrack.Size, System.IO.SeekOrigin.Begin); t_strix.Seek(((long)id) * MIPIndexedEmulsionTrack.IndexSize, System.IO.SeekOrigin.Begin); } long chkpos = t_strtk.Position; b_strtk.Write(info.Field); b_strtk.Write(info.AreaSum); b_strtk.Write((uint)info.Count); b_strtk.Write(info.Intercept.X); b_strtk.Write(info.Intercept.Y); b_strtk.Write(info.Intercept.Z); b_strtk.Write(info.Slope.X); b_strtk.Write(info.Slope.Y); b_strtk.Write(info.Slope.Z); b_strtk.Write(info.Sigma); b_strtk.Write(info.TopZ); b_strtk.Write(info.BottomZ); b_strtk.Write(viewid); if (t_strtk.Position - chkpos != MIPIndexedEmulsionTrack.Size) { throw new Exception("B"); } chkpos = t_strix.Position; b_strix.Write(tie.Fragment); b_strix.Write(tie.View); b_strix.Write(tie.Track); if (t_strix.Position - chkpos != MIPIndexedEmulsionTrack.IndexSize) { throw new Exception("C"); } strtks = Math.Max(id + 1, strtks); if (istop) { toptks = strtks; } else { bottks = strtks; } }