From ec0f2cb8f071293f444a960a3da0aafdeef5b808 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 10 Apr 2026 11:31:51 -0400 Subject: [PATCH] BUG: Fix display of Phase information Ang,Ctf,GrainMapper readers - Correctly displays the phase order from the file. - Updates some misc sphinx doc warnings (yes not really related to this PR). --- .../Filters/Algorithms/ReadAngData.cpp | 1 - .../Filters/ReadAngDataFilter.cpp | 4 +++ .../utilities/EbsdReaderUtilities.hpp | 31 +++++++++++++------ .../utilities/GrainMapper3DUtilities.cpp | 3 +- .../utilities/GrainMapper3DUtilities.hpp | 1 + .../SimplnxCore/docs/ReadRawBinaryFilter.md | 4 +-- .../docs/RemoveFlaggedEdgesFilter.md | 4 +-- .../docs/RemoveFlaggedTrianglesFilter.md | 4 +-- 8 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ReadAngData.cpp b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ReadAngData.cpp index 8516ce3216..4b34d4c179 100644 --- a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ReadAngData.cpp +++ b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ReadAngData.cpp @@ -34,7 +34,6 @@ Result<> ReadAngData::operator()() { return MakeErrorResult(reader.getErrorCode(), reader.getErrorMessage()); } - const auto result = loadMaterialInfo(&reader); if(result.first < 0) { diff --git a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/ReadAngDataFilter.cpp b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/ReadAngDataFilter.cpp index 62da778895..b62755cac3 100644 --- a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/ReadAngDataFilter.cpp +++ b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/ReadAngDataFilter.cpp @@ -107,6 +107,10 @@ IFilter::PreflightResult ReadAngDataFilter::preflightImpl(const DataStructure& d { return {MakeErrorResult(reader.getErrorCode(), reader.getErrorMessage())}; } + if(reader.getGrid().empty()) + { + return {MakeErrorResult(-19501, fmt::format("Input file '{}' is missing the GRID header key.", pInputFileValue.string()))}; + } CreateImageGeometryAction::DimensionType imageGeomDims = {static_cast(reader.getXDimension()), static_cast(reader.getYDimension()), static_cast(1)}; std::vector tupleDims = {imageGeomDims[2], imageGeomDims[1], imageGeomDims[0]}; diff --git a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/EbsdReaderUtilities.hpp b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/EbsdReaderUtilities.hpp index d8b3b72e28..eb09115e10 100644 --- a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/EbsdReaderUtilities.hpp +++ b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/EbsdReaderUtilities.hpp @@ -245,34 +245,47 @@ void GeneratePreflightPhaseInformation(ReaderType& reader, std::vector || std::is_same_v || std::is_same_v) { - preflightUpdatedValues.push_back({fmt::format("{}: ", phaseIndex++), fmt::format("Material Name: {} | Formula: {} | Crystal Symmetry: {}", phaseInfo->getMaterialName(), - phaseInfo->getFormula(), laueOps[phaseInfo->determineOrientationOpsIndex()]->getSymmetryName())}); + if(phaseInfo == nullptr) + { + continue; + } + preflightUpdatedValues.push_back({fmt::format("{}: ", phaseInfo->getPhaseIndex()), fmt::format("Material Name: {} | Formula: {} | Crystal Symmetry: {}", phaseInfo->getMaterialName(), + phaseInfo->getFormula(), laueOps[phaseInfo->determineOrientationOpsIndex()]->getSymmetryName())}); } if constexpr(std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v) { - preflightUpdatedValues.push_back({fmt::format("{}: ", phaseIndex++), fmt::format("Material Name: {} | Crystal Symmetry: {} | Comment: {}", phaseInfo->getMaterialName(), - laueOps[phaseInfo->determineOrientationOpsIndex()]->getSymmetryName(), phaseInfo->getComment())}); + if(phaseInfo == nullptr) + { + continue; + } + preflightUpdatedValues.push_back({fmt::format("{}: ", phaseInfo->getPhaseIndex()), fmt::format("Material Name: {} | Crystal Symmetry: {} | Comment: {}", phaseInfo->getMaterialName(), + laueOps[phaseInfo->determineOrientationOpsIndex()]->getSymmetryName(), phaseInfo->getComment())}); } if constexpr(std::is_same_v) { - preflightUpdatedValues.push_back({fmt::format("{}: ", phaseIndex++), fmt::format("Material Name: {} | Crystal Symmetry: {} | Space Group: {}", phaseInfo->getMaterialName(), - laueOps[phaseInfo->determineOrientationOpsIndex()]->getSymmetryName(), phaseInfo->getSpaceGroup())}); + if(phaseInfo == nullptr) + { + continue; + } + preflightUpdatedValues.push_back( + {fmt::format("{}: ", phaseInfo->getPhaseIndex()), fmt::format("Material Name: {} | Crystal Symmetry: {} | Space Group: {}", phaseInfo->getMaterialName(), + laueOps[phaseInfo->determineOrientationOpsIndex()]->getSymmetryName(), phaseInfo->getSpaceGroup())}); } if constexpr(std::is_same_v) { preflightUpdatedValues.push_back( - {fmt::format("{}: ", phaseIndex++), fmt::format("Material Name: {} | Crystal Symmetry: {} | Space Group: {}", phaseInfo.Name, - ebsdlib::LaueOps::GetOrientationOpsFromSpaceGroupNumber(phaseInfo.SpaceGroup)->getSymmetryName(), phaseInfo.SpaceGroup)}); + {fmt::format("{}: ", phaseInfo.PhaseIndex), fmt::format("Material Name: {} | Crystal Symmetry: {} | Space Group: {}", phaseInfo.Name, + ebsdlib::LaueOps::GetOrientationOpsFromSpaceGroupNumber(phaseInfo.SpaceGroup)->getSymmetryName(), phaseInfo.SpaceGroup)}); } } } diff --git a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.cpp b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.cpp index 8dbee80af2..e586138df0 100644 --- a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.cpp +++ b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.cpp @@ -380,7 +380,7 @@ herr_t GrainMapperReader::readPhaseInfo(hid_t parentId) m_PhaseInfos.clear(); // Now we know how many phases we have, we need to programmatically generate those phase names - // in order to keep them consistent. Yep, someone didn't really think through the parsing of this + // to keep them consistent. Yep, no one really thought through the parsing of this // or assumptions are being made about the order that HDF5 is going to give them back to you. Either // is bad. for(int i = 0; i < phaseNames.size(); i++) @@ -391,6 +391,7 @@ herr_t GrainMapperReader::readPhaseInfo(hid_t parentId) auto phaseDGidSentinel = H5Support::H5ScopedGroupSentinel(phaseGid, true); GrainMapperPhase phase; + phase.PhaseIndex = i; error = H5Lite::readStringDataset(phaseGid, Constants::k_Name, phase.Name); if(error < 0) { diff --git a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.hpp b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.hpp index 197c5f570a..7b2c9075d7 100644 --- a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.hpp +++ b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.hpp @@ -69,6 +69,7 @@ class ORIENTATIONANALYSIS_EXPORT GrainMapperReader int32_t SpaceGroup; std::vector UnitCell; // ABC, Alpha, Beta, Gamma std::string UniversalHermannMauguin; + int32_t PhaseIndex; } GrainMapperPhase; nx::core::Result<> readHeaderOnly(); diff --git a/src/Plugins/SimplnxCore/docs/ReadRawBinaryFilter.md b/src/Plugins/SimplnxCore/docs/ReadRawBinaryFilter.md index eabea9a1c3..108db506ba 100644 --- a/src/Plugins/SimplnxCore/docs/ReadRawBinaryFilter.md +++ b/src/Plugins/SimplnxCore/docs/ReadRawBinaryFilter.md @@ -29,7 +29,7 @@ The types of data that can be read with this **Filter** include: --- -### Tuple Dimensions +### A Note about Tuple and Component Dimensions The tuple dimensions define the shape of the output **Data Array**. For example, a 3D volume with 100 x 200 x 50 voxels would have tuple dimensions of `50, 200, 100` (slowest to fastest, i.e., Z, Y, X). @@ -37,8 +37,6 @@ When creating the output array inside an **Attribute Matrix**, the tuple dimensi If the output array is **not** inside an Attribute Matrix, then the user **must** check *Set Tuple Dimensions* and provide the dimensions explicitly. -### Component Dimensions - This parameter tells the program how many values are present for each *tuple* and how they are organized. The component dimensions are specified as a table of values (slowest to fastest dimension). Examples: diff --git a/src/Plugins/SimplnxCore/docs/RemoveFlaggedEdgesFilter.md b/src/Plugins/SimplnxCore/docs/RemoveFlaggedEdgesFilter.md index 8e30bfca5a..e7ef253000 100644 --- a/src/Plugins/SimplnxCore/docs/RemoveFlaggedEdgesFilter.md +++ b/src/Plugins/SimplnxCore/docs/RemoveFlaggedEdgesFilter.md @@ -12,14 +12,14 @@ This **Filter** removes **Edges** from the supplied **Edges Geometry** that are For each of the vertex and edge data attribute matrices, the user can select to copy none, some or all of the associated data arrays into the newly created geometry. If the user wishes to not copy any of the data, just leave the choice to "Copy Selected XXX Data" but do not populate the list with any selections. -### Vertex Data Handling +### A Note on Vertex Data Handling The *Vertex Data Handling* parameter controls which vertex data arrays are transferred to the reduced geometry: - **Copy Selected Vertex Data [0]**: Copies only the vertex arrays selected by the user into the new geometry. - **Copy All Vertex Data [1]**: Copies all arrays from the vertex attribute matrix into the new geometry. -### Edge Data Handling +### A Note on Edge Data Handling The *Edge Data Handling* parameter controls which edge data arrays are transferred to the reduced geometry: diff --git a/src/Plugins/SimplnxCore/docs/RemoveFlaggedTrianglesFilter.md b/src/Plugins/SimplnxCore/docs/RemoveFlaggedTrianglesFilter.md index cce5bfb7f2..be10083909 100644 --- a/src/Plugins/SimplnxCore/docs/RemoveFlaggedTrianglesFilter.md +++ b/src/Plugins/SimplnxCore/docs/RemoveFlaggedTrianglesFilter.md @@ -12,14 +12,14 @@ This **Filter** removes **Triangles** from the supplied **Triangle Geometry** th For each of the vertex and triangle (face) data attribute matrices, the user can select to copy none, some or all of the associated data arrays into the newly created geometry. If the user wishes to not copy any of the data, just leave the choice to "Copy Selected XXX Data" but do not populate the list with any selections. -### Vertex Data Handling +### A Note About Vertex Data Handling The *Vertex Data Handling* parameter controls which vertex data arrays are transferred to the reduced geometry: - **Copy Selected Vertex Data [0]**: Copies only the vertex arrays selected by the user into the new geometry. - **Copy All Vertex Data [1]**: Copies all arrays from the vertex attribute matrix into the new geometry. -### Triangle Data Handling +### A Note About Triangle Data Handling The *Triangle Data Handling* parameter controls which triangle (face) data arrays are transferred to the reduced geometry: