Extract all active regions from processed_data[0] in parallel.
85{
86 if (!container) {
88 "SpatialRegionProcessor::process — null container");
89 return;
90 }
91
92 auto& processed = container->get_processed_data();
93
94 if (processed.empty()) {
96 "SpatialRegionProcessor: processed_data empty, no readback available");
98 return;
99 }
100
101 const bool src_empty = std::visit(
102 [](const auto& v) { return v.empty(); }, processed[0]);
103
104 if (src_empty) {
106 "SpatialRegionProcessor: processed_data[0] empty, skipping extraction");
108 return;
109 }
110
113 return;
114 }
115
118
119 const auto& dims = container->get_structure().dimensions;
120
121 std::vector<DataVariant> extracts;
123
124 std::visit([&](const auto& src_vec) {
125 using T =
typename std::decay_t<
decltype(src_vec)>::value_type;
126
127 if constexpr (std::is_same_v<T, uint8_t>
128 || std::is_same_v<T, uint16_t>
129 || std::is_same_v<T, uint32_t>
130 || std::is_same_v<T, float>) {
131
132 const std::span<const T> src { src_vec.data(), src_vec.size() };
133
135 if (org.segments.empty()) {
137 "SpatialRegionProcessor: OrganizedRegion '{}[{}]' has no segments, skipping",
138 org.group_name, org.region_index);
139 continue;
140 }
141
143
144 try {
145 extracts.emplace_back(
146 extract_nd_region<T>(src, org.segments[0].source_region, dims));
148 } catch (const std::exception& e) {
150 "SpatialRegionProcessor: extraction failed for '{}[{}]' — {}",
151 org.group_name, org.region_index, e.what());
153 }
154 }
155 } else {
157 "SpatialRegionProcessor: processed_data[0] holds a type not suitable "
158 "for spatial pixel extraction ({}); no regions extracted",
159 typeid(T).name());
160 }
161 },
162 processed[0]);
163
164 processed = std::move(extracts);
165
168}
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_RT_TRACE(comp, ctx,...)
std::vector< OrganizedRegion > m_organized_regions
std::atomic< bool > m_is_processing
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ IDLE
Container is inactive with no data or not ready for processing.
@ PROCESSING
Container is actively being processed.
@ PROCESSED
Container has completed processing and results are available.
@ ACTIVE
Currently being processed.
@ READY
Ready for processing.
@ IDLE
Not being processed.