diff --git a/src/Plugins/ComplexCore/CMakeLists.txt b/src/Plugins/ComplexCore/CMakeLists.txt index 74924bd44f..5dfb87596a 100644 --- a/src/Plugins/ComplexCore/CMakeLists.txt +++ b/src/Plugins/ComplexCore/CMakeLists.txt @@ -24,8 +24,8 @@ set(FilterList ChangeAngleRepresentation CombineAttributeArraysFilter CombineStlFilesFilter - ComputeMomentInvariants2DFilter ComputeFeatureRectFilter + ComputeMomentInvariants2DFilter ConditionalSetValue ConvertColorToGrayScaleFilter ConvertDataFilter @@ -58,8 +58,8 @@ set(FilterList FindEuclideanDistMapFilter FindFeatureCentroidsFilter FindFeatureClusteringFilter - FindFeaturePhasesFilter FindFeaturePhasesBinaryFilter + FindFeaturePhasesFilter FindLargestCrossSectionsFilter FindNeighborhoodsFilter FindNeighborListStatistics @@ -73,8 +73,8 @@ set(FilterList FindVolFractionsFilter GenerateColorTableFilter GenerateVectorColorsFilter - ImageContouringFilter IdentifySample + ImageContouringFilter ImportBinaryCTNorthstarFilter ImportCSVDataFilter ImportDeformKeyFileV12Filter @@ -100,6 +100,7 @@ set(FilterList RawBinaryReaderFilter RegularGridSampleSurfaceMeshFilter RemoveFlaggedFeaturesFilter + RemoveFlaggedTrianglesFilter RemoveFlaggedVertices RemoveMinimumSizeFeaturesFilter RenameDataObject @@ -141,8 +142,8 @@ set(AlgorithmList CalculateArrayHistogram CombineAttributeArrays CombineStlFiles - ComputeMomentInvariants2D ComputeFeatureRect + ComputeMomentInvariants2D ConvertColorToGrayScale ConvertData ErodeDilateBadData @@ -167,9 +168,9 @@ set(AlgorithmList GenerateColorTable GenerateVectorColors ImageContouring + ImportBinaryCTNorthstar ImportDeformKeyFileV12 ImportVolumeGraphicsFile - ImportBinaryCTNorthstar KMeans KMedoids LaplacianSmoothing @@ -181,6 +182,7 @@ set(AlgorithmList RawBinaryReader RegularGridSampleSurfaceMesh RemoveFlaggedFeatures + RemoveFlaggedTriangles ReplaceElementAttributesWithNeighborValues ResampleImageGeom ResampleRectGridToImageGeom diff --git a/src/Plugins/ComplexCore/docs/RemoveFlaggedTrianglesFilter.md b/src/Plugins/ComplexCore/docs/RemoveFlaggedTrianglesFilter.md new file mode 100644 index 0000000000..582694fe3c --- /dev/null +++ b/src/Plugins/ComplexCore/docs/RemoveFlaggedTrianglesFilter.md @@ -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: diff --git a/src/Plugins/ComplexCore/src/ComplexCore/ComplexCoreLegacyUUIDMapping.hpp b/src/Plugins/ComplexCore/src/ComplexCore/ComplexCoreLegacyUUIDMapping.hpp index ccb6b0bfca..0865b2c048 100644 --- a/src/Plugins/ComplexCore/src/ComplexCore/ComplexCoreLegacyUUIDMapping.hpp +++ b/src/Plugins/ComplexCore/src/ComplexCore/ComplexCoreLegacyUUIDMapping.hpp @@ -4,17 +4,26 @@ #include // 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" @@ -28,9 +37,10 @@ #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" @@ -38,21 +48,26 @@ #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" @@ -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 @@ -237,6 +238,7 @@ namespace complex {complex::Uuid::FromString("f7486aa6-3049-5be7-8511-ae772b70c90b").value(), complex::FilterTraits::uuid}, // KMedoids {complex::Uuid::FromString("b56a04de-0ca0-509d-809f-52219fca9c98").value(), complex::FilterTraits::uuid}, // KMeans {complex::Uuid::FromString("f84d4d69-9ea5-54b6-a71c-df76d76d50cf").value(), complex::FilterTraits::uuid}, // Silhouette + {complex::Uuid::FromString("379ccc67-16dd-530a-984f-177db9351bac").value(), complex::FilterTraits::uuid}, // RemoveFlaggedTriangles // @@__MAP__UPDATE__TOKEN__DO__NOT__DELETE__@@ }; diff --git a/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/RemoveFlaggedTriangles.cpp b/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/RemoveFlaggedTriangles.cpp new file mode 100644 index 0000000000..b33809fa8b --- /dev/null +++ b/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/RemoveFlaggedTriangles.cpp @@ -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 {}; +} diff --git a/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/RemoveFlaggedTriangles.hpp b/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/RemoveFlaggedTriangles.hpp new file mode 100644 index 0000000000..7e5ad4d7c9 --- /dev/null +++ b/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/RemoveFlaggedTriangles.hpp @@ -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(k_TriangleGeometry_Key); + inputValues.MaskArrayPath = filterArgs.value(k_MaskArrayPath_Key); + inputValues.RegionIDsArrayPath = filterArgs.value(k_RegionIDsArrayPath_Key); + inputValues.ReducedTriangleGeometry = filterArgs.value(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 diff --git a/src/Plugins/ComplexCore/src/ComplexCore/Filters/RemoveFlaggedTrianglesFilter.cpp b/src/Plugins/ComplexCore/src/ComplexCore/Filters/RemoveFlaggedTrianglesFilter.cpp new file mode 100644 index 0000000000..a53ac9cc85 --- /dev/null +++ b/src/Plugins/ComplexCore/src/ComplexCore/Filters/RemoveFlaggedTrianglesFilter.cpp @@ -0,0 +1,144 @@ +#include "RemoveFlaggedTrianglesFilter.hpp" + +#include "ComplexCore/Filters/Algorithms/RemoveFlaggedTriangles.hpp" + +#include "complex/DataStructure/DataPath.hpp" +#include "complex/Filter/Actions/EmptyAction.hpp" +#include "complex/Parameters/ArraySelectionParameter.hpp" +#include "complex/Parameters/DataGroupCreationParameter.hpp" +#include "complex/Parameters/DataGroupSelectionParameter.hpp" +#include "complex/Parameters/GeometrySelectionParameter.hpp" +#include "complex/Parameters/StringParameter.hpp" + +using namespace complex; + +namespace complex +{ +//------------------------------------------------------------------------------ +std::string RemoveFlaggedTrianglesFilter::name() const +{ + return FilterTraits::name.str(); +} + +//------------------------------------------------------------------------------ +std::string RemoveFlaggedTrianglesFilter::className() const +{ + return FilterTraits::className; +} + +//------------------------------------------------------------------------------ +Uuid RemoveFlaggedTrianglesFilter::uuid() const +{ + return FilterTraits::uuid; +} + +//------------------------------------------------------------------------------ +std::string RemoveFlaggedTrianglesFilter::humanName() const +{ + return "Remove Flagged Triangles"; +} + +//------------------------------------------------------------------------------ +std::vector RemoveFlaggedTrianglesFilter::defaultTags() const +{ + return {"Surface Meshing", "Cleanup"}; +} + +//------------------------------------------------------------------------------ +Parameters RemoveFlaggedTrianglesFilter::parameters() const +{ + Parameters params; + + // Create the parameter descriptors that are needed for this filter + params.insertSeparator(Parameters::Separator{"Required Input Geometry"}); + params.insert(std::make_unique(k_InputGeometry_Key, "Triangle|Quad Geometry", "The Triangle|Quad Geometry that will be processed.", DataPath(), + GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Triangle, IGeometry::Type::Quad})); + + params.insertSeparator(Parameters::Separator{"Required Input Cell Data"}); + params.insert(std::make_unique(k_MaskArrayPath_Key, "Mask", "The DataArrayPath to the mask array that marks each face as either true (remove) or false(keep).", DataPath{}, + complex::GetAllDataTypes() /* This will allow ANY data type. Adjust as necessary for your filter*/)); + + params.insertSeparator(Parameters::Separator{"Created Geometry"}); + params.insert(std::make_unique(k_OutputGeometry_Key, "Created Geometry", "The name of the created Triangle Geometry", DataPath({"OutputGeometry"}))); + return params; +} + +//------------------------------------------------------------------------------ +IFilter::UniquePointer RemoveFlaggedTrianglesFilter::clone() const +{ + return std::make_unique(); +} + +//------------------------------------------------------------------------------ +IFilter::PreflightResult RemoveFlaggedTrianglesFilter::preflightImpl(const DataStructure& dataStructure, const Arguments& filterArgs, const MessageHandler& messageHandler, + const std::atomic_bool& shouldCancel) const +{ + /**************************************************************************** + * Write any preflight sanity checking codes in this function + ***************************************************************************/ + + /** + * These are the values that were gathered from the UI or the pipeline file or + * otherwise passed into the filter. These are here for your convenience. If you + * do not need some of them remove them. + */ + auto pTriangleGeometryValue = filterArgs.value(k_InputGeometry_Key); + auto pMaskArrayPathValue = filterArgs.value(k_MaskArrayPath_Key); + auto pReducedTriangleGeometryValue = filterArgs.value(k_OutputGeometry_Key); + + // Declare the preflightResult variable that will be populated with the results + // of the preflight. The PreflightResult type contains the output Actions and + // any preflight updated values that you want to be displayed to the user, typically + // through a user interface (UI). + PreflightResult preflightResult; + + // If your filter is making structural changes to the DataStructure then the filter + // is going to create OutputActions subclasses that need to be returned. This will + // store those actions. + complex::Result resultOutputActions; + + // If your filter is going to pass back some `preflight updated values` then this is where you + // would create the code to store those values in the appropriate object. Note that we + // in line creating the pair (NOT a std::pair<>) of Key:Value that will get stored in + // the std::vector object. + std::vector preflightUpdatedValues; + + // If the filter needs to pass back some updated values via a key:value string:string set of values + // you can declare and update that string here. + // None found in this filter based on the filter parameters + + // If this filter makes changes to the DataStructure in the form of + // creating/deleting/moving/renaming DataGroups, Geometries, DataArrays then you + // will need to use one of the `*Actions` classes located in complex/Filter/Actions + // to relay that information to the preflight and execute methods. This is done by + // creating an instance of the Action class and then storing it in the resultOutputActions variable. + // This is done through a `push_back()` method combined with a `std::move()`. For the + // newly initiated to `std::move` once that code is executed what was once inside the Action class + // instance variable is *no longer there*. The memory has been moved. If you try to access that + // variable after this line you will probably get a crash or have subtle bugs. To ensure that this + // does not happen we suggest using braces `{}` to scope each of the action's declaration and store + // so that the programmer is not tempted to use the action instance past where it should be used. + // You have to create your own Actions class if there isn't something specific for your filter's needs + + // Store the preflight updated value(s) into the preflightUpdatedValues vector using + // the appropriate methods. + // None found based on the filter parameters + + // Return both the resultOutputActions and the preflightUpdatedValues via std::move() + return {std::move(resultOutputActions), std::move(preflightUpdatedValues)}; +} + +//------------------------------------------------------------------------------ +Result<> RemoveFlaggedTrianglesFilter::executeImpl(DataStructure& dataStructure, const Arguments& filterArgs, const PipelineFilter* pipelineNode, const MessageHandler& messageHandler, + const std::atomic_bool& shouldCancel) const +{ + + RemoveFlaggedTrianglesInputValues inputValues; + + inputValues.TriangleGeometry = filterArgs.value(k_InputGeometry_Key); + inputValues.MaskArrayPath = filterArgs.value(k_MaskArrayPath_Key); + inputValues.ReducedTriangleGeometry = filterArgs.value(k_OutputGeometry_Key); + + return RemoveFlaggedTriangles(dataStructure, messageHandler, shouldCancel, &inputValues)(); +} +} // namespace complex diff --git a/src/Plugins/ComplexCore/src/ComplexCore/Filters/RemoveFlaggedTrianglesFilter.hpp b/src/Plugins/ComplexCore/src/ComplexCore/Filters/RemoveFlaggedTrianglesFilter.hpp new file mode 100644 index 0000000000..fce279403f --- /dev/null +++ b/src/Plugins/ComplexCore/src/ComplexCore/Filters/RemoveFlaggedTrianglesFilter.hpp @@ -0,0 +1,99 @@ +#pragma once + +#include "ComplexCore/ComplexCore_export.hpp" + +#include "complex/Filter/FilterTraits.hpp" +#include "complex/Filter/IFilter.hpp" + +namespace complex +{ +/** + * @class RemoveFlaggedTrianglesFilter + * @brief This filter will .... + */ +class COMPLEXCORE_EXPORT RemoveFlaggedTrianglesFilter : public IFilter +{ +public: + RemoveFlaggedTrianglesFilter() = default; + ~RemoveFlaggedTrianglesFilter() noexcept override = default; + + RemoveFlaggedTrianglesFilter(const RemoveFlaggedTrianglesFilter&) = delete; + RemoveFlaggedTrianglesFilter(RemoveFlaggedTrianglesFilter&&) noexcept = delete; + + RemoveFlaggedTrianglesFilter& operator=(const RemoveFlaggedTrianglesFilter&) = delete; + RemoveFlaggedTrianglesFilter& operator=(RemoveFlaggedTrianglesFilter&&) noexcept = delete; + + // Parameter Keys + static inline constexpr StringLiteral k_InputGeometry_Key = "input_geometry"; + static inline constexpr StringLiteral k_MaskArrayPath_Key = "mask_array_path"; + static inline constexpr StringLiteral k_OutputGeometry_Key = "output_geometry"; + + /** + * @brief Returns the name of the filter. + * @return + */ + std::string name() const override; + + /** + * @brief Returns the C++ classname of this filter. + * @return + */ + std::string className() const override; + + /** + * @brief Returns the uuid of the filter. + * @return + */ + Uuid uuid() const override; + + /** + * @brief Returns the human readable name of the filter. + * @return + */ + std::string humanName() const override; + + /** + * @brief Returns the default tags for this filter. + * @return + */ + std::vector defaultTags() const override; + + /** + * @brief Returns the parameters of the filter (i.e. its inputs) + * @return + */ + Parameters parameters() const override; + + /** + * @brief Returns a copy of the filter. + * @return + */ + UniquePointer clone() const override; + +protected: + /** + * @brief Takes in a DataStructure and checks that the filter can be run on it with the given arguments. + * Returns any warnings/errors. Also returns the changes that would be applied to the DataStructure. + * Some parts of the actions may not be completely filled out if all the required information is not available at preflight time. + * @param ds The input DataStructure instance + * @param filterArgs These are the input values for each parameter that is required for the filter + * @param messageHandler The MessageHandler object + * @return Returns a Result object with error or warning values if any of those occurred during execution of this function + */ + PreflightResult preflightImpl(const DataStructure& ds, const Arguments& filterArgs, const MessageHandler& messageHandler, const std::atomic_bool& shouldCancel) const override; + + /** + * @brief Applies the filter's algorithm to the DataStructure with the given arguments. Returns any warnings/errors. + * On failure, there is no guarantee that the DataStructure is in a correct state. + * @param ds The input DataStructure instance + * @param filterArgs These are the input values for each parameter that is required for the filter + * @param messageHandler The MessageHandler object + * @return Returns a Result object with error or warning values if any of those occurred during execution of this function + */ + Result<> executeImpl(DataStructure & data, const Arguments& filterArgs, const PipelineFilter* pipelineNode, const MessageHandler& messageHandler, const std::atomic_bool& shouldCancel) + const override; +}; +} // namespace complex + +COMPLEX_DEF_FILTER_TRAITS(complex, RemoveFlaggedTrianglesFilter, "38155c61-2709-4731-be95-43745bb3f8d8"); +/* LEGACY UUID FOR THIS FILTER 379ccc67-16dd-530a-984f-177db9351bac */ diff --git a/src/Plugins/ComplexCore/test/CMakeLists.txt b/src/Plugins/ComplexCore/test/CMakeLists.txt index d8133694fb..6e7d63b934 100644 --- a/src/Plugins/ComplexCore/test/CMakeLists.txt +++ b/src/Plugins/ComplexCore/test/CMakeLists.txt @@ -23,8 +23,8 @@ set(${PLUGIN_NAME}UnitTest_SRCS ChangeAngleRepresentationTest.cpp CombineAttributeArraysTest.cpp CombineStlFilesTest.cpp - ComputeMomentInvariants2DTest.cpp ComputeFeatureRectTest.cpp + ComputeMomentInvariants2DTest.cpp ConditionalSetValueTest.cpp ConvertColorToGrayScaleTest.cpp ConvertDataTest.cpp @@ -57,8 +57,8 @@ set(${PLUGIN_NAME}UnitTest_SRCS FindEuclideanDistMapTest.cpp FindFeatureCentroidsFilterTest.cpp FindFeatureClusteringTest.cpp - FindFeaturePhasesFilterTest.cpp FindFeaturePhasesBinaryTest.cpp + FindFeaturePhasesFilterTest.cpp FindLargestCrossSectionsTest.cpp FindNeighborhoodsTest.cpp FindNeighborListStatisticsTest.cpp @@ -77,7 +77,6 @@ set(${PLUGIN_NAME}UnitTest_SRCS ImageGeomTest.cpp ImportBinaryCTNorthstarTest.cpp ImportCSVDataTest.cpp -# ImportDeformKeyFileV12Test.cpp ImportHDF5DatasetTest.cpp ImportTextTest.cpp ImportVolumeGraphicsFileTest.cpp @@ -88,10 +87,10 @@ set(${PLUGIN_NAME}UnitTest_SRCS KMedoidsTest.cpp LaplacianSmoothingFilterTest.cpp LosAlamosFFTWriterTest.cpp - MultiThresholdObjectsTest.cpp MapPointCloudToRegularGridTest.cpp MinNeighborsTest.cpp MoveDataTest.cpp + MultiThresholdObjectsTest.cpp NearestPointFuseRegularGridsTest.cpp PartitionGeometryTest.cpp PipelineTest.cpp @@ -100,6 +99,7 @@ set(${PLUGIN_NAME}UnitTest_SRCS RawBinaryReaderTest.cpp RegularGridSampleSurfaceMeshTest.cpp RemoveFlaggedFeaturesTest.cpp + RemoveFlaggedTrianglesTest.cpp RemoveFlaggedVerticesTest.cpp RemoveMinimumSizeFeaturesTest.cpp RenameDataObjectTest.cpp @@ -123,6 +123,7 @@ set(${PLUGIN_NAME}UnitTest_SRCS WriteASCIIDataTest.cpp WriteBinaryDataTest.cpp WriteStlFileTest.cpp +# ImportDeformKeyFileV12Test.cpp ) create_complex_plugin_unit_test(PLUGIN_NAME ${PLUGIN_NAME} diff --git a/src/Plugins/ComplexCore/test/RemoveFlaggedTrianglesTest.cpp b/src/Plugins/ComplexCore/test/RemoveFlaggedTrianglesTest.cpp new file mode 100644 index 0000000000..d2725f87f1 --- /dev/null +++ b/src/Plugins/ComplexCore/test/RemoveFlaggedTrianglesTest.cpp @@ -0,0 +1,37 @@ +#include + +#include "complex/Parameters/StringParameter.hpp" +#include "complex/Parameters/DataGroupSelectionParameter.hpp" +#include "complex/Parameters/ArraySelectionParameter.hpp" + +#include "ComplexCore/Filters/RemoveFlaggedTrianglesFilter.hpp" +#include "ComplexCore/ComplexCore_test_dirs.hpp" + +using namespace complex; + +TEST_CASE("ComplexCore::RemoveFlaggedTrianglesFilter: Valid Filter Execution","[ComplexCore][RemoveFlaggedTrianglesFilter][.][UNIMPLEMENTED][!mayfail]") +{ + // Instantiate the filter, a DataStructure object and an Arguments Object + RemoveFlaggedTrianglesFilter filter; + DataStructure ds; + Arguments args; + + // Create default Parameters for the filter. + args.insertOrAssign(RemoveFlaggedTrianglesFilter::k_InputGeometry_Key, std::make_any(DataPath{})); + args.insertOrAssign(RemoveFlaggedTrianglesFilter::k_MaskArrayPath_Key, std::make_any(DataPath{})); + args.insertOrAssign(RemoveFlaggedTrianglesFilter::k_OutputGeometry_Key, std::make_any(DataPath{})); + + + // Preflight the filter and check result + auto preflightResult = filter.preflight(ds, args); + REQUIRE(preflightResult.outputActions.valid()); + + // Execute the filter and check the result + auto executeResult = filter.execute(ds, args); + REQUIRE(executeResult.result.valid()); +} + +//TEST_CASE("ComplexCore::RemoveFlaggedTrianglesFilter: InValid Filter Execution") +//{ +// +//}