Skip to content

Commit

Permalink
FILTER: RemoveFlaggedTriangles.
Browse files Browse the repository at this point in the history
Code is stubbed out only.

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Aug 28, 2023
1 parent a85bfd3 commit 44aac8f
Show file tree
Hide file tree
Showing 9 changed files with 488 additions and 38 deletions.
12 changes: 7 additions & 5 deletions src/Plugins/ComplexCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ set(FilterList
ChangeAngleRepresentation
CombineAttributeArraysFilter
CombineStlFilesFilter
ComputeMomentInvariants2DFilter
ComputeFeatureRectFilter
ComputeMomentInvariants2DFilter
ConditionalSetValue
ConvertColorToGrayScaleFilter
ConvertDataFilter
Expand Down Expand Up @@ -58,8 +58,8 @@ set(FilterList
FindEuclideanDistMapFilter
FindFeatureCentroidsFilter
FindFeatureClusteringFilter
FindFeaturePhasesFilter
FindFeaturePhasesBinaryFilter
FindFeaturePhasesFilter
FindLargestCrossSectionsFilter
FindNeighborhoodsFilter
FindNeighborListStatistics
Expand All @@ -73,8 +73,8 @@ set(FilterList
FindVolFractionsFilter
GenerateColorTableFilter
GenerateVectorColorsFilter
ImageContouringFilter
IdentifySample
ImageContouringFilter
ImportBinaryCTNorthstarFilter
ImportCSVDataFilter
ImportDeformKeyFileV12Filter
Expand All @@ -100,6 +100,7 @@ set(FilterList
RawBinaryReaderFilter
RegularGridSampleSurfaceMeshFilter
RemoveFlaggedFeaturesFilter
RemoveFlaggedTrianglesFilter
RemoveFlaggedVertices
RemoveMinimumSizeFeaturesFilter
RenameDataObject
Expand Down Expand Up @@ -141,8 +142,8 @@ set(AlgorithmList
CalculateArrayHistogram
CombineAttributeArrays
CombineStlFiles
ComputeMomentInvariants2D
ComputeFeatureRect
ComputeMomentInvariants2D
ConvertColorToGrayScale
ConvertData
ErodeDilateBadData
Expand All @@ -167,9 +168,9 @@ set(AlgorithmList
GenerateColorTable
GenerateVectorColors
ImageContouring
ImportBinaryCTNorthstar
ImportDeformKeyFileV12
ImportVolumeGraphicsFile
ImportBinaryCTNorthstar
KMeans
KMedoids
LaplacianSmoothing
Expand All @@ -181,6 +182,7 @@ set(AlgorithmList
RawBinaryReader
RegularGridSampleSurfaceMesh
RemoveFlaggedFeatures
RemoveFlaggedTriangles
ReplaceElementAttributesWithNeighborValues
ResampleImageGeom
ResampleRectGridToImageGeom
Expand Down
51 changes: 51 additions & 0 deletions src/Plugins/ComplexCore/docs/RemoveFlaggedTrianglesFilter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Remove Flagged Triangles #

## Group (Subgroup) ##

Surface Meshing (Misc)

## Description ##

This **Filter** removes **Triangles** from the supplied **Triangle Geometry** that are flagged by a boolean mask array.
Specifically, **Triangles** flagged as _true_ are removed from the **Geometry**. A new reduced **Triangle Geometry** is created
that contains all the remaining **Triangles**. It is unknown until run time how many **Triangles** will be removed from the
**Geometry**. Therefore, this **Filter** requires that a new **Data Container** be created to contain the reduced **Triangle Geometry**.
This new **Data Container** will NOT contain copies of any **Feature** or **Ensemble** **Attribute Matrices** from the original **Data Container**.
Additionally, all **Vertex** data will be copied, with tuples _removed_ for any **Vertices** removed by the **Filter**.
The user must supply a name for the reduced **Data Container**.

_Note:_ Since it cannot be known before run time how many **Vertices** will be removed, the new **Vertex Geometry** and
all associated **Vertex** data to be copied will be initialized to have size 0.

## Parameters ##

None

## Required Geometry ###

**Triangle Geometry**

## Required Objects ##

| Kind | Default Name | Type | Component Dimensions | Description |
|------|--------------|------|----------------------|---------------------------------------------------------------------|
| **Data Container** | TriangleDataContainer | N/A | N/A | **Data Container** holding the **Triangle Geometry** to reduce |
| **Triangle Attribute Array** | Mask | bool | (1) | Mask array specifying which **Triangles** to remove |

## Created Objects ##

| Kind | Default Name | Type | Component Dimensions | Description |
|----------------------------|----------------------------|------|----------------------|------------------------------------------------------------|
| Reduced **Data Container** | ReducedVertexDataContainer | N/A | N/A | **Data Container** holding the reduced **Vertex Geometry** |

## Example Pipelines ##



## License & Copyright ##

Please see the description file distributed with this plugin.

## DREAM3D Mailing Lists ##

If you need more help with a filter, please consider asking your question on the DREAM3D Users mailing list:
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@
#include <string>

// clang-format off
#include "ComplexCore/Filters/AbaqusHexahedronWriterFilter.hpp"
#include "ComplexCore/Filters/AddBadDataFilter.hpp"
#include "ComplexCore/Filters/AlignGeometries.hpp"
#include "ComplexCore/Filters/AlignSectionsFeatureCentroidFilter.hpp"
#include "ComplexCore/Filters/AlignSectionsListFilter.hpp"
#include "ComplexCore/Filters/AppendImageGeometryZSliceFilter.hpp"
#include "ComplexCore/Filters/ApplyTransformationToGeometryFilter.hpp"
#include "ComplexCore/Filters/ApplyTransformationToGeometryFilter.hpp"
#include "ComplexCore/Filters/ApproximatePointCloudHull.hpp"
#include "ComplexCore/Filters/ArrayCalculatorFilter.hpp"
#include "ComplexCore/Filters/AvizoRectilinearCoordinateWriterFilter.hpp"
#include "ComplexCore/Filters/AvizoUniformCoordinateWriterFilter.hpp"
#include "ComplexCore/Filters/CalculateArrayHistogramFilter.hpp"
#include "ComplexCore/Filters/CalculateFeatureSizesFilter.hpp"
#include "ComplexCore/Filters/CalculateTriangleAreasFilter.hpp"
#include "ComplexCore/Filters/ChangeAngleRepresentation.hpp"
#include "ComplexCore/Filters/CombineAttributeArraysFilter.hpp"
#include "ComplexCore/Filters/CombineStlFilesFilter.hpp"
#include "ComplexCore/Filters/ComputeFeatureRectFilter.hpp"
#include "ComplexCore/Filters/ComputeMomentInvariants2DFilter.hpp"
#include "ComplexCore/Filters/ConditionalSetValue.hpp"
#include "ComplexCore/Filters/ConvertColorToGrayScaleFilter.hpp"
#include "ComplexCore/Filters/ConvertDataFilter.hpp"
Expand All @@ -28,31 +37,37 @@
#include "ComplexCore/Filters/CropImageGeometry.hpp"
#include "ComplexCore/Filters/CropVertexGeometry.hpp"
#include "ComplexCore/Filters/DeleteData.hpp"
#include "ComplexCore/Filters/ErodeDilateBadDataFilter.hpp"
#include "ComplexCore/Filters/ErodeDilateCoordinationNumberFilter.hpp"
#include "ComplexCore/Filters/ErodeDilateMaskFilter.hpp"
#include "ComplexCore/Filters/ErodeDilateBadDataFilter.hpp"
#include "ComplexCore/Filters/ExecuteProcessFilter.hpp"
#include "ComplexCore/Filters/ExecuteProcessFilter.hpp"
#include "ComplexCore/Filters/ExportDREAM3DFilter.hpp"
#include "ComplexCore/Filters/ExtractComponentAsArrayFilter.hpp"
#include "ComplexCore/Filters/ExtractInternalSurfacesFromTriangleGeometry.hpp"
#include "ComplexCore/Filters/FeatureDataCSVWriterFilter.hpp"
#include "ComplexCore/Filters/FillBadDataFilter.hpp"
#include "ComplexCore/Filters/FindArrayStatisticsFilter.hpp"
#include "ComplexCore/Filters/FindBoundaryCellsFilter.hpp"
#include "ComplexCore/Filters/FindBiasedFeaturesFilter.hpp"
#include "ComplexCore/Filters/FindBoundaryCellsFilter.hpp"
#include "ComplexCore/Filters/FindBoundaryElementFractionsFilter.hpp"
#include "ComplexCore/Filters/FindDifferencesMap.hpp"
#include "ComplexCore/Filters/FindEuclideanDistMapFilter.hpp"
#include "ComplexCore/Filters/FindFeatureCentroidsFilter.hpp"
#include "ComplexCore/Filters/FindFeaturePhasesFilter.hpp"
#include "ComplexCore/Filters/FindFeatureClusteringFilter.hpp"
#include "ComplexCore/Filters/FindFeaturePhasesBinaryFilter.hpp"
#include "ComplexCore/Filters/FindFeaturePhasesFilter.hpp"
#include "ComplexCore/Filters/FindLargestCrossSectionsFilter.hpp"
#include "ComplexCore/Filters/FindNeighborhoodsFilter.hpp"
#include "ComplexCore/Filters/FindNeighborListStatistics.hpp"
#include "ComplexCore/Filters/FindNeighbors.hpp"
#include "ComplexCore/Filters/FindNumFeaturesFilter.hpp"
#include "ComplexCore/Filters/FindSurfaceAreaToVolumeFilter.hpp"
#include "ComplexCore/Filters/FindSurfaceFeatures.hpp"
#include "ComplexCore/Filters/FindVertexToTriangleDistancesFilter.hpp"
#include "ComplexCore/Filters/FindVolFractionsFilter.hpp"
#include "ComplexCore/Filters/GenerateColorTableFilter.hpp"
#include "ComplexCore/Filters/GenerateVectorColorsFilter.hpp"
#include "ComplexCore/Filters/IdentifySample.hpp"
#include "ComplexCore/Filters/ImportBinaryCTNorthstarFilter.hpp"
#include "ComplexCore/Filters/ImportCSVDataFilter.hpp"
Expand All @@ -64,56 +79,42 @@
#include "ComplexCore/Filters/InitializeData.hpp"
#include "ComplexCore/Filters/InterpolatePointCloudToRegularGridFilter.hpp"
#include "ComplexCore/Filters/IterativeClosestPointFilter.hpp"
#include "ComplexCore/Filters/KMeansFilter.hpp"
#include "ComplexCore/Filters/KMedoidsFilter.hpp"
#include "ComplexCore/Filters/LaplacianSmoothingFilter.hpp"
#include "ComplexCore/Filters/LosAlamosFFTWriterFilter.hpp"
#include "ComplexCore/Filters/MapPointCloudToRegularGridFilter.hpp"
#include "ComplexCore/Filters/MinNeighbors.hpp"
#include "ComplexCore/Filters/MoveData.hpp"
#include "ComplexCore/Filters/MultiThresholdObjects.hpp"
#include "ComplexCore/Filters/NearestPointFuseRegularGridsFilter.hpp"
#include "ComplexCore/Filters/PointSampleTriangleGeometryFilter.hpp"
#include "ComplexCore/Filters/QuickSurfaceMeshFilter.hpp"
#include "ComplexCore/Filters/RawBinaryReaderFilter.hpp"
#include "ComplexCore/Filters/RegularGridSampleSurfaceMeshFilter.hpp"
#include "ComplexCore/Filters/RemoveFlaggedFeaturesFilter.hpp"
#include "ComplexCore/Filters/RemoveFlaggedTrianglesFilter.hpp"
#include "ComplexCore/Filters/RemoveFlaggedVertices.hpp"
#include "ComplexCore/Filters/RemoveMinimumSizeFeaturesFilter.hpp"
#include "ComplexCore/Filters/RenameDataObject.hpp"
#include "ComplexCore/Filters/ReplaceElementAttributesWithNeighborValuesFilter.hpp"
#include "ComplexCore/Filters/ResampleImageGeomFilter.hpp"
#include "ComplexCore/Filters/ResampleRectGridToImageGeomFilter.hpp"
#include "ComplexCore/Filters/ReverseTriangleWindingFilter.hpp"
#include "ComplexCore/Filters/RobustAutomaticThreshold.hpp"
#include "ComplexCore/Filters/RotateSampleRefFrameFilter.hpp"
#include "ComplexCore/Filters/ScalarSegmentFeaturesFilter.hpp"
#include "ComplexCore/Filters/SetImageGeomOriginScalingFilter.hpp"
#include "ComplexCore/Filters/SilhouetteFilter.hpp"
#include "ComplexCore/Filters/SplitAttributeArrayFilter.hpp"
#include "ComplexCore/Filters/StlFileReaderFilter.hpp"
#include "ComplexCore/Filters/TriangleCentroidFilter.hpp"
#include "ComplexCore/Filters/TriangleDihedralAngleFilter.hpp"
#include "ComplexCore/Filters/TriangleNormalFilter.hpp"
#include "ComplexCore/Filters/UncertainRegularGridSampleSurfaceMeshFilter.hpp"
#include "ComplexCore/Filters/VtkRectilinearGridWriterFilter.hpp"
#include "ComplexCore/Filters/WriteASCIIDataFilter.hpp"
#include "ComplexCore/Filters/RemoveFlaggedFeaturesFilter.hpp"
#include "ComplexCore/Filters/ComputeMomentInvariants2DFilter.hpp"
#include "ComplexCore/Filters/ExecuteProcessFilter.hpp"
#include "ComplexCore/Filters/FindVertexToTriangleDistancesFilter.hpp"
#include "ComplexCore/Filters/ApplyTransformationToGeometryFilter.hpp"
#include "ComplexCore/Filters/ComputeFeatureRectFilter.hpp"
#include "ComplexCore/Filters/FindLargestCrossSectionsFilter.hpp"
#include "ComplexCore/Filters/WriteStlFileFilter.hpp"
#include "ComplexCore/Filters/AddBadDataFilter.hpp"
#include "ComplexCore/Filters/AppendImageGeometryZSliceFilter.hpp"
#include "ComplexCore/Filters/FindFeatureClusteringFilter.hpp"
#include "ComplexCore/Filters/AbaqusHexahedronWriterFilter.hpp"
#include "ComplexCore/Filters/NearestPointFuseRegularGridsFilter.hpp"
#include "ComplexCore/Filters/ResampleRectGridToImageGeomFilter.hpp"
#include "ComplexCore/Filters/CombineStlFilesFilter.hpp"
#include "ComplexCore/Filters/AvizoUniformCoordinateWriterFilter.hpp"
#include "ComplexCore/Filters/AvizoRectilinearCoordinateWriterFilter.hpp"
#include "ComplexCore/Filters/VtkRectilinearGridWriterFilter.hpp"
#include "ComplexCore/Filters/RegularGridSampleSurfaceMeshFilter.hpp"
#include "ComplexCore/Filters/UncertainRegularGridSampleSurfaceMeshFilter.hpp"
#include "ComplexCore/Filters/FindBoundaryElementFractionsFilter.hpp"
#include "ComplexCore/Filters/ReverseTriangleWindingFilter.hpp"
#include "ComplexCore/Filters/LosAlamosFFTWriterFilter.hpp"
#include "ComplexCore/Filters/GenerateVectorColorsFilter.hpp"
#include "ComplexCore/Filters/KMedoidsFilter.hpp"
#include "ComplexCore/Filters/KMeansFilter.hpp"
#include "ComplexCore/Filters/SilhouetteFilter.hpp"
// @@__HEADER__TOKEN__DO__NOT__DELETE__@@

namespace complex
Expand Down Expand Up @@ -237,6 +238,7 @@ namespace complex
{complex::Uuid::FromString("f7486aa6-3049-5be7-8511-ae772b70c90b").value(), complex::FilterTraits<KMedoidsFilter>::uuid}, // KMedoids
{complex::Uuid::FromString("b56a04de-0ca0-509d-809f-52219fca9c98").value(), complex::FilterTraits<KMeansFilter>::uuid}, // KMeans
{complex::Uuid::FromString("f84d4d69-9ea5-54b6-a71c-df76d76d50cf").value(), complex::FilterTraits<SilhouetteFilter>::uuid}, // Silhouette
{complex::Uuid::FromString("379ccc67-16dd-530a-984f-177db9351bac").value(), complex::FilterTraits<RemoveFlaggedTrianglesFilter>::uuid}, // RemoveFlaggedTriangles
// @@__MAP__UPDATE__TOKEN__DO__NOT__DELETE__@@
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "RemoveFlaggedTriangles.hpp"

#include "complex/DataStructure/DataArray.hpp"
#include "complex/DataStructure/DataGroup.hpp"

using namespace complex;

// -----------------------------------------------------------------------------
RemoveFlaggedTriangles::RemoveFlaggedTriangles(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, RemoveFlaggedTrianglesInputValues* inputValues)
: m_DataStructure(dataStructure)
, m_InputValues(inputValues)
, m_ShouldCancel(shouldCancel)
, m_MessageHandler(mesgHandler)
{
}

// -----------------------------------------------------------------------------
RemoveFlaggedTriangles::~RemoveFlaggedTriangles() noexcept = default;

// -----------------------------------------------------------------------------
const std::atomic_bool& RemoveFlaggedTriangles::getCancel()
{
return m_ShouldCancel;
}

// -----------------------------------------------------------------------------
Result<> RemoveFlaggedTriangles::operator()()
{
/**
* This section of the code should contain the actual algorithmic codes that
* will accomplish the goal of the file.
*
* If you can parallelize the code there are a number of examples on how to do that.
* GenerateIPFColors is one example
*
* If you need to determine what kind of array you have (Int32Array, Float32Array, etc)
* look to the ExecuteDataFunction() in complex/Utilities/FilterUtilities.hpp template
* function to help with that code.
* An Example algorithm class is `CombineAttributeArrays` and `RemoveFlaggedVertices`
*
* There are other utility classes that can help alleviate the amount of code that needs
* to be written.
*
* REMOVE THIS COMMENT BLOCK WHEN YOU ARE FINISHED WITH THE FILTER_HUMAN_NAME
*/

return {};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#pragma once

#include "ComplexCore/ComplexCore_export.hpp"

#include "complex/DataStructure/DataPath.hpp"
#include "complex/DataStructure/DataStructure.hpp"
#include "complex/Filter/IFilter.hpp"
#include "complex/Parameters/DataGroupSelectionParameter.hpp"
#include "complex/Parameters/ArraySelectionParameter.hpp"
#include "complex/Parameters/ArraySelectionParameter.hpp"
#include "complex/Parameters/StringParameter.hpp"


/**
* This is example code to put in the Execute Method of the filter.
RemoveFlaggedTrianglesInputValues inputValues;
inputValues.TriangleGeometry = filterArgs.value<DataPath>(k_TriangleGeometry_Key);
inputValues.MaskArrayPath = filterArgs.value<DataPath>(k_MaskArrayPath_Key);
inputValues.RegionIDsArrayPath = filterArgs.value<DataPath>(k_RegionIDsArrayPath_Key);
inputValues.ReducedTriangleGeometry = filterArgs.value<StringParameter::ValueType>(k_ReducedTriangleGeometry_Key);
return RemoveFlaggedTriangles(dataStructure, messageHandler, shouldCancel, &inputValues)();
*/

namespace complex
{

struct COMPLEXCORE_EXPORT RemoveFlaggedTrianglesInputValues
{
DataPath TriangleGeometry;
DataPath MaskArrayPath;
DataPath RegionIDsArrayPath;
StringParameter::ValueType ReducedTriangleGeometry;

};

/**
* @class ConditionalSetValue
* @brief This filter replaces values in the target array with a user specified value
* where a bool mask array specifies.
*/

class COMPLEXCORE_EXPORT RemoveFlaggedTriangles
{
public:
RemoveFlaggedTriangles(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, RemoveFlaggedTrianglesInputValues* inputValues);
~RemoveFlaggedTriangles() noexcept;

RemoveFlaggedTriangles(const RemoveFlaggedTriangles&) = delete;
RemoveFlaggedTriangles(RemoveFlaggedTriangles&&) noexcept = delete;
RemoveFlaggedTriangles& operator=(const RemoveFlaggedTriangles&) = delete;
RemoveFlaggedTriangles& operator=(RemoveFlaggedTriangles&&) noexcept = delete;

Result<> operator()();

const std::atomic_bool& getCancel();

private:
DataStructure& m_DataStructure;
const RemoveFlaggedTrianglesInputValues* m_InputValues = nullptr;
const std::atomic_bool& m_ShouldCancel;
const IFilter::MessageHandler& m_MessageHandler;
};

} // namespace complex
Loading

0 comments on commit 44aac8f

Please sign in to comment.