MayaFlux 0.3.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 115 of file RegionUtils.hpp.

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