Skip to content

Commit

Permalink
ENH: Misc doc and filter updates for ITK, ExtractInternalSurfaces and…
Browse files Browse the repository at this point in the history
… SurfaceNets (#898)


- DOC: Fix Human labels in a few ITK filters
- ENH: ExtractInternalSurfacesFromTriangleGeometry now allows user defined NodeType ranges
- DOC: Improve SurfaceNets filter documentation with images.

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson authored Mar 28, 2024
1 parent 8b74807 commit d43cc50
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Parameters ITKClosingByReconstructionImage::parameters() const
"For objects that are 1 pixel wide, use True.",
false));
params.insert(std::make_unique<BoolParameter>(
k_PreserveIntensities_Key, "PreserveIntensities",
k_PreserveIntensities_Key, "Preserve Intensities",
"Set/Get whether the original intensities of the image retained for those pixels unaffected by the opening by reconstruction. If Off, the output pixel contrast will be reduced.", false));

params.insertSeparator(Parameters::Separator{"Required Input Cell Data"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Parameters ITKOpeningByReconstructionImage::parameters() const
"For objects that are 1 pixel wide, use True.",
false));
params.insert(std::make_unique<BoolParameter>(
k_PreserveIntensities_Key, "PreserveIntensities",
k_PreserveIntensities_Key, "Preserve Intensities",
"Set/Get whether the original intensities of the image retained for those pixels unaffected by the opening by reconstruction. If Off, the output pixel contrast will be reduced.", false));

params.insertSeparator(Parameters::Separator{"Required Input Cell Data"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Geometry

## Description

This **Filter** extracts any **Triangles** from the supplied **Triangle Geometry** that contain any *internal nodes*, then uses these extracted **Triangles** to create a new **Data Container** with the reduced **Triangle Geometry**. This operation is the same as removing all **Triangles** that only lie of the outer surface of the supplied **Triangle Geometry**. The user must supply a **Vertex Attribute Array** that defines the type for each node of the **Triangle Geometry**. Node types may take the following values:
This **Filter** extracts any **Triangles** from the supplied **Triangle Geometry** that contain any *internal nodes*, then uses these extracted **Triangles** to create a new **Data Container** with the reduced **Triangle Geometry**. This operation is the same as removing all **Triangles** that only lie of the outer surface of the supplied **Triangle Geometry**. The user must supply a "Node Type" **Vertex Attribute Array** that defines the type for each node of the **Triangle Geometry**. Node types may take the following values:

### Quick Surface Mesh

| Id Value | Node Type |
|----------|-----------|
Expand All @@ -17,7 +19,18 @@ This **Filter** extracts any **Triangles** from the supplied **Triangle Geometry
| 13 | Triple Line on the outer surface |
| 14 | Quadruple Point on the outer surface |

This **Filter** has the effect of removing any **Triangles** that only contain **Vertices** whose node Id values are 12, 13, or 14. In general, this *node type* array is created when the original surface mesh is created.
### SurfaceNets Mesh

| Id Value | Node Type |
|----------|-----------|
| 0 | Normal **Vertex |
| 3 | Triple Line |
| 4-8 | Quadruple Point |
| 13 | Normal **Vertex** on the outer surface |
| 14 | Triple Line on the outer surface |
| 15-18 | Quadruple Point on the outer surface |

This **Filter** has the effect of removing any **Triangles** that only contain **Vertices** whose node Id values fall outside of the min and max that the user sets. In general, this *node type* array is created when the original surface mesh is created.

It is unknown until runtime how the **Geometry** will be changed by removing certain **Vertices** and **Triangles**.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/Plugins/SimplnxCore/docs/SurfaceNetsFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ SurfaceNets output **with** the built-in smoothing operation applied.

---------------

## Node Types

During the meshing process, each vertex, or node, will get a "Node Type" value assigned to it. These will range from 0 to 6. The value is an internal representation from the SurfaceNets algorithm. They are roughly equivelent to the Node Types from the Quick Surface Mesh algorithm but not strictly the same.

- Node Type = 0: This is a node that ONLY has 2 features connected to the node.
- Node Type = 2: This is a node that has 3 features connected to the node, such as a triple line
- Node Type = 3-6: These nodes have 4 or more features connected to the node.


| Node Type | Example Image |
|-----------|----------------------------------------------|
| 0 | ![Node Type 0](Images/SurfaceNets_NodeType_0.png)|
| 2 | ![Node Type 2](Images/SurfaceNets_NodeType_2.png)|
| 3 | ![Node Type 3](Images/SurfaceNets_NodeType_3.png)|
| 4 | ![Node Type 4](Images/SurfaceNets_NodeType_4.png)|
| 6 | ![Node Type 6](Images/SurfaceNets_NodeType_6.png)|

### Exterior or Boundary Nodes

Nodes that appear on the exterior of a volume have Node Type values starting at 10 and going up from there. For instance, a triple line that is also on the exterior of the volume should have a value of 12.

![Exterior Node Types](Images/SurfaceNets_NodeType_Exterior.png)

% Auto generated parameter table will be inserted here

## Example Pipelines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ Parameters ExtractInternalSurfacesFromTriangleGeometry::parameters() const
params.insertSeparator(Parameters::Separator{"Input Vertex Data"});
params.insert(std::make_unique<ArraySelectionParameter>(k_NodeTypesPath_Key, "Node Types Array", "Path to the Node Types array", DataPath(), ArraySelectionParameter::AllowedTypes{DataType::int8},
ArraySelectionParameter::AllowedComponentShapes{{1}}));
params.insert(std::make_unique<VectorInt8Parameter>(k_NodeTypeRange_Key, "Internal Surface Node Type Min & Max",
"The min and max (inclusive) Node Type values that distinguish an internal surface from an external surface", std::vector<int8>{0, 8},
std::vector<std::string>{"Min", "Max"}));

params.insertSeparator(Parameters::Separator{"Create Data Objects"});
params.insertSeparator(Parameters::Separator{"Created Data Objects"});
params.insert(std::make_unique<DataGroupCreationParameter>(k_InternalTriangleGeom_Key, "Created Triangle Geometry Path", "Path to create the new Triangle Geometry", DataPath()));
params.insert(std::make_unique<DataObjectNameParameter>(k_VertexDataName_Key, "Vertex Data Attribute Matrix", "Created vertex data AttributeMatrix name", INodeGeometry0D::k_VertexDataName));
params.insert(std::make_unique<DataObjectNameParameter>(k_FaceDataName_Key, "Face Data Attribute Matrix", "Created face data AttributeMatrix name", INodeGeometry2D::k_FaceDataName));
Expand Down Expand Up @@ -263,6 +266,8 @@ Result<> ExtractInternalSurfacesFromTriangleGeometry::executeImpl(DataStructure&
auto vertexDataName = args.value<std::string>(k_VertexDataName_Key);
auto faceDataName = args.value<std::string>(k_FaceDataName_Key);

auto minMaxNodeValues = args.value<VectorInt8Parameter::ValueType>(k_NodeTypeRange_Key);

auto& triangleGeom = data.getDataRefAs<TriangleGeom>(triangleGeomPath);
auto& internalTriangleGeom = data.getDataRefAs<TriangleGeom>(internalTrianglesPath);
auto& vertices = *triangleGeom.getVertices();
Expand Down Expand Up @@ -298,7 +303,8 @@ Result<> ExtractInternalSurfacesFromTriangleGeometry::executeImpl(DataStructure&
MeshIndexType v1Index = triangles[3 * triIndex + 1];
MeshIndexType v2Index = triangles[3 * triIndex + 2];
// Check if the NodeType is either 2, 3, 4
if((nodeTypes[v0Index] >= 2 && nodeTypes[v0Index] <= 4) && (nodeTypes[v1Index] >= 2 && nodeTypes[v1Index] <= 4) && (nodeTypes[v2Index] >= 2 && nodeTypes[v2Index] <= 4))
if((nodeTypes[v0Index] >= minMaxNodeValues[0] && nodeTypes[v0Index] <= minMaxNodeValues[1]) && (nodeTypes[v1Index] >= minMaxNodeValues[0] && nodeTypes[v1Index] <= minMaxNodeValues[1]) &&
(nodeTypes[v2Index] >= minMaxNodeValues[0] && nodeTypes[v2Index] <= minMaxNodeValues[1]))
{
// All Nodes are the correct type
triNewIndex[triIndex] = currentNewTriIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SIMPLNXCORE_EXPORT ExtractInternalSurfacesFromTriangleGeometry : public IF
static inline constexpr StringLiteral k_CopyTrianglePaths_Key = "copy_triangle_array_paths";
static inline constexpr StringLiteral k_VertexDataName_Key = "vertex_data_name";
static inline constexpr StringLiteral k_FaceDataName_Key = "face_data_name";
static inline constexpr StringLiteral k_NodeTypeRange_Key = "node_type_range";

/**
* @brief Reads SIMPL json and converts it simplnx Arguments.
Expand Down

0 comments on commit d43cc50

Please sign in to comment.