MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_region_data()

std::vector< DataVariant > MayaFlux::Kakshya::WindowContainer::get_region_data ( const Region region) const
overridevirtual

Extract data for all regions across all region groups that spatially intersect region.

Crops from the last full-surface readback — no GPU work. Returns empty if no readback has been performed yet.

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 145 of file WindowContainer.cpp.

146{
147 std::shared_lock lock(m_data_mutex);
148
149 if (m_processed_data.empty())
150 return {};
151
152 const auto* src = std::get_if<std::vector<uint8_t>>(&m_processed_data[0]);
153 if (!src || src->empty())
154 return {};
155
156 const auto& dims = m_structure.dimensions;
157 const std::span<const uint8_t> src_span { src->data(), src->size() };
158
159 std::vector<DataVariant> result;
160
161 for (const auto& [name, group] : m_region_groups) {
162 for (const auto& r : group.regions) {
163 if (!regions_intersect(r, region))
164 continue;
165 try {
166 result.emplace_back(extract_nd_region<uint8_t>(src_span, r, dims));
167 } catch (const std::exception& e) {
169 "WindowContainer::get_region_data extraction failed — {}", e.what());
170 }
171 }
172 }
173
174 return result;
175}
#define MF_WARN(comp, ctx,...)
void lock() override
Acquire a lock for thread-safe access.
std::vector< DataVariant > m_processed_data
std::unordered_map< std::string, RegionGroup > m_region_groups
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
bool regions_intersect(const Region &r1, const Region &r2) noexcept
Test whether two N-dimensional regions overlap on every shared axis.

References MayaFlux::Journal::ContainerProcessing, MayaFlux::Kakshya::ContainerDataStructure::dimensions, MayaFlux::Journal::Kakshya, lock(), m_data_mutex, m_processed_data, m_region_groups, m_structure, MF_WARN, and MayaFlux::Kakshya::regions_intersect().

+ Here is the call graph for this function: