MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kakshya::Region Struct Reference

Represents a point or span in N-dimensional space. More...

#include <Region.hpp>

+ Collaboration diagram for MayaFlux::Kakshya::Region:

Public Member Functions

 Region ()=default
 
 Region (const std::vector< uint64_t > &coordinates, std::unordered_map< std::string, std::any > attributes={})
 Construct a point-like region (single coordinate).
 
 Region (std::vector< uint64_t > start, std::vector< uint64_t > end, std::unordered_map< std::string, std::any > attributes={})
 Construct a span-like region (start and end coordinates).
 
bool is_point () const
 Check if this region is a single point (start == end).
 
bool contains (const std::vector< uint64_t > &coordinates) const
 Check if the given coordinates are contained within this region.
 
bool overlaps (const Region &other) const
 Check if this region overlaps with another region.
 
uint64_t get_span (uint32_t dimension_index=0) const
 Get the span (length) of the region along a dimension.
 
uint64_t get_volume () const
 Get the total volume (number of elements) in the region.
 
uint64_t get_duration (uint32_t dimension_index=0) const
 Get the duration (span) along a specific dimension.
 
template<typename T >
std::optional< T > get_attribute (const std::string &key) const
 Get an attribute value by key, with type conversion support.
 
void set_attribute (const std::string &key, std::any value)
 Set an attribute value by key.
 
std::string get_label () const
 Get the label attribute (if present).
 
void set_label (const std::string &label)
 Set the label attribute.
 
Region translate (const std::vector< int64_t > &offset) const
 Translate the region by an offset vector.
 
Region scale (const std::vector< double > &factors) const
 Scale the region about its center by the given factors.
 
bool operator== (const Region &other) const
 Equality comparison for Regions.
 
bool operator!= (const Region &other) const
 Inequality comparison for Regions.
 

Static Public Member Functions

static Region time_point (uint64_t frame, const std::string &label="", const std::any &extra_data={})
 Create a Region representing a single time point (e.g., a frame or sample).
 
static Region time_span (uint64_t start_frame, uint64_t end_frame, const std::string &label="", const std::any &extra_data={})
 Create a Region representing a time span (e.g., a segment of frames).
 
static Region audio_point (uint64_t frame, uint32_t channel, const std::string &label="")
 Create a Region for a single audio sample/channel location.
 
static Region audio_span (uint64_t start_frame, uint64_t end_frame, uint32_t start_channel, uint32_t end_channel, const std::string &label="")
 Create a Region representing a span in audio (frames and channels).
 
static Region image_rect (uint64_t x1, uint64_t y1, uint64_t x2, uint64_t y2, const std::string &label="")
 Create a Region representing a rectangular region in an image.
 
static Region video_region (uint64_t start_frame, uint64_t end_frame, uint64_t x1, uint64_t y1, uint64_t x2, uint64_t y2, const std::string &label="")
 Create a Region representing a region in a video (frames and spatial rectangle).
 

Public Attributes

std::vector< uint64_t > start_coordinates
 Starting frame index (inclusive)
 
std::vector< uint64_t > end_coordinates
 Ending frame index (inclusive)
 
std::unordered_map< std::string, std::any > attributes
 Flexible key-value store for region-specific attributes.
 

Detailed Description

Represents a point or span in N-dimensional space.

Regions represent precise locations or segments within signal data, defined by start and end frame positions. Each region can have additional attributes stored in a flexible key-value map, allowing for rich metadata association with each point.

Common DSP-specific uses include:

  • Marking transients and onset detection points
  • Identifying spectral features or frequency domain events
  • Defining zero-crossing boundaries for phase analysis
  • Marking signal transformation points (e.g., filter application boundaries)
  • Storing analysis results like RMS peaks, harmonic content points, or noise floors

The flexible attribute system allows for storing any computed values or metadata associated with specific signal locations, enabling advanced signal processing workflows and algorithmic decision-making.

Definition at line 67 of file Region.hpp.


The documentation for this struct was generated from the following file: