示例#1
0
        private void Initialize()
        {
            RawCurveF c = GetCurveFromBlob(_scan, _numData);

            this.Points = c.ToString();
            this.Peaks  = PlatinumDbAccess.GetPeaksByScanId(_scanId);
            if (this.Peaks != null && this.Peaks.Count > 0)
            {
                BaseLineCorrectedCurveF correctedCurve = new BaseLineCorrectedCurveF
                {
                    Raw       = c,
                    BaseLeft  = this.BaseLeft,
                    BaseRight = this.BaseRight
                };
                correctedCurve.SetFraction(0, this.Peaks[0].Left);
                for (int i = 1; i <= this.Peaks.Count; i++)
                {
                    correctedCurve.SetFraction(i, this.Peaks[i - 1].Right);
                }

                //计算总值[]
                double total   = correctedCurve.GetFractionTotal();
                double albumin = 0;
                double others  = 0;
                foreach (var peak in this.Peaks)
                {
                    if (peak.Index == 1)
                    {
                        //albumin[]
                        double currFra = correctedCurve.GetFractionTotal(peak.Left, peak.Right);
                        peak.Percent = currFra / total;
                        albumin      = currFra;
                    }
                    else
                    {
                        //other(]
                        double currFra = correctedCurve.GetFractionTotal(peak.Left + 1, peak.Right);
                        peak.Percent = currFra / total;
                        others      += currFra;
                    }

                    if (peak.MSpike)
                    {
                        //m-spike()
                        double currSpike = correctedCurve.GetFractionTotal(peak.Left + 1, peak.Right - 1);
                        peak.Percent = currSpike / total;
                    }
                }

                this.AG = albumin / others;
            }
        }
示例#2
0
        private static RawCurveF GetCurveFromBlob(byte[] buffer, int numData)
        {
            RawCurveF c = new RawCurveF();

            try
            {
                using (MemoryStream ms = new MemoryStream(buffer))
                {
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        for (int i = 0; i < numData; i++)
                        {
                            float pointValue = br.ReadSingle();
                            c.AddPoint(pointValue);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            return(c);
        }
示例#3
0
 private static RawCurveF GetCurveFromBlob(byte[] buffer, int numData)
 {
     RawCurveF c = new RawCurveF();
     try
     {
         using (MemoryStream ms = new MemoryStream(buffer))
         {
             using (BinaryReader br = new BinaryReader(ms))
             {
                 for (int i = 0; i < numData; i++)
                 {
                     float pointValue = br.ReadSingle();
                     c.AddPoint(pointValue);
                 }
             }
         }
     }
     catch (Exception)
     {
     }
     return c;
 }