} /* WriteTabDelToStream */ private void WriteForGnuplotToStream(TextWriter tw, PicesImageSizeDistribution sizeDistribution, bool printDensity, bool plotVolumeSpectrum ) { uint numDepthBins = (uint)sizeDistribution.NumDepthBins; uint numSizeBins = (uint)sizeDistribution.NumSizeBuckets; float[] startValues = bucketsDisplayed.SizeStartValues(); float[] endValues = bucketsDisplayed.SizeEndValues(); uint maxValuesLen = (uint)Math.Max(startValues.Length, endValues.Length); uint minValuesLen = (uint)Math.Min(startValues.Length, endValues.Length); double depthBinSize = sizeDistribution.DepthBinSize; for (int sizeIdx = 0; sizeIdx < minValuesLen; ++sizeIdx) { double size = (startValues[sizeIdx] + endValues[sizeIdx]) / 2.0; for (uint depthBinIdx = 0; depthBinIdx < numDepthBins; ++depthBinIdx) { double depth = depthBinSize * depthBinIdx; PicesImageSizeDistributionRow row = sizeDistribution.GetDepthBin(depthBinIdx); if (row == null) { tw.WriteLine(size + " " + depth + " " + "0"); continue; } uint[] distriution = row.Distribution(); float volumneSampled = row.VolumneSampled; double zed = 0.0; if (plotVolumeSpectrum) { double density = 0.0; if ((distriution[sizeIdx] > 0) && (volumneSampled != 0.0f)) { density = (double)distriution[sizeIdx] / (double)volumneSampled; } double nV = density * Math.PI * Math.Pow(size, 3.0) / 6.0; double nVd = nV * size; zed = Math.Log10(nVd); } else { if (printDensity) { if ((distriution[sizeIdx] > 0) && (volumneSampled != 0.0f)) { zed = (float)Math.Log10(1.0f + (float)distriution[sizeIdx] / (float)volumneSampled); } } else { zed = (float)Math.Log10(1.0 + (double)distriution[sizeIdx]); } } tw.WriteLine(size + " " + depth + " " + zed); } tw.WriteLine(); } } /* WriteForGnuplotToStream */
private void WriteTabDelToStream(TextWriter tw, PicesImageSizeDistribution sizeDistribution, bool printDensity ) { uint x = 0; uint numDepthBins = (uint)sizeDistribution.NumDepthBins; uint numSizeBins = (uint)sizeDistribution.NumSizeBuckets; float[] startValues = bucketsDisplayed.SizeStartValues(); float[] endValues = bucketsDisplayed.SizeEndValues(); uint maxValuesLen = (uint)Math.Max(startValues.Length, endValues.Length); uint minValuesLen = (uint)Math.Min(startValues.Length, endValues.Length); String hl1 = "" + "\t" + "Volume" + "\t" + "Image" + "\t" + "Total" + "\t" + "Total"; String hl2 = "Depth(m)" + "\t" + "Sampled(m^3)" + "\t" + "Count" + "\t" + "Pixels" + "\t" + "FilledArea"; for (x = 0; x < minValuesLen; ++x) { hl1 += ("\t" + startValues[x]); hl2 += ("\t" + endValues [x]); } tw.WriteLine(hl1); tw.WriteLine(hl2); for (uint depthBinIdx = 0; depthBinIdx < numDepthBins; ++depthBinIdx) { PicesImageSizeDistributionRow row = sizeDistribution.GetDepthBin(depthBinIdx); if (row == null) { continue; } uint[] distriution = row.Distribution(); float volumneSampled = row.VolumneSampled; tw.Write(row.Depth + "\t" + volumneSampled + "\t" + row.ImageCount + "\t" + row.TotalPixels + "\t" + row.TotalFilledArea ); for (x = 0; x < distriution.Length; ++x) { tw.Write("\t"); if (printDensity) { float zed = 0.0f; if ((distriution[x] > 0) && (volumneSampled != 0.0f)) { zed = (float)Math.Log10(1.0f + (float)distriution[x] / (float)volumneSampled); } tw.Write(zed); } else { tw.Write(distriution[x]); } } tw.WriteLine(); } } /* WriteTabDelToStream */
} /* ClearHighLightedBucket*/ private void HighLightSizeBucket(int depthBin) { if ((ProfileChart.Series.Count < 1) || (depthBin < 0)) { return; } if (depthBin >= depthProfile.Length) { return; } Series s = ProfileChart.Series[0]; if (depthBin >= s.Points.Count) { return; } ClearHighLightedBucket(); DataPoint dp = s.Points[depthBin]; PicesImageSizeDistributionRow depthRow = sizeDistribution.GetDepthBin((uint)depthBin); if (depthRow == null) { return; } uint[] distribution = depthRow.Distribution(); if ((distribution == null) || (distribution.Length <= selectedSizeBucket)) { return; } double volSampled = 0.0f; if (depthBin < volumeSampled.Length) { volSampled = volumeSampled[depthBin]; } double density = 0.0; if (volSampled > 0.0) { density = (double)distribution[selectedSizeBucket] / volSampled; } dp.Label = density.ToString("###,##0.0") + "(" + dp.YValues[0].ToString("##0.0 m") + ")"; dp.Color = Color.Red; dp.Font = dataPointFont; dp.MarkerStyle = MarkerStyle.Circle; dp.MarkerSize = s.MarkerSize * 3; dp.MarkerColor = Color.Red; dp.LabelBackColor = Color.White; Series s2 = ProfileChart.Series[1]; if (depthBin >= s2.Points.Count) { return; } DataPoint dp2 = s2.Points[depthBin]; dp2.Label = volSampled.ToString("#0.00") + "m^3"; dp2.Color = Color.Red; dp2.Font = dataPointFont; dp2.MarkerStyle = MarkerStyle.Circle; dp2.MarkerSize = s.MarkerSize * 3; dp2.MarkerColor = Color.Red; dp2.LabelBackColor = Color.White; selectedDepthBin = depthBin; } /* HighLightSizeBucket */