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

◆ infer_from_region_group()

std::pair< std::vector< Kakshya::DataDimension >, Kakshya::DataModality > MayaFlux::Yantra::infer_from_region_group ( const Kakshya::RegionGroup group,
const std::shared_ptr< Kakshya::SignalSourceContainer > &  container 
)

Infer structure from RegionGroup.

Definition at line 109 of file StructureIntrospection.cpp.

110{
111 if (!container || group.regions.empty()) {
112 return { { { Kakshya::DataDimension::time(0) } }, Kakshya::DataModality::UNKNOWN };
113 }
114
115 auto structure = container->get_structure();
116 auto bounds_info = Kakshya::extract_group_bounds_info(group);
117
118 if (bounds_info.contains("bounding_min") && bounds_info.contains("bounding_max")) {
119 auto min_coords = safe_any_cast_or_throw<std::vector<uint64_t>>(bounds_info["bounding_min"]);
120 auto max_coords = safe_any_cast_or_throw<std::vector<uint64_t>>(bounds_info["bounding_max"]);
121
122 std::vector<uint64_t> shape;
123 int size = static_cast<int>(max_coords[0] - min_coords[0]);
124 shape.push_back(std::abs(size) + 1);
125 shape.push_back(max_coords[1]);
126
127 Kakshya::DataModality modality = structure.modality;
128 if (group.attributes.contains("modality")) {
129 auto modality_result = safe_any_cast<Kakshya::DataModality>(group.attributes.at("modality"));
130 if (modality_result)
131 modality = *modality_result.value;
132 }
133
134 auto dimensions = Kakshya::DataDimension::create_dimensions(modality, shape, structure.memory_layout);
135 return { dimensions, modality };
136 }
137
138 return infer_from_region(group.regions[0], container);
139}
Range size
std::pair< std::vector< Kakshya::DataDimension >, Kakshya::DataModality > infer_from_region(const Kakshya::Region &region, const std::shared_ptr< Kakshya::SignalSourceContainer > &container)
Infer structure from Region (placeholder since regions are markers)
std::unordered_map< std::string, std::any > attributes
Flexible key-value store for group-specific attributes.
std::vector< Region > regions
Collection of regions belonging to this group.

References MayaFlux::Kakshya::RegionGroup::attributes, MayaFlux::Kakshya::DataDimension::create_dimensions(), MayaFlux::Kakshya::extract_group_bounds_info(), infer_from_region(), MayaFlux::Kakshya::RegionGroup::regions, size, MayaFlux::Kakshya::DataDimension::time(), and MayaFlux::Kakshya::UNKNOWN.

Referenced by infer_structure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: