public void computeStatistics(HTuple grayVals) { HTuple tuple, val; int max = 0; if (grayVals != null && grayVals.Length > 1) { tuple = new HTuple(grayVals); val = tuple.TupleMean(); labelMean.Text = val[0].D.ToString("f2"); val = tuple.TupleDeviation(); labelDeviation.Text = val[0].D.ToString("f2"); val = tuple.TupleSortIndex(); labelPeakX.Text = val[val.Length - 1].I + ""; max = (int)tuple[val[val.Length - 1].I].D; labelPeak.Text = max + ""; labelRange.Text = (int)tuple[0].D + " ... " + (int)tuple[tuple.Length - 1].D; labelRangeX.Text = "0 ... " + (tuple.Length - 1); } else { labelMean.Text = "0"; labelDeviation.Text = "0"; labelPeakX.Text = "0"; labelPeak.Text = "0"; labelRange.Text = "0 ... 0"; labelRangeX.Text = "0 ... 0"; } }
/// <summary>Adjusts statistics of measure projection (line profile).</summary> public void ComputeStatistics(double[] grayVals) { HTuple tuple, val; int max =0; if (grayVals != null) { tuple = new HTuple(grayVals); val = tuple.TupleMean(); labelMean.Text = val[0].D.ToString("f2"); val = tuple.TupleDeviation(); labelDeviation.Text = val[0].D.ToString("f2"); val = tuple.TupleSortIndex(); labelPeakX.Text = val[val.Length - 1].I + ""; max = (int)tuple[val[val.Length - 1].I].D; labelPeak.Text = max + ""; labelRange.Text = (int)tuple[0].D + " ... " + (int)tuple[tuple.Length - 1].D; labelRangeX.Text = "0 ... " + (tuple.Length - 1); } else { labelMean.Text = "0"; labelDeviation.Text = "0"; labelPeakX.Text = "0"; labelPeak.Text = "0"; labelRange.Text = "0 ... 0"; labelRangeX.Text = "0 ... 0"; } }