9.25. Compute Feature Bounding Boxes
Group (Subgroup)
Geometry
Description
Warning: Potential Runtime Error - It is expected that the max feature id plus one (max_feature_id_value + 1) is equal to or less than the number of tuples in the supplied feature Attribute Matrix. This cannot be checked in preflight and will terminate the pipeline if encountered.
This filter calculates the bounding boxes for each feature given Feature Ids and Geometry (refer to table below for supported geometry types and their corresponding feature id sizing). This filter does output NaNs for empty features, cases where a point can not be associated to a feature. The bounding boxes are defined and stored as two points in space, a lower and upper point. The optimal storage solution is use case defined, and as such there are two options provided split and unified.
Geometry Type |
Expected Feature ID Length |
|---|---|
Image |
Equal to Image Dimesions; typically equivalent to the |
Vertex |
Equal to the Number of Vertices/Points; typically equivalent to the |
Edge |
Equal to the Number of Edges; ; typically equivalent to the |
Triangle |
Equal to the Number of Triangles/Faces; typically equivalent to the |
Quad |
Equal to the Number of Quads/Faces; typically equivalent to the |
Split Output
Two 3-component float32 DataArrays. Min/Lower Bound and Max/Upper Bound.
The intended use case for split is primarily for output compatibility. By logically segmenting them users could:
color min and max differently in visualization
print the points in separate columns for distinction
simplify parsing complexity for users who may want to adapt the bounding box representation to another format (primarily for Python-bindings) (e.g. min-x, max-x, min-y, max-y, min-z, max-z || adapting to non-standard bounding shapes)
Unified Output
One 6-component float32 DataArray. Bounds array in the format of min-x, min-y, min-z, max-x, max-y, max-z.
The intended use case for unified is primarily for simplicity of internal calculations. Essentially, this format is the result of appending the max array onto the min array. It is easier to pass around and parse one array within simplnx API’s. For mainline simplnx filters this will be the expected/preferred input format.
Edge Geometry Nuances
Producing an edge geometry for the bounding boxes has a couple nuances that aren’t very intuitive, these will be covered here. Firstly, the output edge geometry may NOT contain all features that are in the input geometry. For a feature to be included it must meet two conditions:
The bounding box must not contain any NANs
The feature id must be greater than or equal to 0
This is most relevant if you have empty features in the input geometry or you have invalid feature ids (-1). This is remedied by the feature ids created at the edge (cell) data, these map the edges making up the bounding boxes to the feature they originate from. With empty features, this will cause gaps in the sequence (eg with 3 being an empty feature the edge feature ids would follow a 1,2,4,5 sequence). This is important to note because the user may wish to create a Feature Attribute Matrix by creating an Attribute Matrix equivalent to number of edges / 12, but this would only be true for the case in which the values in array are consecutive in order (ie there are no empty features).
Lastly, we will peel back the covers on how the geometry is constructed in the case that the user needs to parse or manipulate the data within it. Each bound box in the geometry is extrapolated from a maximum and minimum point. The points are constructed from every combination in the following order:
| Index | Vertex Point |
|-------|-----------------------|
| 0 | {min-X, min-Y, min-Z} |
| 1 | {max-X, min-Y, min-Z} |
| 2 | {max-X, max-Y, min-Z} |
| 3 | {min-X, max-Y, min-Z} |
| 4 | {min-X, min-Y, max-Z} |
| 5 | {max-X, min-Y, max-Z} |
| 6 | {max-X, max-Y, max-Z} |
| 7 | {min-X, max-Y, max-Z} |
The edges for each bounding box are 12 in number and constructed in following order:
| Index | Vertex Indices |
|-------|----------------|
| 0 | {0, 1} |
| 1 | {1, 2} |
| 2 | {2, 3} |
| 3 | {3, 4} |
| 4 | {4, 5} |
| 5 | {5, 6} |
| 6 | {6, 7} |
| 7 | {7, 4} |
| 8 | {0, 4} |
| 9 | {1, 5} |
| 10 | {2, 6} |
| 11 | {3, 7} |
Since edges are the cell level data in edge geometries, the feature ids map to the edges. This means that the feature ids array will always contain 11 more consecutive instances of the same feature from when it first appears (12 total). To know the number of features in the edge geom, just divide the number of edges by 12.
Input Parameter(s)
Parameter Name |
Parameter Type |
Parameter Notes |
Description |
|---|---|---|---|
Output Array(s) Type |
Choices |
If split two three component arrays will be created (Max & Min). If unified one six component array will be created with the XYZXYZ MinMax scheme |
|
Create Bounding Box Geometries |
Bool |
Whether or not to create an Edge geometry that contains the bounding boxes |
Input Cell Data
Parameter Name |
Parameter Type |
Parameter Notes |
Description |
|---|---|---|---|
Selected Geometry |
Geometry Selection |
Image, Vertex, Edge, Triangle, Quadrilateral |
The DataPath to the Geometry that contains the points/edges/faces for the geometry |
Feature Ids |
Array Selection |
Allowed Types: int32 |
The DataPath to the DataArray that specifies which feature each point belongs |
Input Feature Data
Parameter Name |
Parameter Type |
Parameter Notes |
Description |
|---|---|---|---|
Feature Data Attribute Matrix |
AttributeMatrixSelection |
The DataPath to the Feature Data Attribute Matrix, array(s) will be created here |
Output Feature Data
Parameter Name |
Parameter Type |
Parameter Notes |
Description |
|---|---|---|---|
Lower Bound Points Array Name |
DataObjectName |
The name of the array containing the min/lower point of the bounding box for each feature |
|
Upper Bound Points Array Name |
DataObjectName |
The name of the array containing the max/upper point of the bounding box for each feature |
|
Unified Bounds Array Name |
DataObjectName |
The name of the array containing the min and max point of the bounding box for each feature |
Output Edge Geometry
Parameter Name |
Parameter Type |
Parameter Notes |
Description |
|---|---|---|---|
Created Edge Geometry |
DataGroupCreation |
The name of the created Edge Geometry |
|
Edge Attribute Matrix |
DataObjectName |
Attribute Matrix to store information about the created edges |
|
Edge Feature Ids |
DataObjectName |
Identifies the Feature Id to which each edge belongs |
Example Pipelines
License & Copyright
Please see the description file distributed with this Plugin
DREAM3D-NX Help
If you need help, need to file a bug report or want to request a new feature, please head over to the DREAM3DNX-Issues GitHub site where the community of DREAM3D-NX users can help answer your questions.