diff --git a/CMakeLists.txt b/CMakeLists.txt index ca682c2..6d22024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,6 @@ set(FilterList ComputeLocalAverageCAxisMisalignmentsFilter ComputeMicroTextureRegionsFilter ComputeSaltykovSizesFilter - GroupMicroTextureRegionsFilter InterpolateValuesToUnstructuredGridFilter MergeColoniesFilter ) @@ -49,7 +48,6 @@ set(AlgorithmList ComputeLocalAverageCAxisMisalignments ComputeMicroTextureRegions ComputeSaltykovSizes - GroupMicroTextureRegions InterpolateValuesToUnstructuredGrid MergeColonies ) diff --git a/docs/GroupMicroTextureRegionsFilter.md b/docs/GroupMicroTextureRegionsFilter.md deleted file mode 100644 index cf6f8e3..0000000 --- a/docs/GroupMicroTextureRegionsFilter.md +++ /dev/null @@ -1,30 +0,0 @@ -# Group MicroTexture Regions - -**THIS FILTER IS UNTESTED, UNVERIFIED AND UNVALIDATED. IT IS AN EXPERIMENTAL FILTER THAT IS UNDERGOING LONG TERM DEVELOPMENT -AND TESTING. USE AT YOUR OWN RISK** - -## Group (Subgroup) - -Reconstruction Filters (Grouping) - -## Description - -This Filter groups neighboring **Features** that have c-axes aligned within a user defined tolerance. The algorithm for grouping the **Features** is analogous to the algorithm for segmenting the **Features** - only the average orientation of the **Features** are used instead of the orientations of the individual **Cells** and the criterion for grouping only considers the alignment of the c-axes. The user can specify a tolerance for how closely aligned the c-axes must be for neighbor **Features** to be grouped. - -NOTE: This filter is intended for use with *Hexagonal* materials. While the c-axis is actually just referring to the <001> direction and thus will operate on any symmetry, the utility of grouping by <001> alignment is likely only important/useful in materials with anisotropy in that direction (like materials with *Hexagonal* symmetry). - -Developer Note: It is **very important** for end users to **seed** the data if they *ever* intend to replicate the calculations. The randomness involed in this filter aims to help avoid bias developing in the output, however with out of core this will severely slow down the calculations at runtime. In order to remedy this we are in the process of developing a floodfill method, but the bias formed by sequential parsing is something one should consider when utilizing this method. - -% Auto generated parameter table will be inserted here - -## References - -## 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](https://github.com/BlueQuartzSoftware/DREAM3DNX-Issues/discussions) GitHub site where the community of DREAM3D-NX users can help answer your questions. diff --git a/src/SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.cpp b/src/SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.cpp deleted file mode 100644 index 317baed..0000000 --- a/src/SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.cpp +++ /dev/null @@ -1,337 +0,0 @@ -#include "GroupMicroTextureRegions.hpp" - -#include "simplnx/Common/Constants.hpp" -#include "simplnx/DataStructure/DataArray.hpp" -#include "simplnx/DataStructure/NeighborList.hpp" -#include "simplnx/Utilities/Math/GeometryMath.hpp" -#include "simplnx/Utilities/MessageHelper.hpp" - -#include "EbsdLib/LaueOps/LaueOps.h" - -#include - -using namespace nx::core; - -// ----------------------------------------------------------------------------- -GroupMicroTextureRegions::GroupMicroTextureRegions(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, - GroupMicroTextureRegionsInputValues* inputValues) -: m_DataStructure(dataStructure) -, m_InputValues(inputValues) -, m_ShouldCancel(shouldCancel) -, m_MessageHandler(mesgHandler) -, m_FeaturePhases(m_DataStructure.getDataRefAs(m_InputValues->FeaturePhasesArrayPath)) -, m_FeatureParentIds(m_DataStructure.getDataRefAs(m_InputValues->FeatureParentIdsArrayName)) -, m_CrystalStructures(m_DataStructure.getDataRefAs(m_InputValues->CrystalStructuresArrayPath)) -, m_AvgQuats(m_DataStructure.getDataRefAs(m_InputValues->AvgQuatsArrayPath)) -, m_Volumes(m_DataStructure.getDataRefAs(m_InputValues->VolumesArrayPath)) -{ -} - -// ----------------------------------------------------------------------------- -GroupMicroTextureRegions::~GroupMicroTextureRegions() noexcept = default; - -// ----------------------------------------------------------------------------- -const std::atomic_bool& GroupMicroTextureRegions::getCancel() -{ - return m_ShouldCancel; -} - -// ----------------------------------------------------------------------------- -bool GroupMicroTextureRegions::growPatch(int32_t currentPatch) -{ - return false; -} - -// ----------------------------------------------------------------------------- -bool GroupMicroTextureRegions::growGrouping(int32_t referenceFeature, int32_t neighborFeature, int32_t newFid) -{ - return false; -} - -// ----------------------------------------------------------------------------- -Result<> GroupMicroTextureRegions::execute() -{ - MessageHelper messageHelper(m_MessageHandler); - ThrottledMessenger throttledMessenger = messageHelper.createThrottledMessenger(); - - NeighborList& featureNeighborListRef = m_DataStructure.getDataRefAs>(m_InputValues->ContiguousNeighborListArrayPath); - NeighborList* nonContigNeighListPtr = nullptr; - if(m_InputValues->UseNonContiguousNeighbors) - { - nonContigNeighListPtr = m_DataStructure.getDataAs>(m_InputValues->NonContiguousNeighborListArrayPath); - } - if(nullptr == nonContigNeighListPtr) - { - return MakeErrorResult(-99345, "There was an error getting the Non-contiguous neighborlist from the DataStructure"); - } - - std::vector groupList; - - int32 parentCount = 0; - int32 featureSeed = 0; - int32 list1size = 0, list2size = 0, listSize = 0; - - bool patchGrouping = false; - - while(featureSeed >= 0) - { - parentCount++; - featureSeed = getSeed(parentCount); - if(featureSeed >= 0) - { - groupList.push_back(featureSeed); - for(std::vector::size_type j = 0; j < groupList.size(); j++) - { - int32 firstFeature = groupList[j]; - list1size = static_cast(featureNeighborListRef[firstFeature].size()); - if(m_InputValues->UseNonContiguousNeighbors) - { - list2size = nonContigNeighListPtr->getListSize(firstFeature); - } - for(int32 k = 0; k < 2; k++) - { - if(patchGrouping) - { - k = 1; - } - if(k == 0) - { - listSize = list1size; - } - else if(k == 1) - { - listSize = list2size; - } - for(int32 l = 0; l < listSize; l++) - { - int32 neigh = -1; - if(k == 0) - { - neigh = featureNeighborListRef[firstFeature][l]; - } - else if(k == 1 && m_InputValues->UseNonContiguousNeighbors) - { - bool ok = false; - neigh = nonContigNeighListPtr->getValue(firstFeature, l, ok); - } - if(neigh >= 0 && neigh != firstFeature) - { - if(determineGrouping(firstFeature, neigh, parentCount)) - { - if(!patchGrouping) - { - groupList.push_back(neigh); - } - } - } - } - } - } - if(patchGrouping) - { - if(growPatch(parentCount)) - { - for(std::vector::size_type j = 0; j < groupList.size(); j++) - { - int32_t firstFeature = groupList[j]; - listSize = static_cast(featureNeighborListRef[firstFeature].size()); - for(int32_t l = 0; l < listSize; l++) - { - int32 neigh = featureNeighborListRef[firstFeature][l]; - if(neigh != firstFeature) - { - if(growGrouping(firstFeature, neigh, parentCount)) - { - groupList.push_back(neigh); - } - } - } - } - } - } - - throttledMessenger.sendThrottledMessage([&]() { return fmt::format("Parent Count: {}", parentCount); }); - } - groupList.clear(); - } - return {}; -} - -// ----------------------------------------------------------------------------- -Result<> GroupMicroTextureRegions::operator()() -{ - MessageHelper messageHelper(m_MessageHandler); - - m_Generator = std::mt19937_64(std::mt19937::default_seed); - m_Distribution = std::uniform_real_distribution(0.0f, 1.0f); - - // Initialize Data - m_AvgCAxes[0] = 0.0f; - m_AvgCAxes[1] = 0.0f; - m_AvgCAxes[2] = 0.0f; - m_FeatureParentIds.fill(-1); - - // Execute the main grouping algorithm - messageHelper.sendMessage(fmt::format("Starting Grouping.....")); - - // Execute the grouping algorithm - Result<> result = execute(); - if(result.invalid()) - { - return result; - } - - // handle active array resize - if(m_NumTuples < 2) - { - return MakeErrorResult(-87000, fmt::format("The number of grouped Features was {} which means no grouped Features were detected. A grouping value may be set too high", m_NumTuples)); - } - m_DataStructure.getDataRefAs(m_InputValues->NewCellFeatureAttributeMatrixName).resizeTuples(ShapeType{m_NumTuples}); - - auto& cellParentIds = m_DataStructure.getDataRefAs(m_InputValues->CellParentIdsArrayName); - auto& featureIds = m_DataStructure.getDataRefAs(m_InputValues->FeatureIdsArrayPath); - usize totalPoints = featureIds.getNumberOfTuples(); - for(usize k = 0; k < totalPoints; k++) - { - cellParentIds[k] = m_FeatureParentIds[featureIds[k]]; - } - - // By default, we randomize grains !!! COMMENT OUT FOR DEMONSTRATION !!! - // m_MessageHandler(IFilter::Message::Type::Info, "Randomizing Parent Ids"); - // RandomizeFeatureIds(totalPoints, m_NumTuples, cellParentIds, m_FeatureParentIds, featureIds, m_InputValues->SeedValue); - - return {}; -} - -// ----------------------------------------------------------------------------- -int GroupMicroTextureRegions::getSeed(int32 newFid) -{ - usize numFeatures = m_FeaturePhases.getNumberOfTuples(); - - int32 featureIdSeed = -1; - - // Precalculate some constants - const int32 totalFMinus1 = static_cast(numFeatures) - 1; - - usize counter = 0; - // This section finds a feature id that has not been grouped yet. It starts by - // randomly selecting a feature id between 0 and numFeatures-1. We then start - // looping. If the initial random value is valid then we exit the loop after - // a single iteration. If that feature has already been grouped, then we add one - // to the `randFeature` value and try again. If we get to the end of the range of - // featureIds then the algorithm will loop back to featureId = 0 and start incrementing - // from there. This is reasonably efficient as we only generate random numbers - // as needed. - auto randFeature = static_cast(m_Distribution(m_Generator) * static_cast(totalFMinus1)); - while(featureIdSeed == -1 && counter < numFeatures) - { - if(randFeature > totalFMinus1) - { - randFeature = randFeature - numFeatures; - } - if(m_FeatureParentIds.getValue(randFeature) == -1) - { - featureIdSeed = randFeature; - } - randFeature++; - counter++; - } - - // // Used for debugging and demonstration - // if(newFid == 1) - // { - // auto& centroids = m_DataStructure.getDataRefAs(m_InputValues->VolumesArrayPath.replaceName("Centroids")); - // std::ofstream fout ("/tmp/GroupMicroTextureInitialVoxelSeeds.txt", std::ios_base::out | std::ios_base::app); - // fout << fmt::format("Feature Parent Id: {} | X: {}, Y: {}\n", voxelSeed, centroids.getComponent(voxelSeed, 0), centroids.getComponent(voxelSeed, 1)); - // } - - if(featureIdSeed >= 0) - { - m_FeatureParentIds[featureIdSeed] = newFid; - m_NumTuples = newFid + 1; - - if(m_InputValues->UseRunningAverage) - { - usize index = featureIdSeed * 4; - // Get the orientation matrix (which is passive) and then transpose it to make it active transform - ebsdlib::Matrix3X3F g1t = ebsdlib::Quaternion(m_AvgQuats.getValue(index + 0), m_AvgQuats.getValue(index + 1), m_AvgQuats.getValue(index + 2), m_AvgQuats.getValue(index + 3)) - .toOrientationMatrix() - .toGMatrix() - .transpose(); - ebsdlib::Matrix3X1F cAxis(0.0f, 0.0f, 1.0f); - // normalize so that the dot product can be taken below without - // dividing by the magnitudes (they would be 1) - const ebsdlib::Matrix3X1F c1 = (g1t * cAxis).normalize(); - - m_AvgCAxes = c1 * m_Volumes.getValue(featureIdSeed); - } - } - - return featureIdSeed; -} - -// ----------------------------------------------------------------------------- -bool GroupMicroTextureRegions::determineGrouping(int32 referenceFeature, int32 neighborFeature, int32 newFid) -{ - const int32 neighborParentId = m_FeatureParentIds.getValue(neighborFeature); - const int32 referenceFeaturePhase = m_FeaturePhases.getValue(referenceFeature); - const int32 neighborFeaturePhase = m_FeaturePhases.getValue(neighborFeature); - - if(neighborParentId == -1 && referenceFeaturePhase > 0 && neighborFeaturePhase > 0) - { - ebsdlib::Matrix3X1F c1 = {0.0f, 0.0f, 0.0f}; - ebsdlib::Matrix3X1F cAxis(0.0f, 0.0f, 1.0f); - - if(!m_InputValues->UseRunningAverage) - { - const usize index = referenceFeature * 4; - // Get the orientation matrix (which is passive) and then transpose it to make it active transform - // transpose the g matrix so when c-axis is multiplied by it, - // it will give the sample direction that the c-axis is along - ebsdlib::Matrix3X3F g1t = ebsdlib::Quaternion(m_AvgQuats.getValue(index + 0), m_AvgQuats.getValue(index + 1), m_AvgQuats.getValue(index + 2), m_AvgQuats.getValue(index + 3)) - .toOrientationMatrix() - .toGMatrix() - .transpose(); - c1 = (g1t * cAxis).normalize(); - } - uint32 phase1 = m_CrystalStructures.getValue(referenceFeaturePhase); - uint32 phase2 = m_CrystalStructures.getValue(neighborFeaturePhase); - if(phase1 == phase2 && (phase1 == ebsdlib::CrystalStructure::Hexagonal_High)) - { - const usize index = neighborFeature * 4; - // Get the orientation matrix (which is passive) and then transpose it to make it active transform - // transpose the g matrix so when c-axis is multiplied by it, - // it will give the sample direction that the c-axis is along - ebsdlib::Matrix3X3F g2t = ebsdlib::Quaternion(m_AvgQuats.getValue(index + 0), m_AvgQuats.getValue(index + 1), m_AvgQuats.getValue(index + 2), m_AvgQuats.getValue(index + 3)) - .toOrientationMatrix() - .toGMatrix() - .transpose(); - ebsdlib::Matrix3X1F c2 = (g2t * cAxis).normalize(); - - float32 w; - if(m_InputValues->UseRunningAverage) - { - w = m_AvgCAxes.cosTheta(c2); - } - else - { - w = c1.cosTheta(c2); - } - w = std::acos(std::clamp(w, -1.0f, 1.0f)); - - // Convert user defined tolerance to radians. - float32 cAxisToleranceRad = m_InputValues->CAxisTolerance * nx::core::Constants::k_PiF / 180.0f; - if(w <= cAxisToleranceRad || (nx::core::Constants::k_PiD - w) <= cAxisToleranceRad) - { - m_FeatureParentIds.setValue(neighborFeature, newFid); - if(m_InputValues->UseRunningAverage) - { - c2 = c2 * m_Volumes.getValue(neighborFeature); - m_AvgCAxes = m_AvgCAxes + c2; - } - return true; - } - } - } - return false; -} diff --git a/src/SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.hpp b/src/SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.hpp deleted file mode 100644 index 923924f..0000000 --- a/src/SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.hpp +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include "SimplnxReview/SimplnxReview_export.hpp" - -#include "simplnx/DataStructure/DataArray.hpp" -#include "simplnx/DataStructure/DataPath.hpp" -#include "simplnx/DataStructure/DataStructure.hpp" -#include "simplnx/Filter/IFilter.hpp" - -#include "EbsdLib/Math/Matrix3X1.hpp" - -#include - -namespace nx::core -{ - -struct SIMPLNXREVIEW_EXPORT GroupMicroTextureRegionsInputValues -{ - bool UseNonContiguousNeighbors; - DataPath NonContiguousNeighborListArrayPath; - DataPath ContiguousNeighborListArrayPath; - bool m_PatchGrouping = false; - bool UseRunningAverage; - float32 CAxisTolerance; - DataPath FeatureIdsArrayPath; - DataPath FeaturePhasesArrayPath; - DataPath VolumesArrayPath; - DataPath AvgQuatsArrayPath; - DataPath CrystalStructuresArrayPath; - DataPath NewCellFeatureAttributeMatrixName; - DataPath CellParentIdsArrayName; - DataPath FeatureParentIdsArrayName; - uint64 SeedValue; -}; - -/** - * @class GroupMicroTextureRegions - * @brief This filter ... - */ -class SIMPLNXREVIEW_EXPORT GroupMicroTextureRegions -{ -public: - GroupMicroTextureRegions(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, GroupMicroTextureRegionsInputValues* inputValues); - ~GroupMicroTextureRegions() noexcept; - - GroupMicroTextureRegions(const GroupMicroTextureRegions&) = delete; - GroupMicroTextureRegions(GroupMicroTextureRegions&&) noexcept = delete; - GroupMicroTextureRegions& operator=(const GroupMicroTextureRegions&) = delete; - GroupMicroTextureRegions& operator=(GroupMicroTextureRegions&&) noexcept = delete; - - Result<> operator()(); - - const std::atomic_bool& getCancel(); - -protected: - int getSeed(int32 newFid); - bool determineGrouping(int32 referenceFeature, int32 neighborFeature, int32 newFid); - Result<> execute(); - bool growPatch(int32 currentPatch); - bool growGrouping(int32 referenceFeature, int32 neighborFeature, int32 newFid); - -private: - DataStructure& m_DataStructure; - const GroupMicroTextureRegionsInputValues* m_InputValues = nullptr; - const std::atomic_bool& m_ShouldCancel; - const IFilter::MessageHandler& m_MessageHandler; - - usize m_NumTuples = 0; - ebsdlib::Matrix3X1F m_AvgCAxes = {0.0f, 0.0f, 0.0f}; - std::mt19937_64 m_Generator = {}; - std::uniform_real_distribution m_Distribution = {}; - - // These are so that we don't have to keep getting the references while we are running - - Int32Array& m_FeaturePhases; - Int32Array& m_FeatureParentIds; - UInt32Array& m_CrystalStructures; - Float32Array& m_AvgQuats; - Float32Array& m_Volumes; -}; -} // namespace nx::core diff --git a/src/SimplnxReview/Filters/GroupMicroTextureRegionsFilter.cpp b/src/SimplnxReview/Filters/GroupMicroTextureRegionsFilter.cpp deleted file mode 100644 index d8cb659..0000000 --- a/src/SimplnxReview/Filters/GroupMicroTextureRegionsFilter.cpp +++ /dev/null @@ -1,248 +0,0 @@ -#include "GroupMicroTextureRegionsFilter.hpp" - -#include "SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.hpp" - -#include "simplnx/DataStructure/DataPath.hpp" -#include "simplnx/Filter/Actions/CreateArrayAction.hpp" -#include "simplnx/Filter/Actions/CreateAttributeMatrixAction.hpp" -#include "simplnx/Parameters/ArraySelectionParameter.hpp" -#include "simplnx/Parameters/BoolParameter.hpp" -#include "simplnx/Parameters/DataGroupCreationParameter.hpp" -#include "simplnx/Parameters/DataObjectNameParameter.hpp" -#include "simplnx/Parameters/NeighborListSelectionParameter.hpp" -#include "simplnx/Parameters/NumberParameter.hpp" -#include "simplnx/Utilities/SIMPLConversion.hpp" - -#include - -using namespace nx::core; - -namespace nx::core -{ -//------------------------------------------------------------------------------ -std::string GroupMicroTextureRegionsFilter::name() const -{ - return FilterTraits::name.str(); -} - -//------------------------------------------------------------------------------ -std::string GroupMicroTextureRegionsFilter::className() const -{ - return FilterTraits::className; -} - -//------------------------------------------------------------------------------ -Uuid GroupMicroTextureRegionsFilter::uuid() const -{ - return FilterTraits::uuid; -} - -//------------------------------------------------------------------------------ -std::string GroupMicroTextureRegionsFilter::humanName() const -{ - return "Group MicroTexture Regions"; -} - -//------------------------------------------------------------------------------ -std::vector GroupMicroTextureRegionsFilter::defaultTags() const -{ - return {className(), "Reconstruction", "Grouping"}; -} - -//------------------------------------------------------------------------------ -Parameters GroupMicroTextureRegionsFilter::parameters() const -{ - Parameters params; - - // Create the parameter descriptors that are needed for this filter - params.insertSeparator(Parameters::Separator{"Input Parameter(s)"}); - - params.insert(std::make_unique(k_UseRunningAverage_Key, "Group C-Axes With Running Average", "Group C-Axes With Running Average", true)); - params.insert(std::make_unique(k_CAxisTolerance_Key, "C-Axis Alignment Tolerance (Degrees)", "C-Axis Alignment Tolerance (Degrees)", 0.0f)); - params.insert(std::make_unique(k_ContiguousNeighborListArrayPath_Key, "Contiguous Neighbor List", "List of contiguous neighbors for each Feature.", DataPath{}, - NeighborListSelectionParameter::AllowedTypes{DataType::int32})); - - params.insertSeparator(Parameters::Separator{"Non-Contiguous Neighborhood Option"}); - params.insertLinkableParameter(std::make_unique(k_UseNonContiguousNeighbors_Key, "Use Non-Contiguous Neighbors", "Use non-contiguous neighborhoods", false)); - params.insert(std::make_unique(k_NonContiguousNeighborListArrayPath_Key, "Non-Contiguous Neighbor List", "List of non-contiguous neighbors for each Feature.", - DataPath{}, NeighborListSelectionParameter::AllowedTypes{DataType::int32})); - - params.insertSeparator(Parameters::Separator{"Random Number Seed Parameters"}); - params.insertLinkableParameter(std::make_unique(k_UseSeed_Key, "Use Seed for Random Generation", "When true the user will be able to put in a seed for random generation", false)); - params.insert(std::make_unique>(k_SeedValue_Key, "Seed", "The seed fed into the random generator", std::mt19937::default_seed)); - params.insert(std::make_unique(k_SeedArrayName_Key, "Stored Seed Value Array Name", "Name of array holding the seed value", "_Group_MicroTexture_Regions_Seed_Value_")); - - params.insertSeparator(Parameters::Separator{"Input Cell Data"}); - params.insert(std::make_unique(k_FeatureIdsArrayPath_Key, "Cell Feature Ids", "Data Array that specifies to which Feature each Element belongs", DataPath{}, - ArraySelectionParameter::AllowedTypes{DataType::int32}, ArraySelectionParameter::AllowedComponentShapes{{1}})); - - params.insertSeparator(Parameters::Separator{"Input Feature Data"}); - params.insert(std::make_unique(k_FeaturePhasesArrayPath_Key, "Feature Phases", "Specifies to which Ensemble each Feature belongs", DataPath{}, - ArraySelectionParameter::AllowedTypes{nx::core::DataType::int32}, ArraySelectionParameter::AllowedComponentShapes{{1}})); - params.insert(std::make_unique(k_VolumesArrayPath_Key, "Volumes", "The Feature Volumes Data Array", DataPath{}, - ArraySelectionParameter::AllowedTypes{nx::core::DataType::float32}, ArraySelectionParameter::AllowedComponentShapes{{1}})); - params.insert(std::make_unique(k_AvgQuatsArrayPath_Key, "Average Quaternions", "Specifies the average orientation of each Feature in quaternion representation", DataPath{}, - ArraySelectionParameter::AllowedTypes{nx::core::DataType::float32}, ArraySelectionParameter::AllowedComponentShapes{{4}})); - - params.insertSeparator(Parameters::Separator{"Input Ensemble Data"}); - params.insert(std::make_unique(k_CrystalStructuresArrayPath_Key, "Crystal Structures", "Enumeration representing the crystal structure for each Ensemble", DataPath{}, - ArraySelectionParameter::AllowedTypes{nx::core::DataType::uint32}, ArraySelectionParameter::AllowedComponentShapes{{1}})); - - params.insertSeparator(Parameters::Separator{"Output Data Object(s)"}); - params.insert(std::make_unique(k_CellParentIdsArrayName_Key, "Cell Parent Ids Array name", "Output Cell Parent Ids Data Array", "Cell Parent Ids")); - params.insert(std::make_unique(k_FeatureParentIdsArrayName_Key, "Feature Parent Ids Array Name", "Output Feature Parent Ids Data Array", "Feature Parent Ids")); - params.insert(std::make_unique(k_NewCellFeatureAttributeMatrixName_Key, "Created Microtexture Feature Attribute Matrix", - "Output Feature Attribute Matrix for Microtexture Regions", DataPath{})); - params.insert(std::make_unique(k_ActiveArrayName_Key, "Active Array Name", "Output Active Array", "Active")); - - // Associate the Linkable Parameter(s) to the children parameters that they control - params.linkParameters(k_UseNonContiguousNeighbors_Key, k_NonContiguousNeighborListArrayPath_Key, true); - params.linkParameters(k_UseSeed_Key, k_SeedValue_Key, true); - - return params; -} - -//------------------------------------------------------------------------------ -IFilter::UniquePointer GroupMicroTextureRegionsFilter::clone() const -{ - return std::make_unique(); -} - -//------------------------------------------------------------------------------ -IFilter::VersionType GroupMicroTextureRegionsFilter::parametersVersion() const -{ - return 1; -} - -//------------------------------------------------------------------------------ -IFilter::PreflightResult GroupMicroTextureRegionsFilter::preflightImpl(const DataStructure& dataStructure, const Arguments& filterArgs, const MessageHandler& messageHandler, - const std::atomic_bool& shouldCancel, const ExecutionContext& executionContext) const -{ - auto pFeatureIdsPath = filterArgs.value(k_FeatureIdsArrayPath_Key); - auto pFeaturePhasesPath = filterArgs.value(k_FeaturePhasesArrayPath_Key); - auto pNewCellFeatureAMPath = filterArgs.value(k_NewCellFeatureAttributeMatrixName_Key); - auto pCellParentIdsName = filterArgs.value(k_CellParentIdsArrayName_Key); - auto pFeatureParentIdsName = filterArgs.value(k_FeatureParentIdsArrayName_Key); - auto pActiveName = filterArgs.value(k_ActiveArrayName_Key); - auto pSeedArrayName = filterArgs.value(k_SeedArrayName_Key); - - PreflightResult preflightResult; - nx::core::Result resultOutputActions; - std::vector preflightUpdatedValues; - - { - auto* featureIds = dataStructure.getDataAs(pFeatureIdsPath); - auto createAction = std::make_unique(DataType::int32, featureIds->getTupleShape(), std::vector{1}, pFeatureIdsPath.replaceName(pCellParentIdsName)); - resultOutputActions.value().appendAction(std::move(createAction)); - } - { - auto* featurePhases = dataStructure.getDataAs(pFeaturePhasesPath); - auto createAction = std::make_unique(DataType::int32, featurePhases->getTupleShape(), std::vector{1}, pFeaturePhasesPath.replaceName(pFeatureParentIdsName)); - resultOutputActions.value().appendAction(std::move(createAction)); - } - - { - auto createAction = std::make_unique(pNewCellFeatureAMPath, ShapeType{1}); - resultOutputActions.value().appendAction(std::move(createAction)); - } - { - auto createAction = std::make_unique(DataType::boolean, std::vector{1}, std::vector{1}, pNewCellFeatureAMPath.createChildPath(pActiveName)); - resultOutputActions.value().appendAction(std::move(createAction)); - } - - { - auto createAction = std::make_unique(DataType::uint64, std::vector{1}, std::vector{1}, DataPath({pSeedArrayName})); - resultOutputActions.value().appendAction(std::move(createAction)); - } - - preflightUpdatedValues.push_back({"WARNING: This filter is experimental in nature and has not had any testing, validation or verification. Use at your own risk"}); - resultOutputActions.warnings().push_back({-65432, "WARNING: This filter is experimental in nature and has not had any testing, validation or verification. Use at your own risk"}); - - // Return both the resultOutputActions and the preflightUpdatedValues via std::move() - return {std::move(resultOutputActions), std::move(preflightUpdatedValues)}; -} - -//------------------------------------------------------------------------------ -Result<> GroupMicroTextureRegionsFilter::executeImpl(DataStructure& dataStructure, const Arguments& filterArgs, const PipelineFilter* pipelineNode, const MessageHandler& messageHandler, - const std::atomic_bool& shouldCancel, const ExecutionContext& executionContext) const -{ - auto seed = filterArgs.value(k_SeedValue_Key); - if(!filterArgs.value(k_UseSeed_Key)) - { - seed = static_cast(std::chrono::steady_clock::now().time_since_epoch().count()); - } - - // Store Seed Value in Top Level Array - dataStructure.getDataRefAs(DataPath({filterArgs.value(k_SeedArrayName_Key)}))[0] = seed; - - GroupMicroTextureRegionsInputValues inputValues; - - inputValues.UseNonContiguousNeighbors = filterArgs.value(k_UseNonContiguousNeighbors_Key); - inputValues.NonContiguousNeighborListArrayPath = filterArgs.value(k_NonContiguousNeighborListArrayPath_Key); - inputValues.ContiguousNeighborListArrayPath = filterArgs.value(k_ContiguousNeighborListArrayPath_Key); - inputValues.UseRunningAverage = filterArgs.value(k_UseRunningAverage_Key); - inputValues.CAxisTolerance = filterArgs.value(k_CAxisTolerance_Key); - inputValues.FeatureIdsArrayPath = filterArgs.value(k_FeatureIdsArrayPath_Key); - inputValues.FeaturePhasesArrayPath = filterArgs.value(k_FeaturePhasesArrayPath_Key); - inputValues.VolumesArrayPath = filterArgs.value(k_VolumesArrayPath_Key); - inputValues.AvgQuatsArrayPath = filterArgs.value(k_AvgQuatsArrayPath_Key); - inputValues.CrystalStructuresArrayPath = filterArgs.value(k_CrystalStructuresArrayPath_Key); - inputValues.NewCellFeatureAttributeMatrixName = filterArgs.value(k_NewCellFeatureAttributeMatrixName_Key); - inputValues.CellParentIdsArrayName = inputValues.FeatureIdsArrayPath.replaceName(filterArgs.value(k_CellParentIdsArrayName_Key)); - inputValues.FeatureParentIdsArrayName = inputValues.FeaturePhasesArrayPath.replaceName(filterArgs.value(k_FeatureParentIdsArrayName_Key)); - inputValues.SeedValue = seed; - - return GroupMicroTextureRegions(dataStructure, messageHandler, shouldCancel, &inputValues)(); -} - -namespace -{ -namespace SIMPL -{ -constexpr StringLiteral k_ActiveArrayNameKey = "ActiveArrayName"; -constexpr StringLiteral k_AvgQuatsArrayPathKey = "AvgQuatsArrayPath"; -constexpr StringLiteral k_CAxisToleranceKey = "CAxisTolerance"; -constexpr StringLiteral k_CellParentIdsArrayNameKey = "CellParentIdsArrayName"; -constexpr StringLiteral k_ContiguousNeighborListArrayPathKey = "ContiguousNeighborListArrayPath"; -constexpr StringLiteral k_CrystalStructuresArrayPathKey = "CrystalStructuresArrayPath"; -constexpr StringLiteral k_FeatureIdsArrayPathKey = "FeatureIdsArrayPath"; -constexpr StringLiteral k_FeatureParentIdsArrayNameKey = "FeatureParentIdsArrayName"; -constexpr StringLiteral k_FeaturePhasesArrayPathKey = "FeaturePhasesArrayPath"; -constexpr StringLiteral k_NewCellFeatureAttributeMatrixNameKey = "NewCellFeatureAttributeMatrixName"; -constexpr StringLiteral k_NonContiguousNeighborListArrayPathKey = "NonContiguousNeighborListArrayPath"; -constexpr StringLiteral k_UseNonContiguousNeighborsKey = "UseNonContiguousNeighbors"; -constexpr StringLiteral k_UseRunningAverageKey = "UseRunningAverage"; -constexpr StringLiteral k_VolumesArrayPathKey = "VolumesArrayPath"; -} // namespace SIMPL -} // namespace - -Result GroupMicroTextureRegionsFilter::FromSIMPLJson(const nlohmann::json& json) -{ - Arguments args = GroupMicroTextureRegionsFilter().getDefaultArguments(); - - std::vector> results; - - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_ActiveArrayNameKey, k_ActiveArrayName_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_AvgQuatsArrayPathKey, k_AvgQuatsArrayPath_Key)); - results.push_back(SIMPLConversion::ConvertParameter>(args, json, SIMPL::k_CAxisToleranceKey, k_CAxisTolerance_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_CellParentIdsArrayNameKey, k_CellParentIdsArrayName_Key)); - results.push_back( - SIMPLConversion::ConvertParameter(args, json, SIMPL::k_ContiguousNeighborListArrayPathKey, k_ContiguousNeighborListArrayPath_Key)); - results.push_back( - SIMPLConversion::ConvertParameter(args, json, SIMPL::k_CrystalStructuresArrayPathKey, k_CrystalStructuresArrayPath_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_FeatureIdsArrayPathKey, k_FeatureIdsArrayPath_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_FeatureParentIdsArrayNameKey, k_FeatureParentIdsArrayName_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_FeaturePhasesArrayPathKey, k_FeaturePhasesArrayPath_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_NewCellFeatureAttributeMatrixNameKey, - k_NewCellFeatureAttributeMatrixName_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_NonContiguousNeighborListArrayPathKey, - k_NonContiguousNeighborListArrayPath_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_UseNonContiguousNeighborsKey, k_UseNonContiguousNeighbors_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_UseRunningAverageKey, k_UseRunningAverage_Key)); - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_VolumesArrayPathKey, k_VolumesArrayPath_Key)); - - Result<> conversionResult = MergeResults(std::move(results)); - - return ConvertResultTo(std::move(conversionResult), std::move(args)); -} -} // namespace nx::core diff --git a/src/SimplnxReview/Filters/GroupMicroTextureRegionsFilter.hpp b/src/SimplnxReview/Filters/GroupMicroTextureRegionsFilter.hpp deleted file mode 100644 index 9a38170..0000000 --- a/src/SimplnxReview/Filters/GroupMicroTextureRegionsFilter.hpp +++ /dev/null @@ -1,134 +0,0 @@ -#pragma once - -#include "SimplnxReview/SimplnxReview_export.hpp" - -#include "simplnx/Filter/FilterTraits.hpp" -#include "simplnx/Filter/IFilter.hpp" - -namespace nx::core -{ -/** - * @class GroupMicroTextureRegionsFilter - * @brief This filter will .... - */ -class SIMPLNXREVIEW_EXPORT GroupMicroTextureRegionsFilter : public IFilter -{ -public: - GroupMicroTextureRegionsFilter() = default; - ~GroupMicroTextureRegionsFilter() noexcept override = default; - - GroupMicroTextureRegionsFilter(const GroupMicroTextureRegionsFilter&) = delete; - GroupMicroTextureRegionsFilter(GroupMicroTextureRegionsFilter&&) noexcept = delete; - - GroupMicroTextureRegionsFilter& operator=(const GroupMicroTextureRegionsFilter&) = delete; - GroupMicroTextureRegionsFilter& operator=(GroupMicroTextureRegionsFilter&&) noexcept = delete; - - // Parameter Keys - static constexpr StringLiteral k_UseNonContiguousNeighbors_Key = "use_non_contiguous_neighbors"; - static constexpr StringLiteral k_NonContiguousNeighborListArrayPath_Key = "non_contiguous_neighbor_list_array_path"; - static constexpr StringLiteral k_ContiguousNeighborListArrayPath_Key = "contiguous_neighbor_list_array_path"; - static constexpr StringLiteral k_UseRunningAverage_Key = "use_running_average"; - static constexpr StringLiteral k_CAxisTolerance_Key = "c_axis_tolerance"; - static constexpr StringLiteral k_FeatureIdsArrayPath_Key = "feature_ids_array_path"; - static constexpr StringLiteral k_FeaturePhasesArrayPath_Key = "feature_phases_array_path"; - static constexpr StringLiteral k_VolumesArrayPath_Key = "volumes_array_path"; - static constexpr StringLiteral k_AvgQuatsArrayPath_Key = "avg_quats_array_path"; - static constexpr StringLiteral k_CrystalStructuresArrayPath_Key = "crystal_structures_array_path"; - static constexpr StringLiteral k_NewCellFeatureAttributeMatrixName_Key = "new_cell_feature_attribute_matrix_path"; - static constexpr StringLiteral k_CellParentIdsArrayName_Key = "cell_parent_ids_array_name"; - static constexpr StringLiteral k_FeatureParentIdsArrayName_Key = "feature_parent_ids_array_name"; - static constexpr StringLiteral k_ActiveArrayName_Key = "active_array_name"; - static constexpr StringLiteral k_SeedArrayName_Key = "seed_array_name"; - static constexpr StringLiteral k_UseSeed_Key = "use_seed"; - static constexpr StringLiteral k_SeedValue_Key = "seed_value"; - - /** - * @brief Reads SIMPL json and converts it simplnx Arguments. - * @param json - * @return Result - */ - static Result FromSIMPLJson(const nlohmann::json& json); - - /** - * @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 parameters version integer. - * Initial version should always be 1. - * Should be incremented everytime the parameters change. - * @return VersionType - */ - VersionType parametersVersion() 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 dataStructure 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 - * @param shouldCancel Atomic boolean value that can be checked to cancel the filter - * @param executionContext The ExecutionContext that can be used to determine the correct absolute path from a relative path - * @return Returns a Result object with error or warning values if any of those occurred during execution of this function - */ - PreflightResult preflightImpl(const DataStructure& dataStructure, const Arguments& filterArgs, const MessageHandler& messageHandler, const std::atomic_bool& shouldCancel, - const ExecutionContext& executionContext) 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 dataStructure The input DataStructure instance - * @param filterArgs These are the input values for each parameter that is required for the filter - * @param pipelineNode The node in the pipeline that is being executed - * @param messageHandler The MessageHandler object - * @param shouldCancel Atomic boolean value that can be checked to cancel the filter - * @param executionContext The ExecutionContext that can be used to determine the correct absolute path from a relative path - * @return Returns a Result object with error or warning values if any of those occurred during execution of this function - */ - Result<> executeImpl(DataStructure& dataStructure, const Arguments& filterArgs, const PipelineFilter* pipelineNode, const MessageHandler& messageHandler, const std::atomic_bool& shouldCancel, - const ExecutionContext& executionContext) const override; -}; -} // namespace nx::core - -SIMPLNX_DEF_FILTER_TRAITS(nx::core, GroupMicroTextureRegionsFilter, "3f695987-81b1-47c3-8cff-b49cfa219be0"); -/* LEGACY UUID FOR THIS FILTER 5e18a9e2-e342-56ac-a54e-3bd0ca8b9c53 */ diff --git a/src/SimplnxReview/SimplnxReviewLegacyUUIDMapping.hpp b/src/SimplnxReview/SimplnxReviewLegacyUUIDMapping.hpp index 6e8ca58..fc90d6c 100644 --- a/src/SimplnxReview/SimplnxReviewLegacyUUIDMapping.hpp +++ b/src/SimplnxReview/SimplnxReviewLegacyUUIDMapping.hpp @@ -5,7 +5,6 @@ #include /* clang-format off */ -#include "SimplnxReview/Filters/GroupMicroTextureRegionsFilter.hpp" #include "SimplnxReview/Filters/MergeColoniesFilter.hpp" #include "SimplnxReview/Filters/ComputeSaltykovSizesFilter.hpp" #include "SimplnxReview/Filters/ComputeMicroTextureRegionsFilter.hpp" @@ -21,7 +20,6 @@ namespace nx::core static const AbstractPlugin::SIMPLMapType k_SIMPL_to_SimplnxReview { // syntax std::make_pair {Dream3d UUID , Dream3dnx UUID, {}}}, // dream3d-class-name - {nx::core::Uuid::FromString("5e18a9e2-e342-56ac-a54e-3bd0ca8b9c53").value(), {nx::core::FilterTraits::uuid, &GroupMicroTextureRegionsFilter::FromSIMPLJson}}, // GroupMicroTextureRegions {nx::core::Uuid::FromString("2c4a6d83-6a1b-56d8-9f65-9453b28845b9").value(), {nx::core::FilterTraits::uuid, &MergeColoniesFilter::FromSIMPLJson}}, // MergeColonies {nx::core::Uuid::FromString("cc76cffe-81ad-5ece-be2a-ce127c5fa6d7").value(), {nx::core::FilterTraits::uuid, &ComputeSaltykovSizesFilter::FromSIMPLJson}}, // FindSaltykovSizes {nx::core::Uuid::FromString("90f8e3b1-2460-5862-95a1-a9e06f5ee75e").value(), {nx::core::FilterTraits::uuid, &ComputeMicroTextureRegionsFilter::FromSIMPLJson}}, // FindMicroTextureRegions diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3ed7925..3dcd9c8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -10,7 +10,6 @@ set(${PLUGIN_NAME}UnitTest_SRCS ComputeLocalAverageCAxisMisalignmentsTest.cpp ComputeMicroTextureRegionsTest.cpp ComputeSaltykovSizesTest.cpp - GroupMicroTextureRegionsTest.cpp ) set(DISABLED_TESTS diff --git a/test/GroupMicroTextureRegionsTest.cpp b/test/GroupMicroTextureRegionsTest.cpp deleted file mode 100644 index c82fb86..0000000 --- a/test/GroupMicroTextureRegionsTest.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * This file is auto generated from the original OrientationAnalysis/GroupMicroTextureRegionsFilter - * runtime information. These are the steps that need to be taken to utilize this - * unit test in the proper way. - * - * 1: Validate each of the default parameters that gets created. - * 2: Inspect the actual filter to determine if the filter in its default state - * would pass or fail BOTH the preflight() and execute() methods - * 3: UPDATE the ```REQUIRE(result.result.valid());``` code to have the proper - * - * 4: Add additional unit tests to actually test each code path within the filter - * - * There are some example Catch2 ```TEST_CASE``` sections for your inspiration. - * - * NOTE the format of the ```TEST_CASE``` macro. Please stick to this format to - * allow easier parsing of the unit tests. - * - * When you start working on this unit test remove "[GroupMicroTextureRegionsFilter][.][UNIMPLEMENTED]" - * from the TEST_CASE macro. This will enable this unit test to be run by default - * and report errors. - */ - -#include - -#include "simplnx/Core/Application.hpp" -#include "simplnx/Parameters/ArraySelectionParameter.hpp" -#include "simplnx/Parameters/BoolParameter.hpp" -#include "simplnx/Parameters/NumberParameter.hpp" -#include "simplnx/Parameters/StringParameter.hpp" -#include "simplnx/Pipeline/Pipeline.hpp" -#include "simplnx/Pipeline/PipelineFilter.hpp" -#include "simplnx/UnitTest/UnitTestCommon.hpp" - -#include "SimplnxReview/Filters/GroupMicroTextureRegionsFilter.hpp" -#include "SimplnxReview/SimplnxReview_test_dirs.hpp" - -#include - -using namespace nx::core; - -TEST_CASE("SimplnxReview::GroupMicroTextureRegionsFilter: Valid Filter Execution", "[OrientationAnalysis][GroupMicroTextureRegionsFilter][.][UNIMPLEMENTED][!mayfail]") -{ - // Instantiate the filter, a DataStructure object and an Arguments Object - GroupMicroTextureRegionsFilter filter; - DataStructure ds; - Arguments args; - - // Create default Parameters for the filter. - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_UseNonContiguousNeighbors_Key, std::make_any(false)); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_NonContiguousNeighborListArrayPath_Key, std::make_any(DataPath{})); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_ContiguousNeighborListArrayPath_Key, std::make_any(DataPath{})); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_UseRunningAverage_Key, std::make_any(false)); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_CAxisTolerance_Key, std::make_any(1.23345f)); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_FeatureIdsArrayPath_Key, std::make_any(DataPath{})); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_FeaturePhasesArrayPath_Key, std::make_any(DataPath{})); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_VolumesArrayPath_Key, std::make_any(DataPath{})); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_AvgQuatsArrayPath_Key, std::make_any(DataPath{})); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_CrystalStructuresArrayPath_Key, std::make_any(DataPath{})); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_NewCellFeatureAttributeMatrixName_Key, std::make_any("SomeString")); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_CellParentIdsArrayName_Key, std::make_any("SomeString")); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_FeatureParentIdsArrayName_Key, std::make_any("SomeString")); - args.insertOrAssign(GroupMicroTextureRegionsFilter::k_ActiveArrayName_Key, std::make_any("SomeString")); - - // Preflight the filter and check result - auto preflightResult = filter.preflight(ds, args); - SIMPLNX_RESULT_REQUIRE_VALID(preflightResult.outputActions); - - // Execute the filter and check the result - auto executeResult = filter.execute(ds, args); - SIMPLNX_RESULT_REQUIRE_VALID(executeResult.result); -} - -// TEST_CASE("OrientationAnalysis::GroupMicroTextureRegionsFilter: InValid Filter Execution") -//{ -// -// } - -TEST_CASE("SimplnxReview::GroupMicroTextureRegionsFilter: SIMPL Backwards Compatibility", "[SimplnxReview][GroupMicroTextureRegionsFilter][BackwardsCompatibility]") -{ - auto app = Application::GetOrCreateInstance(); - UnitTest::LoadPlugins(); - auto filterList = app->getFilterList(); - - const fs::path conversionDir = fs::path(nx::core::unit_test::k_SourceDir.view()) / "test" / "simpl_conversion"; - - const std::vector> fixtures = { - {"SIMPL 6.5 (UUID)", conversionDir / "6_5" / "GroupMicroTextureRegionsFilter.json"}, - {"SIMPL 6.4 (Filter_Name)", conversionDir / "6_4" / "GroupMicroTextureRegionsFilter.json"}, - }; - - for(const auto& [label, fixturePath] : fixtures) - { - DYNAMIC_SECTION(label) - { - auto pipelineResult = Pipeline::FromSIMPLFile(fixturePath, filterList); - REQUIRE(pipelineResult.valid()); - - auto& pipeline = pipelineResult.value(); - REQUIRE(pipeline.size() == 1); - - auto* pipelineFilter = dynamic_cast(pipeline.at(0)); - REQUIRE(pipelineFilter != nullptr); - - const IFilter* filter = pipelineFilter->getFilter(); - REQUIRE(filter != nullptr); - REQUIRE(filter->uuid() == FilterTraits::uuid); - - CHECK(pipelineFilter->getComments().empty()); - - const Arguments args = pipelineFilter->getArguments(); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_ActiveArrayName_Key) == "TestName"); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_AvgQuatsArrayPath_Key) == DataPath({"DataContainer", "CellData", "TestArray"})); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_CAxisTolerance_Key) == 2.5f); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_CellParentIdsArrayName_Key) == "TestName"); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_ContiguousNeighborListArrayPath_Key) == DataPath({"DataContainer", "CellData", "TestArray"})); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_CrystalStructuresArrayPath_Key) == DataPath({"DataContainer", "CellData", "TestArray"})); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_FeatureIdsArrayPath_Key) == DataPath({"DataContainer", "CellData", "TestArray"})); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_FeatureParentIdsArrayName_Key) == "TestName"); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_FeaturePhasesArrayPath_Key) == DataPath({"DataContainer", "CellData", "TestArray"})); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_NewCellFeatureAttributeMatrixName_Key) == DataPath({"TestName"})); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_NonContiguousNeighborListArrayPath_Key) == DataPath({"DataContainer", "CellData", "TestArray"})); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_UseNonContiguousNeighbors_Key) == true); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_UseRunningAverage_Key) == true); - CHECK(args.value(GroupMicroTextureRegionsFilter::k_VolumesArrayPath_Key) == DataPath({"DataContainer", "CellData", "TestArray"})); - } - } -} diff --git a/test/simpl_conversion/6_4/GroupMicroTextureRegionsFilter.json b/test/simpl_conversion/6_4/GroupMicroTextureRegionsFilter.json deleted file mode 100644 index e9a2f5e..0000000 --- a/test/simpl_conversion/6_4/GroupMicroTextureRegionsFilter.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "PipelineBuilder": { - "Name": "Group Micro Texture Regions 6.4 Backwards Compatibility Test", - "Number_Filters": 1, - "Version": 6 - }, - "0": { - "Filter_Enabled": true, - "Filter_Human_Label": "Group MicroTexture Regions", - "Filter_Name": "GroupMicroTextureRegions", - "ActiveArrayName": "TestName", - "AvgQuatsArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "CAxisTolerance": 2.5, - "CellParentIdsArrayName": "TestName", - "ContiguousNeighborListArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "CrystalStructuresArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "FeatureIdsArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "FeatureParentIdsArrayName": "TestName", - "FeaturePhasesArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "NewCellFeatureAttributeMatrixName": "TestName", - "NonContiguousNeighborListArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "UseNonContiguousNeighbors": 1, - "UseRunningAverage": 1, - "VolumesArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - } - } -} diff --git a/test/simpl_conversion/6_5/GroupMicroTextureRegionsFilter.json b/test/simpl_conversion/6_5/GroupMicroTextureRegionsFilter.json deleted file mode 100644 index 6fa40c7..0000000 --- a/test/simpl_conversion/6_5/GroupMicroTextureRegionsFilter.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "PipelineBuilder": { - "Name": "Group Micro Texture Regions Backwards Compatibility Test", - "Number_Filters": 1, - "Version": 6 - }, - "0": { - "Filter_Enabled": true, - "Filter_Human_Label": "Group MicroTexture Regions", - "Filter_Name": "GroupMicroTextureRegions", - "Filter_Uuid": "{5e18a9e2-e342-56ac-a54e-3bd0ca8b9c53}", - "ActiveArrayName": "TestName", - "AvgQuatsArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "CAxisTolerance": 2.5, - "CellParentIdsArrayName": "TestName", - "ContiguousNeighborListArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "CrystalStructuresArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "FeatureIdsArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "FeatureParentIdsArrayName": "TestName", - "FeaturePhasesArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "NewCellFeatureAttributeMatrixName": "TestName", - "NonContiguousNeighborListArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - }, - "UseNonContiguousNeighbors": 1, - "UseRunningAverage": 1, - "VolumesArrayPath": { - "Data Container Name": "DataContainer", - "Attribute Matrix Name": "CellData", - "Data Array Name": "TestArray" - } - } -}