MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kakshya::SpatialRegionProcessor Class Reference

Parallel spatial extraction processor for image-modality containers. More...

#include <SpatialRegionProcessor.hpp>

+ Inheritance diagram for MayaFlux::Kakshya::SpatialRegionProcessor:
+ Collaboration diagram for MayaFlux::Kakshya::SpatialRegionProcessor:

Public Member Functions

 SpatialRegionProcessor ()=default
 
 ~SpatialRegionProcessor () override=default
 
void on_attach (const std::shared_ptr< SignalSourceContainer > &container) override
 Attach to a spatial container.
 
void on_detach (const std::shared_ptr< SignalSourceContainer > &container) override
 Detach; delegates to RegionProcessorBase::on_detach.
 
void process (const std::shared_ptr< SignalSourceContainer > &container) override
 Extract all active regions from processed_data[0] in parallel.
 
void refresh ()
 Re-sync m_organized_regions from the container's current group map.
 
- Public Member Functions inherited from MayaFlux::Kakshya::RegionProcessorBase
virtual ~RegionProcessorBase ()=default
 
bool is_processing () const override
 Query if the processor is currently performing processing.
 
void set_cache_limit (size_t max_cached_elements)
 Set the maximum cache size for regions (in elements).
 
void set_auto_caching (bool enabled)
 Enable or disable automatic region caching.
 
const std::vector< uint64_t > & get_current_position () const
 Get the current processing position (N-dimensional coordinates).
 
void set_current_position (const std::vector< uint64_t > &position)
 Set the current processing position (N-dimensional coordinates).
 
- Public Member Functions inherited from MayaFlux::Kakshya::DataProcessor
virtual ~DataProcessor ()=default
 Virtual destructor for proper cleanup.
 

Protected Member Functions

void organize_container_data (const std::shared_ptr< SignalSourceContainer > &container) override
 Build m_organized_regions from get_all_region_groups().
 
- Protected Member Functions inherited from MayaFlux::Kakshya::RegionProcessorBase
virtual void cache_region_if_needed (const RegionSegment &segment, const std::shared_ptr< SignalSourceContainer > &container)
 Cache a region's data if beneficial and not already cached.
 
virtual bool advance_position (std::vector< uint64_t > &position, uint64_t steps=1, const OrganizedRegion *region=nullptr)
 Advance position according to memory layout and looping.
 
virtual void ensure_output_dimensioning (std::vector< DataVariant > &output_data, const std::vector< uint64_t > &required_shape)
 Ensure output data is properly dimensioned for region extraction.
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Kakshya::RegionProcessorBase
std::weak_ptr< SignalSourceContainerm_container_weak
 
std::atomic< bool > m_is_processing { false }
 
std::vector< OrganizedRegionm_organized_regions
 
size_t m_current_region_index = 0
 
std::vector< uint64_t > m_current_position
 
std::unique_ptr< RegionCacheManagerm_cache_manager
 
size_t m_max_cache_size { static_cast<size_t>(1024 * 1024) }
 
bool m_auto_caching = true
 
ContainerDataStructure m_structure
 

Detailed Description

Parallel spatial extraction processor for image-modality containers.

Operates on any SignalSourceContainer whose structure carries at least one spatial dimension (SPATIAL_Y, SPATIAL_X, or SPATIAL_Z). Unlike RegionOrganizationProcessor — which advances a sequential temporal cursor through audio regions — this processor extracts all active regions on every process() call, reflecting the parallel readback semantics of spatial data.

Region source: Regions are read from the container's RegionGroup map (get_all_region_groups()). Each Region inside each group becomes one OrganizedRegion in m_organized_regions, inheriting both group-level and region-level attributes. organize_container_data() re-syncs this list from the live group map, so callers can mutate groups between frames by calling refresh().

Processing contract (process()):

  • Expects processed_data[0] to hold the full-surface readback as a std::vector<uint8_t> placed there by the default processor (e.g. WindowAccessProcessor) before the chain runs.
  • Replaces processed_data with one DataVariant per active region, in group-iteration order, then region-insertion order within each group.
  • Each DataVariant carries the attributes from its OrganizedRegion so downstream consumers can identify the source ("group_name", "region_index").
  • If processed_data[0] is absent or empty, state is set to IDLE and the method returns without modifying processed_data.

Caching: Auto-caching is disabled by default. Spatial data from a live surface changes every frame, so caching individual regions yields no benefit under normal operation. It can be re-enabled via set_auto_caching(true) for static or infrequently-updated surfaces (e.g. a paused framebuffer).

Container neutrality: No WindowContainer-specific code. Any container that satisfies the NDDimensionalContainer interface and populates processed_data[0] with a flat spatial buffer is compatible.

Definition at line 48 of file SpatialRegionProcessor.hpp.


The documentation for this class was generated from the following files: