public Qs2000Result(List<short> data, List<short> fraction, List<Fraction> nots) { RawCurve c = new RawCurve(data.Select(i => (int)i).ToList()); BaseLineCorrectedCurve correctedCurve = new BaseLineCorrectedCurve { Raw = c}; this.NumPoint = data.Count; this.Points = c.ToString(); this.Peaks = new List<Peak>(); int fracCount = fraction[0]; correctedCurve.SetFraction(0, 0, GlobalConfigVars.BaseLinePercent[0]); for (int i = 1; i <= fracCount; i++) { Peak p = new Peak { Index = i, Left = i == 1 ? 0 : fraction[i - 1], Right = fraction[i], Name = nots[i].Label, MSpike = false }; int percent = i > 5 ? 0 : GlobalConfigVars.BaseLinePercent[i]; correctedCurve.SetFraction(i, p.Right, percent); this.Peaks.Add(p); } if (this.Peaks.Count > 0) { //计算总值[] double total = correctedCurve.GetFractionTotal(); double albumin = 0; double others = 0; foreach (var peak in this.Peaks) { int start = peak.Left; int end = peak.Right; if (peak.Index == 1) { //albumin[] double currFra = correctedCurve.GetFractionTotal(start, end); peak.Percent = currFra / total; albumin = currFra; } else { //other(] double currFra = correctedCurve.GetFractionTotal(start + 1, end); peak.Percent = currFra / total; others += currFra; } if (peak.MSpike) { //m-spike() double currSpike = correctedCurve.GetFractionTotal(start + 1, end - 1); peak.Percent = currSpike / total; } } this.AG = albumin / others; } }
private static RawCurve GetCurve(BinaryReader br) { RawCurve cv = new RawCurve(); int count = br.ReadInt32(); if (count > 0) { for (int i = 0; i < count; i++) { int x = br.ReadInt32(); //pt.y = br.ReadInt32(); cv.AddPoint(x); } } return(cv); }
public Qs2000Result(List <short> data, List <short> fraction, List <Fraction> nots) { RawCurve c = new RawCurve(data.Select(i => (int)i).ToList()); BaseLineCorrectedCurve correctedCurve = new BaseLineCorrectedCurve { Raw = c }; this.NumPoint = data.Count; this.Points = c.ToString(); this.Peaks = new List <Peak>(); int fracCount = fraction[0]; correctedCurve.SetFraction(0, 0, GlobalConfigVars.BaseLinePercent[0]); for (int i = 1; i <= fracCount; i++) { Peak p = new Peak { Index = i, Left = i == 1 ? 0 : fraction[i - 1], Right = fraction[i], Name = nots[i].Label, MSpike = false }; int percent = i > 5 ? 0 : GlobalConfigVars.BaseLinePercent[i]; correctedCurve.SetFraction(i, p.Right, percent); this.Peaks.Add(p); } if (this.Peaks.Count > 0) { //计算总值[] double total = correctedCurve.GetFractionTotal(); double albumin = 0; double others = 0; foreach (var peak in this.Peaks) { int start = peak.Left; int end = peak.Right; if (peak.Index == 1) { //albumin[] double currFra = correctedCurve.GetFractionTotal(start, end); peak.Percent = currFra / total; albumin = currFra; } else { //other(] double currFra = correctedCurve.GetFractionTotal(start + 1, end); peak.Percent = currFra / total; others += currFra; } if (peak.MSpike) { //m-spike() double currSpike = correctedCurve.GetFractionTotal(start + 1, end - 1); peak.Percent = currSpike / total; } } this.AG = albumin / others; } }