Пример #1
0
        public void Process()
        {
            System.IO.FileStream f = new System.IO.FileStream(BaseName + ".rwc", System.IO.FileMode.Open, System.IO.FileAccess.Read);
            SySal.Scanning.Plate.IO.OPERA.RawData.Catalog Cat = new SySal.Scanning.Plate.IO.OPERA.RawData.Catalog(f);
            f.Close();
            Exe.SFL.Load = new SySal.Scanning.PostProcessing.dLoadFragment(LoadFragment);
            SySal.Scanning.Plate.IO.OPERA.LinkedZone lz = Exe.SFL.Link(Cat);
            System.IO.FileStream g = new System.IO.FileStream(BaseName + ".tlg", System.IO.FileMode.Create, System.IO.FileAccess.Write);
            lz.Save(g);
            g.Flush();
            g.Close();
            double bestdlink = STol;

            SySal.Scanning.MIPBaseTrack besttrack = null;
            int i;

            for (i = 0; i < lz.Length; i++)
            {
                if (lz[i].Info.Count >= MinPts)
                {
                    double dsx, dsy, dlink;
                    dsx   = lz[i].Info.Slope.X - Sx;
                    dsy   = lz[i].Info.Slope.Y - Sy;
                    dlink = Math.Sqrt(dsx * dsx + dsy * dsy);
                    if (dlink < bestdlink)
                    {
                        besttrack = lz[i];
                        bestdlink = dlink;
                    }
                }
            }
            if (besttrack != null)
            {
                OutF.WriteLine("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} 1 {10} {11} {12} {13} {14} {15} {16} {17}",
                               Id.Part0, Id.Part1, Id.Part2, Id.Part3, Px, Py, Sx, Sy, PTol, STol,
                               besttrack.Info.Intercept.X, besttrack.Info.Intercept.Y, besttrack.Info.Slope.X, besttrack.Info.Slope.Y,
                               besttrack.Info.Intercept.X - Px, besttrack.Info.Intercept.Y - Py, besttrack.Info.Slope.X - Sx, besttrack.Info.Slope.Y - Sy);
            }
            else
            {
                OutF.WriteLine("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} 0 0 0 0 0 0 0 0 0",
                               Id.Part0, Id.Part1, Id.Part2, Id.Part3, Px, Py, Sx, Sy, PTol, STol);
            }
        }
Пример #2
0
        void ProcessData(string input, string output, string programsettings)
        {
            System.Xml.Serialization.XmlSerializer xmls = new System.Xml.Serialization.XmlSerializer(typeof(Config));
            Config C = (Config)xmls.Deserialize(new System.IO.StringReader(programsettings));

            SySal.Processing.FragShiftCorrection.FragmentShiftManager FSM = new SySal.Processing.FragShiftCorrection.FragmentShiftManager();
            FSM.Config = C.FragmentShiftCorrectionConfig;
            xmls.Serialize(Console.Out, C);
            Console.WriteLine();

            BaseName = input.ToLower().EndsWith(".rwc") ? (input.Substring(0, input.Length - 4)) : input;

            System.IO.FileStream f = new System.IO.FileStream(input, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            SySal.Scanning.Plate.IO.OPERA.RawData.Catalog Cat = new SySal.Scanning.Plate.IO.OPERA.RawData.Catalog(f);
            f.Close();

            LastPercent  = 0.0;
            FSM.Progress = new SySal.Scanning.PostProcessing.FieldShiftCorrection.dProgress(Progress);
            FSM.Load     = new SySal.Scanning.PostProcessing.FieldShiftCorrection.dLoad(LoadFragment);

            SySal.Scanning.PostProcessing.FieldShiftCorrection.FieldShift []      shifts;
            SySal.Scanning.PostProcessing.FieldShiftCorrection.FragmentCorrection Corr;
            FSM.ComputeFragmentCorrection(Cat, SySal.Scanning.PostProcessing.FieldShiftCorrection.FieldShift.SideValue.Both, out shifts, out Corr);
            SySal.Processing.FragShiftCorrection.LinearFragmentCorrectionWithHysteresis LHCorr = (SySal.Processing.FragShiftCorrection.LinearFragmentCorrectionWithHysteresis)Corr;

            System.IO.StreamWriter w = new System.IO.StreamWriter(output, false);
            xmls = new System.Xml.Serialization.XmlSerializer(typeof(SySal.Processing.FragShiftCorrection.LinearFragmentCorrectionWithHysteresis));
            xmls.Serialize(w, LHCorr);
            w.Flush();
            w.Close();

            Progress(100.0);

            GC.Collect();
            Console.WriteLine("Result written to: " + output);
        }