MayaFlux 0.2.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 79 of file WindowContainer.cpp.

80{
81 std::shared_lock lock(m_data_mutex);
82
83 if (m_processed_data.empty())
84 return {};
85
86 const auto* src = std::get_if<std::vector<uint8_t>>(&m_processed_data[0]);
87 if (!src || src->empty())
88 return {};
89
90 const auto& dims = m_structure.dimensions;
91 const std::span<const uint8_t> src_span { src->data(), src->size() };
92
93 std::vector<DataVariant> result;
94
95 for (const auto& [name, group] : m_region_groups) {
96 for (const auto& r : group.regions) {
97 if (!regions_intersect(r, region))
98 continue;
99 try {
100 result.emplace_back(extract_nd_region<uint8_t>(src_span, r, dims));
101 } catch (const std::exception& e) {
103 "WindowContainer::get_region_data extraction failed — {}", e.what());
104 }
105 }
106 }
107
108 return result;
109}
#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: