| 111 | } |
| 112 | |
| 113 | Math::Histogram<> LayerStatisticsPeakMap::getDistribution(const RangeStatsType& which, const UInt number_of_bins) const |
| 114 | { |
| 115 | auto mm = getMinMax(overview_range_data_, which, "PeakMap"); // may throw if unknown statistic |
| 116 | Math::Histogram<> result(mm.min, mm.max, (mm.max - mm.min) / number_of_bins); |
| 117 | |
| 118 | if (which == RangeStatsType{ RangeStatsSource::CORE, "intensity" }) |
| 119 | { |
| 120 | for (const auto& spec : *pm_) |
| 121 | { |
| 122 | for (const auto& peak : spec) |
| 123 | { |
| 124 | result.inc(peak.getIntensity()); |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | else if (which.src == RangeStatsSource::ARRAYINFO) |
| 129 | { |
| 130 | for (const auto& spec : *pm_) |
| 131 | { |
| 132 | std::visit(overload {[&](const RangeStatsInt& /*int_range*/) { updateHistFromDataArray(spec.getIntegerDataArrays(), which.name, result); }, |
| 133 | [&](const RangeStatsDouble& /*double_range*/) { updateHistFromDataArray(spec.getFloatDataArrays(), which.name, result); }} |
| 134 | , overview_range_data_.at(which)); |
| 135 | } |
| 136 | } |
| 137 | return result; |
| 138 | } |
| 139 | |
| 140 | LayerStatisticsFeatureMap::LayerStatisticsFeatureMap(const FeatureMap& fm) : fm_(&fm) |
| 141 | { |
no test coverage detected