Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Parameters EBSDSegmentFeaturesFilter::parameters() const
params.insertSeparator(Parameters::Separator{"Input Parameter(s)"});
params.insert(std::make_unique<Float32Parameter>(k_MisorientationTolerance_Key, "Misorientation Tolerance (Degrees)",
"Tolerance (in degrees) used to determine if neighboring Cells belong to the same Feature", 5.0f));
params.insert(std::make_unique<BoolParameter>(k_RandomizeFeatureIds_Key, "Randomize Feature IDs", "Specifies if feature IDs should be randomized during calculations", false));
params.insert(std::make_unique<BoolParameter>(k_RandomizeFeatureIds_Key, "Randomize Feature Ids", "Specifies if feature IDs should be randomized during calculations", false));
params.insert(std::make_unique<ChoicesParameter>(k_NeighborScheme_Key, "Neighbor Scheme", "How many neighbors to use", segment_features::k_6NeighborIndex, segment_features::k_OperationChoices));

params.insertSeparator(Parameters::Separator{"Optional Data Mask"});
Expand Down
278 changes: 215 additions & 63 deletions src/Plugins/OrientationAnalysis/test/CAxisSegmentFeaturesTest.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Plugins/OrientationAnalysis/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND SIMPLNX_DOWNLOAD_TEST_FILES)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME neighbor_orientation_correlation.tar.gz SHA512 122367452174ade2f24dde7a4610bddc4f147a223722d9b30c1df9eaa2cd2bf25e1c7957aba83f3f9de79b4eadd79339b848f9530d1ebf44c69244ea5442cf85)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME PoleFigure_Exemplars_v4.tar.gz SHA512 86235279c61ac40405ec00d74703855aa84f7985114dfe4f7bb14a84a73f59092df3f5c087220ceb62325186dfaa08d843ec86dd0710800e376d95e4047cefbe)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME read_ang_test.tar.gz SHA512 de7cd89d925da01f291f44686964ec89d469659d0005219f9869afe26b8f62af278461ac3f5deb3afe7f3e65ec074ab3a1357d77a1a5f92eb3a1ea8cc5e4b236)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME segment_features_test_data.tar.gz SHA512 317d69384330d40c673f8e1a42df003dede5ac85331b2549e9f45467f7af6b74284f8dad1120427690719ebcd5066830e17031533381cc2cc0cc8622a422b914)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME Small_IN100_Ang_Files.tar.gz SHA512 79e9f6948d4e8e06187e11216a67596fa786ffd2700e51f594ad014090383eb8bcc003e14de2e88082aa9ae512cc4fc9cee22c80066fc54f38c3ebc75267eb5b)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME Small_IN100_dream3d_v3.tar.gz SHA512 bfa9547e787b0f8e8122702da0eb4e519f48a48bf4f94aad020f72479d071d32dfc96a1425705874c68507a61ed391d28606d9c4f4acd559043ef0ace64fd33f)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME Small_IN100_h5ebsd.tar.gz SHA512 31e606285ea9e8235dcb5f608fd2b252a5ab1492abd975e5ec33a21d083aa9720fe16fb8f752742c140f40e963d692f1a46256b9d36e96b1b09796c1e4ea3db9)
Expand Down
240 changes: 206 additions & 34 deletions src/Plugins/OrientationAnalysis/test/EBSDSegmentFeaturesFilterTest.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Uuid RandomizeFeatureIdsFilter::uuid() const
//------------------------------------------------------------------------------
std::string RandomizeFeatureIdsFilter::humanName() const
{
return "Randomize Feature IDs";
return "Randomize Feature Ids";
}

//------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Parameters ScalarSegmentFeaturesFilter::parameters() const

params.insertSeparator(Parameters::Separator{"Input Parameter(s)"});
params.insert(std::make_unique<NumberParameter<int>>(k_ScalarToleranceKey, "Scalar Tolerance", "Tolerance for segmenting input Cell Data", 1));
params.insert(std::make_unique<BoolParameter>(k_RandomizeFeatures_Key, "Randomize Feature IDs", "Specifies if feature IDs should be randomized during calculations", false));
params.insert(std::make_unique<BoolParameter>(k_RandomizeFeatures_Key, "Randomize Feature Ids", "Specifies if feature IDs should be randomized during calculations", false));

params.insert(std::make_unique<ChoicesParameter>(k_NeighborScheme_Key, "Neighbor Scheme", "How many neighbors to use", segment_features::k_6NeighborIndex, segment_features::k_OperationChoices));

Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/SimplnxCore/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ set(${PLUGIN_NAME}UnitTest_SRCS
ReverseTriangleWindingTest.cpp
RobustAutomaticThresholdTest.cpp
RotateSampleRefFrameTest.cpp
ScalarSegmentFeaturesFilterTest.cpp
ScalarSegmentFeaturesTest.cpp
SetImageGeomOriginScalingFilterTest.cpp
SharedFeatureFaceTest.cpp
SilhouetteTest.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ const std::string k_ExemplaryCombinationFaceOnlyFeatureIdsName = "Exemplary Comb
const std::string k_ExemplaryCombinationAllConnectedFeatureIdsName = "Exemplary Combination FeatureIds - All Connected";
} // namespace

TEST_CASE("SimplnxCore::ScalarSegmentFeatures", "[Reconstruction][ScalarSegmentFeatures]")
TEST_CASE("SimplnxCore::ScalarSegmentFeatures", "[SimplnxCore][ScalarSegmentFeatures]")
{
UnitTest::LoadPlugins();

const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_CMakeExecutable, nx::core::unit_test::k_TestFilesDir, "6_5_test_data_1_v2.tar.gz", "6_5_test_data_1_v2");

// Read the Small IN100 Data set
Expand Down Expand Up @@ -82,7 +80,7 @@ TEST_CASE("SimplnxCore::ScalarSegmentFeatures", "[Reconstruction][ScalarSegmentF

UInt8Array& actives = dataStructure.getDataRefAs<UInt8Array>(activeArrayDataPath);
size_t numFeatures = actives.getNumberOfTuples();
REQUIRE(numFeatures == 848);
REQUIRE(numFeatures == 847);
}

{
Expand All @@ -100,8 +98,23 @@ TEST_CASE("SimplnxCore::ScalarSegmentFeatures", "[Reconstruction][ScalarSegmentF

TEST_CASE("SimplnxCore::ScalarSegmentFeatures: Neighbor Scheme", "[Reconstruction][ScalarSegmentFeatures]")
{
UnitTest::LoadPlugins();

/**
* We are going to use Catch2's GENERATE macro to create variations of parameter values.
* EVERYTHING after the GENERATE macro will be run for each of the generated sets of values
*/
auto [sectionName, inputDataArrayName, exemplaryFeatureIdsArrayName, neighborSchemeIndex] =
GENERATE(std::make_tuple("Shared Edges - Face Only", k_SharedEdgesInputArrayName, k_ExemplarySharedEdgesFaceOnlyFeatureIdsName, 0),
std::make_tuple("Shared Edges - All Connected", k_SharedEdgesInputArrayName, k_ExemplarySharedEdgesAllConnectedFeatureIdsName, 1),
std::make_tuple("Shared Points - Face Only", k_SharedPointsInputArrayName, k_ExemplarySharedPointsFaceOnlyFeatureIdsName, 0),
std::make_tuple("Shared Points - All Connected", k_SharedPointsInputArrayName, k_ExemplarySharedPointsAllConnectedFeatureIdsName, 1),
std::make_tuple("Nothing Shared - Face Only", k_NothingSharedInputArrayName, k_ExemplaryNothingSharedFaceOnlyFeatureIdsName, 0),
std::make_tuple("Nothing Shared - All Connected", k_NothingSharedInputArrayName, k_ExemplaryNothingSharedAllConnectedFeatureIdsName, 1),
std::make_tuple("Combination - Face Only", k_CombinationInputArrayName, k_ExemplaryCombinationFaceOnlyFeatureIdsName, 0),
std::make_tuple("Combination - All Connected", k_CombinationInputArrayName, k_ExemplaryCombinationAllConnectedFeatureIdsName, 1));

/**
* @note EVERYTHING from here to the end of the test will be run for **each** tuple set above
*/
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_CMakeExecutable, nx::core::unit_test::k_TestFilesDir, "segment_features_neighbor_scheme_test.tar.gz",
"segment_features_neighbor_scheme_test");
auto baseDataFilePath = fs::path(fmt::format("{}/segment_features_neighbor_scheme_test/segment_features_neighbor_scheme_test.dream3d", nx::core::unit_test::k_TestFilesDir));
Expand Down Expand Up @@ -136,16 +149,6 @@ TEST_CASE("SimplnxCore::ScalarSegmentFeatures: Neighbor Scheme", "[Reconstructio
// Are we going to randomize the featureIds when completed.
args.insertOrAssign(ScalarSegmentFeaturesFilter::k_RandomizeFeatures_Key, std::make_any<bool>(false));

auto [sectionName, inputDataArrayName, exemplaryFeatureIdsArrayName, neighborSchemeIndex] =
GENERATE(std::make_tuple("Shared Edges - Face Only", k_SharedEdgesInputArrayName, k_ExemplarySharedEdgesFaceOnlyFeatureIdsName, 0),
std::make_tuple("Shared Edges - All Connected", k_SharedEdgesInputArrayName, k_ExemplarySharedEdgesAllConnectedFeatureIdsName, 1),
std::make_tuple("Shared Points - Face Only", k_SharedPointsInputArrayName, k_ExemplarySharedPointsFaceOnlyFeatureIdsName, 0),
std::make_tuple("Shared Points - All Connected", k_SharedPointsInputArrayName, k_ExemplarySharedPointsAllConnectedFeatureIdsName, 1),
std::make_tuple("Nothing Shared - Face Only", k_NothingSharedInputArrayName, k_ExemplaryNothingSharedFaceOnlyFeatureIdsName, 0),
std::make_tuple("Nothing Shared - All Connected", k_NothingSharedInputArrayName, k_ExemplaryNothingSharedAllConnectedFeatureIdsName, 1),
std::make_tuple("Combination - Face Only", k_CombinationInputArrayName, k_ExemplaryCombinationFaceOnlyFeatureIdsName, 0),
std::make_tuple("Combination - All Connected", k_CombinationInputArrayName, k_ExemplaryCombinationAllConnectedFeatureIdsName, 1));

SECTION(sectionName)
{
DataPath inputDataArrayPath = ebsdScanDataPath.createChildPath(inputDataArrayName);
Expand Down
16 changes: 8 additions & 8 deletions src/simplnx/Utilities/SegmentFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Result<> SegmentFeatures::execute(IGridGeometry* gridGeom)
// Initialize a sequence of execution modifiers
int32 gnum = 1;
int64 nextSeed = 0;
int64 seed = getSeed(gnum, nextSeed);
int64 seed = 0; // Always use the very first value of the array that we are using to segment
usize size = 0;

// Initialize containers
Expand Down Expand Up @@ -205,18 +205,18 @@ Result<> SegmentFeatures::execute(IGridGeometry* gridGeom)
totalVoxelsSegmented += size;
}

// Send a progress message
throttledMessenger.sendThrottledMessage([&]() { return fmt::format("{:.2f}% - Features Found: {}", 100.0f * static_cast<float>(totalVoxelsSegmented) / static_cast<float>(totalVoxels), gnum); });
// Increment or set values for the next iteration
voxelsList.assign(size + 1, -1);
gnum++;

throttledMessenger.sendThrottledMessage([&]() { return fmt::format("{:.2f}% - Features Found: {}", 100.0f * static_cast<float>(totalVoxelsSegmented) / static_cast<float>(totalVoxels), gnum); });

// Get the next seed value
seed = getSeed(gnum, nextSeed); // If seed ends up being -1, then we will exit the loop.
nextSeed = seed + 1;
seed = getSeed(gnum, nextSeed);
}

m_MessageHelper.sendMessage(fmt::format("Total Features Found: {}", gnum));

m_FoundFeatures = gnum;
m_FoundFeatures = gnum - 1; // Decrement the gnum because it will end up 1 larger than it should have been.
m_MessageHelper.sendMessage(fmt::format("Total Features Found: {}", m_FoundFeatures));
return {};
}

Expand Down
Loading