MayaFlux 0.1.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 109 of file RegionUtils.hpp.

114{
115 std::vector<std::vector<T>> results;
116
117 for (size_t idx = 0; idx < source_data.size(); ++idx) {
118
119 Region channel_region = remove_channel_dimension(region, dimensions);
120
121 auto channel_data = extract_region_data(
122 source_data[idx],
123 channel_region,
124 get_non_channel_dimensions(dimensions));
125
126 results.push_back(std::move(channel_data));
127 }
128
129 if (flatten) {
130 return { flatten_channels(results) };
131 }
132
133 return results;
134}
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: