Exemplo n.º 1
0
    static void Main()
    {
        Sc  sc = new Sc();
        int n  = sc.I;

        int[][] a = new int[n][];
        int     p = 0;

        double[] ans = new double[n];
        for (int i = 0; i < n; i++)
        {
            a[i] = sc.Ia;
            if (a[i][1] < a[p][1])
            {
                p = i;
            }
        }
        Gs  gs = new Gs(a, p);
        int m  = gs.li.Count - 1;

        for (int i = 1; i < m; i++)
        {
            ans[gs.li[i].n] = 1.0 * (180 - Gp4(gs.li[i - 1].x, gs.li[i - 1].y, gs.li[i].x, gs.li[i].y, gs.li[i + 1].x, gs.li[i + 1].y)) / 360;
        }
        ans[gs.li[0].n] = 1.0 * (180 - Gp4(gs.li[m].x, gs.li[m].y, gs.li[0].x, gs.li[0].y, gs.li[1].x, gs.li[1].y)) / 360;
        ans[gs.li[m].n] = 1.0 * (180 - Gp4(gs.li[m - 1].x, gs.li[m - 1].y, gs.li[m].x, gs.li[m].y, gs.li[0].x, gs.li[0].y)) / 360;
        Console.WriteLine(String.Join("\n", ans));
    }
Exemplo n.º 2
0
        public List <List <int> > Parse(string scanPdfPath)
        {
            Mat[] scansBin;
            using (var scansPath = Gs.PdfToJpeg(scanPdfPath, $"Scans_{Guid.NewGuid()}", "scan"))
            {
                scansBin = scansPath.Files
                           .Select(path => Cv2.ImRead(path, ImreadModes.Grayscale))
                           .Select(mat => mat.GaussianBlur(
                                       new Size(KernelSize, KernelSize),
                                       GaussianSigma,
                                       GaussianSigma))
                           .Select(mat => mat.Threshold(BinThreshold, 255, ThresholdTypes.Binary))
                           .ToArray();
            }

            for (int i = 0; i < scansBin.Length; i++)
            {
                var scan = scansBin[i];
                Cv2.BitwiseNot(scan, scan);

                Deskew(scan);
            }
            var checks = FindChecks(scansBin);

            return(checks);
        }
Exemplo n.º 3
0
    static void Main()
    {
        Sc  sc = new Sc();
        int n = sc.I, p = 0;

        int[][] a = new int[n][];
        int[][] b = new int[n][];
        for (int i = 0; i < n; i++)
        {
            a[i] = sc.Ia;
            if (a[i][1] < a[p][1])
            {
                p = i;
            }
            else if (a[i][1] == a[p][1] && a[i][0] > a[p][0])
            {
                p = i;
            }
        }
        Gs     gs1 = new Gs(a, p);
        double d1  = gs1.Diameter();

        p = 0;
        for (int i = 0; i < n; i++)
        {
            b[i] = sc.Ia;
            if (b[i][1] < b[p][1])
            {
                p = i;
            }
            else if (b[i][1] == b[p][1] && b[i][0] > b[p][0])
            {
                p = i;
            }
        }
        Gs     gs2 = new Gs(b, p);
        double d2  = gs2.Diameter();

        Console.WriteLine(d2 / d1);
    }
 public LocatorModel(string templatePdfPath)
 {
     TemplatePdfPath = templatePdfPath;
     using (var templates = Gs.PdfToJpeg(TemplatePdfPath, $"Templates_{Guid.NewGuid()}", "template"))
     {
         TemplateImgs = templates.Files.Select(path =>
         {
             using (var stream = File.OpenRead(path))
             {
                 return(Image.FromStream(stream));
             }
         }).ToArray();
     }
     if (TemplateImgs.Length == 0)
     {
         throw new Exception("Invalid template pdf file");
     }
     Locations = new Dictionary <int, List <Point> > [TemplateImgs.Length];
     for (int i = 0; i < Locations.Length; i++)
     {
         Locations[i] = new Dictionary <int, List <Point> >();
     }
 }
        public string BuildEdi(List <Patient> patientList, InsuranceCompany insurance,
                               BillingProvider billingProvider)
        {
            var buildEdi = new StringBuilder();
            //Begin ISA
            var buildisa = new Isa();

            buildEdi.Append(buildisa.BuildIsa());

            //Begin GS
            var buildGs = new Gs();

            buildEdi.Append(buildGs.BuildGs());

            //Begin ST
            var buildSt = new St();

            buildEdi.Append(buildSt.BuildSt());

            //Begin BPR
            var buildBpr = new Bpr();

            buildEdi.Append(buildBpr.BuildBpr(insurance));

            //Build TRN
            var buildTrn = new Trn();

            buildEdi.Append(buildTrn.BuildTrn(insurance));

            //Ref Segment conditional, not included at this time
            //REF Receiver Identification
            //REF01 Receiver Reference Number
            //REF02 Receiver Reference Identification

            //Build DTM Loop Production Date
            var buildDtm = new Dtm();

            buildEdi.Append(buildDtm.BuildDtm(patientList));

            //Build N1 Insurance Company Identification Segment 1000A
            var buildNOne = new N1();

            buildEdi.Append(buildNOne.BuildNOne(insurance));

            //BuildN3 Insurance Company Identification Segment 1000A
            var buildNThree = new N3();

            buildEdi.Append(buildNThree.BuildNThree(insurance));

            // Build N4 Insurance Company Identification 1000A
            var buildNFour = new N4();

            buildEdi.Append(buildNFour.BuildN4(insurance));

            //Build Ref Insurance Company Identification 1000A
            var buildRef = new Ref();

            buildEdi.Append(buildRef.BuildRef());

            //Build Per Insurance Company Identification 1000A
            var buildPer = new Per();

            buildEdi.Append(buildPer.BuildPerPhone());

            //Build Per Insurance Company Website Information 1000A
            buildEdi.Append(buildPer.BuildPerWebSite());

            //Build N1 Provider Identifier Segment 1000B
            buildEdi.Append(buildNOne.BuildNOne(billingProvider));

            //Build N3 Provider Identifier Segment 1000B
            buildEdi.Append(buildNThree.BuildNThree(billingProvider));

            //Build N4 Provider Identifier Segment 1000B
            buildEdi.Append(buildNFour.BuildN4(billingProvider));

            //Build Ref Provider Identifier 1000B
            buildEdi.Append(buildRef.BuildRefAdditionalPayee());
            buildEdi.Append(buildRef.BuildRefAdditionalPayeeTwo());

            //LX Segment 2000B
            var buildLx = new Lx();

            buildEdi.Append(buildLx.BuildLx());

            //TS3 2000B NOT USED
            //TS2 2000B NOT USED
            //CLP Segment 2100

            foreach (Patient patient in patientList)
            {
                var buildClp = new Clp();
                buildEdi.Append(buildClp.BuildClp(patient));

                var buildNmOne = new Nm1();
                buildEdi.Append(buildNmOne.BuildNm1(patient));


                //MIA Inpatient Adjudication Information
                //MOA Outpatient Adjudication Information
                //REF Other CLaim Related Identification


                //Ref Rendering Provider Identifier 2100
                buildEdi.Append(buildRef.BuildRef(patient.Provider));

                //DTM Statement From or To Date 2100
                buildEdi.Append(buildDtm.BuildDtm(patient));

                //PER Claim Contact Information 2100

                //SVC Level 2110
                var buildSvc = new Svc();

                buildEdi.Append(buildSvc.BuildSvc(patient.Charge));
                buildEdi.Append(buildDtm.BuildDtm(patient.Charge));

                var buildCas = new Cas();
                if (patient.Charge.AdjustmentList != null)
                {
                    buildEdi.Append(buildCas.BuildCas(patient.Charge.AdjustmentList));
                    buildEdi.Append(buildCas.BuildCas(patient.Charge));
                }
                else
                {
                    buildEdi.Append(buildCas.BuildCas(patient.Charge));
                }
                buildEdi.Append(buildRef.BuildRefControlNumber());

                var buildAmt = new Amt();
                buildEdi.Append(buildAmt.BuildAmt(patient.Charge));
                //QTY 2110
                //LQ 2110
                //LQ01 Service Line Remittance Remark Code 1
                //LQ02 Service Line Remittance Remark Code 2

                foreach (AddonCharge addon in patient.Charge.AddonChargeList)
                {
                    buildEdi.Append(buildSvc.BuildSvc(addon));
                    buildEdi.Append(buildCas.BuildCas(addon.AdjustmentList));
                    buildEdi.Append(buildRef.BuildRefControlNumber());
                    buildEdi.Append(buildAmt.BuildAmt(addon));
                }
            }

            var buildSe = new Se();

            buildEdi.Append(buildSe.BuildSe());

            var buildGe = new Ge();

            buildEdi.Append(buildGe.BuildGe());

            var buildIea = new Iea();

            buildEdi.Append(buildIea.BuildIea());

            return(buildEdi.ToString());
        }