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

◆ extract_region_data() [2/3]

template<typename T >
std::vector< std::vector< T > > MayaFlux::Kakshya::extract_region_data ( const std::vector< std::span< const T > > &  source_data,
const Region region,
const std::vector< DataDimension > &  dimensions,
bool  flatten = false 
)

Extract region data from planar storage (separate per channel/variant)

Template Parameters
TData type
Parameters
source_variantsVector of data spans (one per channel/variant)
regionRegion to extract
dimensionsDimension descriptors
flattenIf true, return single flattened vector; if false, return per-channel vectors
Returns
Vector of vectors (per-channel) or single flattened vector

Definition at line 133 of file RegionUtils.hpp.

138{
139 std::vector<std::vector<T>> results;
140
141 for (size_t idx = 0; idx < source_data.size(); ++idx) {
142
143 Region channel_region = remove_channel_dimension(region, dimensions);
144
145 auto channel_data = extract_region_data(
146 source_data[idx],
147 channel_region,
148 get_non_channel_dimensions(dimensions));
149
150 results.push_back(std::move(channel_data));
151 }
152
153 if (flatten) {
154 return { flatten_channels(results) };
155 }
156
157 return results;
158}
Region remove_channel_dimension(const Region &region, const std::vector< DataDimension > &dimensions)
Remove the channel dimension from a Region.
std::vector< T > extract_region_data(const std::span< const T > &source_data, const Region &region, const std::vector< DataDimension > &dimensions)
Extract a region of data from a flat data span using a Region and dimension info.
std::vector< DataDimension > get_non_channel_dimensions(const std::vector< DataDimension > &dimensions)
Get all non-channel dimensions from a list of dimensions.
Represents a point or span in N-dimensional space.
Definition Region.hpp:67

References extract_region_data(), flatten_channels(), get_non_channel_dimensions(), and remove_channel_dimension().

+ Here is the call graph for this function: