39 namespace SourceXtractor {
46 if (group.
size() <= 1) {
54 for (
auto it = group.
begin(); it != group.
end(); ++it) {
62 if (sources_to_clean.
size() > 0) {
63 if (remaining_sources.
size() > 1) {
65 for (
auto it : sources_to_clean) {
67 merging_map[influential_source].push_back(it);
70 for (
auto merging_pair : merging_map) {
71 if (merging_pair.second.size() > 0) {
72 auto new_source =
mergeSources(*merging_pair.first, merging_pair.second);
77 }
else if (remaining_sources.
size() == 1) {
78 auto new_source =
mergeSources(*remaining_sources[0], sources_to_clean);
83 for (
auto& it : sources_to_clean) {
95 for (
auto it = group.
begin(); it != group.
end(); ++it) {
96 if (&(*it) == &source) {
102 for (
auto pixel : pixel_list) {
103 auto pixel_value = model.
getValue(pixel.m_x, pixel.m_y);
104 group_influence[i++] += pixel_value;
108 unsigned int still_valid_pixels = 0;
111 for (
auto value : pixel_values) {
112 if (value > group_influence[i++]) {
113 still_valid_pixels++;
128 for (
size_t i = 0; i < candidates.
size(); i++) {
130 for (
auto pixel : pixel_list) {
131 auto pixel_value = model.
getValue(pixel.m_x, pixel.m_y);
132 total_influence_of_sources[i] += pixel_value;
137 double most_influential_source_value = 0;
138 for (
size_t i = 0; i < candidates.
size(); i++) {
139 if (total_influence_of_sources[i] >= most_influential_source_value) {
140 most_influential_source = candidates[i];
141 most_influential_source_value = total_influence_of_sources[i];
144 return most_influential_source;
154 for (
const auto& child : children) {
155 const auto& pixel_list_to_merge = child->getProperty<
PixelCoordinateList>().getCoordinateList();
156 pixel_list.insert(pixel_list.end(), pixel_list_to_merge.begin(), pixel_list_to_merge.end());
170 PropertyId::create<PixelCoordinateList>(),
171 PropertyId::create<MoffatModelEvaluator>()