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

◆ get_bounding_region()

Region MayaFlux::Kakshya::RegionGroup::get_bounding_region ( ) const
inline

Get the bounding region that contains all regions in the group.

Returns
Region representing the bounding box.

Definition at line 181 of file RegionGroup.hpp.

182 {
183 if (regions.empty())
184 return Region {};
185
186 auto first = regions[0];
187 std::vector<uint64_t> min_coords = first.start_coordinates;
188 std::vector<uint64_t> max_coords = first.end_coordinates;
189
190 for (const auto& region : regions) {
191 for (size_t i = 0; i < min_coords.size(); i++) {
192 if (i < region.start_coordinates.size()) {
193 min_coords[i] = std::min<size_t>(min_coords[i], region.start_coordinates[i]);
194 max_coords[i] = std::max<size_t>(max_coords[i], region.end_coordinates[i]);
195 }
196 }
197 }
198
199 Region bounds(min_coords, max_coords);
200 bounds.set_attribute("type", "bounding_box");
201 bounds.set_attribute("source_group", name);
202 return bounds;
203 }
std::vector< Region > regions
Collection of regions belonging to this group.
std::string name
Descriptive name of the group.

References MayaFlux::Kakshya::Region::set_attribute(), and MayaFlux::Kakshya::Region::start_coordinates.

+ Here is the call graph for this function: