From 7c5d8d8ae78c6c8fb11c9efb04067dfbd9a7a05f Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Mon, 25 Nov 2024 10:06:10 -0500 Subject: [PATCH] Start documenting FeatureShapes filter to better understand the filter. Signed-off-by: Michael Jackson --- CMakeLists.txt | 2 +- .../Filters/Algorithms/ComputeShapes.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7cf5d6a3f..a799d3b204 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,7 @@ endif() file(TO_CMAKE_PATH "${CMAKE_COMMAND}" CMAKE_COMMAND_NORM) project(simplnx - VERSION 1.5.0 + VERSION 1.5.1 DESCRIPTION "SIMPLNX is a collection of C++ codes to process data, particularly Materials Science data, including EBSD data." HOMEPAGE_URL "https://github.com/bluequartzsoftware/simplnx" LANGUAGES CXX diff --git a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ComputeShapes.cpp b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ComputeShapes.cpp index 834dd39a9d..f3de8c190b 100644 --- a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ComputeShapes.cpp +++ b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ComputeShapes.cpp @@ -199,6 +199,8 @@ void ComputeShapes::find_moments() for(size_t k = 0; k < xPoints; k++) { int32_t gnum = featureIds[zStride + yStride + k]; + + // Compute a "modified" x, y and z coordinate which represent the corners of the voxel x = float(k * modXRes) + (origin[0] * static_cast(m_ScaleFactor)); y = float(j * modYRes) + (origin[1] * static_cast(m_ScaleFactor)); z = float(i * modZRes) + (origin[2] * static_cast(m_ScaleFactor)); @@ -208,6 +210,8 @@ void ComputeShapes::find_moments() y2 = y - (modYRes / 4.0f); z1 = z + (modZRes / 4.0f); z2 = z - (modZRes / 4.0f); + + // Compute the Distance from each corner of the voxel to the centroid of the Feature itself. xdist1 = (x1 - (centroids[gnum * 3 + 0] * static_cast(m_ScaleFactor))); ydist1 = (y1 - (centroids[gnum * 3 + 1] * static_cast(m_ScaleFactor))); zdist1 = (z1 - (centroids[gnum * 3 + 2] * static_cast(m_ScaleFactor))); @@ -233,6 +237,7 @@ void ComputeShapes::find_moments() ydist8 = (y2 - (centroids[gnum * 3 + 1] * static_cast(m_ScaleFactor))); zdist8 = (z2 - (centroids[gnum * 3 + 2] * static_cast(m_ScaleFactor))); + // Compute the 2nd Order Moments p + q + r = 2? xx = ((ydist1) * (ydist1)) + ((zdist1) * (zdist1)) + ((ydist2) * (ydist2)) + ((zdist2) * (zdist2)) + ((ydist3) * (ydist3)) + ((zdist3) * (zdist3)) + ((ydist4) * (ydist4)) + ((zdist4) * (zdist4)) + ((ydist5) * (ydist5)) + ((zdist5) * (zdist5)) + ((ydist6) * (ydist6)) + ((zdist6) * (zdist6)) + ((ydist7) * (ydist7)) + ((zdist7) * (zdist7)) + ((ydist8) * (ydist8)) + ((zdist8) * (zdist8)); @@ -242,6 +247,7 @@ void ComputeShapes::find_moments() zz = ((xdist1) * (xdist1)) + ((ydist1) * (ydist1)) + ((xdist2) * (xdist2)) + ((ydist2) * (ydist2)) + ((xdist3) * (xdist3)) + ((ydist3) * (ydist3)) + ((xdist4) * (xdist4)) + ((ydist4) * (ydist4)) + ((xdist5) * (xdist5)) + ((ydist5) * (ydist5)) + ((xdist6) * (xdist6)) + ((ydist6) * (ydist6)) + ((xdist7) * (xdist7)) + ((ydist7) * (ydist7)) + ((xdist8) * (xdist8)) + ((ydist8) * (ydist8)); + xy = ((xdist1) * (ydist1)) + ((xdist2) * (ydist2)) + ((xdist3) * (ydist3)) + ((xdist4) * (ydist4)) + ((xdist5) * (ydist5)) + ((xdist6) * (ydist6)) + ((xdist7) * (ydist7)) + ((xdist8) * (ydist8)); yz = ((ydist1) * (zdist1)) + ((ydist2) * (zdist2)) + ((ydist3) * (zdist3)) + ((ydist4) * (zdist4)) + ((ydist5) * (zdist5)) + ((ydist6) * (zdist6)) + ((ydist7) * (zdist7)) +