Skip to content

ENH: Check the C-Axis Reference Misalignments inputs only in preflight - #1975

Open
joeykleingers wants to merge 1 commit into
BlueQuartzSoftware:developfrom
joeykleingers:topic/caxis-preflight-only
Open

joeykleingers wants to merge 1 commit into
BlueQuartzSoftware:developfrom
joeykleingers:topic/caxis-preflight-only

Conversation

@joeykleingers

Copy link
Copy Markdown
Contributor

Summary

The Compute C-Axis Reference Misalignments filter now checks each input one time, in preflight. This applies the knowledge-base rule "Run a filter, not its algorithm" (PR #1959) to the only filter that still followed the previous rule. IFilter::execute() always runs preflight before executeImpl(). Thus the input checks that the algorithm repeated through its static ComputeCAxisReferenceMisalignments::ValidateInputs() checked the same inputs a second time on every run. 5 files changed, +213 / −470 lines.

1. Input checks in the filter

  • src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/ComputeCAxisReferenceMisalignmentsFilter.cpp: the preflight input checks.
  • src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/ComputeCAxisReferenceMisalignmentsFilter.hpp: the preflight error codes and k_MinReferenceDirectionNorm.

preflightImpl() keeps only the checks that the parameters cannot make:

  • The reference direction has finite components and a length greater than 1.0e-12 (-98710).
  • Each selected array is a DataArray of the required type: Input Quaternions (-98715), Phases (-98717), Mask when Use Mask is on (-98719) and Crystal Structures (-98721). ArraySelectionParameter applies its type list only to an IDataArray, so a StringArray selection gets to preflightImpl().
  • Phases and the enabled mask have one tuple per quaternion (-98711).
  • The output name is not the name of an input array (-98726).

These codes now belong to ComputeCAxisReferenceMisalignmentsFilter. Their values do not change.

2. The algorithm relies on preflight

  • src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ComputeCAxisReferenceMisalignments.{hpp,cpp}

The algorithm no longer checks its inputs or the output array that the preflight CreateArrayAction creates. Its @pre lines give the preconditions. It keeps the checks that preflight cannot make: a phase value that is not an index into Crystal Structures (-98712), the non-hexagonal warning (-98713), and the result of each read and write.

3. Removed error codes

No path through the filter can return these codes, so they are removed:

  • -98714: the reference direction does not have three components. VectorParameter rejects this before preflight.
  • -98716, -98718, -98720, -98722: an input with the wrong component shape. The AllowedComponentShapes of each ArraySelectionParameter reject this before preflight.
  • -98723, -98724, -98725: an output array with the wrong type, component shape or tuple count. The preflight CreateArrayAction creates the output as float32 with component shape {1} and the quaternion tuple shape.

The filter was added after the DREAM3D-NX 7.4.2 release, so no released error code changes. The filter documentation lists no error codes and does not change.

4. Tests

  • src/Plugins/OrientationAnalysis/test/ComputeCAxisReferenceMisalignmentsTest.cpp

The tests that called the algorithm directly are removed. Each input check is reached through the filter. The StringArray preflight test now selects a StringArray for each of the four arrays and asserts the type error code of that array.

Test plan

  • All 19 ComputeCAxisReferenceMisalignments tests pass in an in-core Release build (SIMPLNX_TEST_ALGORITHM_PATH=0) on macOS arm64.
  • All 19 ComputeCAxisReferenceMisalignments tests pass in an out-of-core Release build (DREAM3DNX_ENABLE_OOC=ON, SIMPLNX_TEST_ALGORITHM_PATH=1) on macOS arm64.
  • Each of the 7 remaining preflight error codes has a test that reaches it through the filter and asserts its code.
  • CI passes on all platforms.

Related Issue

Closes #1966

@joeykleingers joeykleingers self-assigned this Nov 13, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

IFilter::execute() always runs preflight before executeImpl(), so the
input checks that ComputeCAxisReferenceMisalignments::operator()()
repeated through the static ValidateInputs() only checked the same
inputs a second time on every run. This change applies the
knowledge-base rule "Run a filter, not its algorithm" to this filter.

* The input checks move into the filter. Preflight keeps only the checks
  that the parameters cannot make: the reference direction is finite and
  not near zero, each selected array is a DataArray of the required type
  (ArraySelectionParameter does not stop a StringArray), Phases and the
  enabled mask have one tuple per quaternion, and the output path is
  not an input path.
* The algorithm no longer checks its inputs or the output array that
  preflight creates. It keeps the phase range check (-98712) and the
  non-hexagonal warning (-98713). Its @pre lines give its preconditions.
* Error codes -98714, -98716, -98718, -98720 and -98722 to -98725 are
  removed, because no path through the filter can return them. The
  remaining preflight codes move to the filter class.
* The tests that called the algorithm directly are removed. The
  StringArray preflight test now reaches the type checks of all four
  selected arrays (-98715, -98717, -98719, -98721) through the filter.

Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
@joeykleingers
joeykleingers force-pushed the topic/caxis-preflight-only branch from d45c7ec to ea9b052 Compare November 13, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Check the C-Axis Reference Misalignments inputs only in preflight

1 participant