Skip to content

BUG: Report an error when an ANG h5ebsd slice cannot be read - #72

Closed
imikejackson wants to merge 1 commit into
BlueQuartzSoftware:developfrom
imikejackson:fix/h5ang_missing_slice_error
Closed

imikejackson wants to merge 1 commit into
BlueQuartzSoftware:developfrom
imikejackson:fix/h5ang_missing_slice_error

Conversation

@imikejackson

Copy link
Copy Markdown
Collaborator

Summary

Reading an ANG-based .h5ebsd volume with a slice range that goes past the last slice in the file succeeded with no error. Each missing slice was filled with zeros. A CTF-based file with the same range fails with -77000.

  • H5AngReader::readFile() returned a negative value without setting an error code or message when the slice path was empty, the file could not be opened, or the slice group did not exist. Header and data failures returned the file-close status instead of the error.
  • H5AngVolumeReader::loadData() copied the child reader's error code, which was 0, so the failed slice was treated as a success.
  • Each failure now sets a negative error code and a message that names the file and the HDF5 slice path:
Code Failure
-90040 Empty slice path
-90041 File cannot be opened
-90042 Slice group does not exist
-90043 Header cannot be read
-90044 Data cannot be read
-90045 Slice group cannot be closed
-90046 File cannot be closed
  • H5AngVolumeReader never returns 0 after a failed slice read (also in getPhases()).
  • H5CtfVolumeReader already returns -77000 for a failed slice, so it is not changed.

Test Plan

  • New test EbsdLib::ebsdlib::H5AngMissingSlice (in AngImportTest.cpp) fails on develop and passes with this change. It covers the direct reader failures, one-slice ANG and CTF volumes, an ANG volume range past the file, and the existing CTF -77000 result.
  • macOS arm64, Release: full ctest suite passes, 430/430.

Related Issue

Related to BlueQuartzSoftware/simplnx#1867 (item ReadH5EbsdFilter#8). simplnx also rejects an out-of-range slice selection in preflight; this change fixes the reader so that other callers get an error too. The same defect was reported for DREAM.3D 6 in BlueQuartzSoftware/DREAM3D#952.

* H5AngReader::readFile() returned a negative value without setting an
  error code or message when the slice path was empty, the file could
  not be opened, or the slice group did not exist. Header and data
  failures returned the file-close status instead of the error.
* H5AngVolumeReader::loadData() returned the child's error code, which
  was 0, so a slice range that extends past the file succeeded and
  each missing slice was filled with zeros.
* Each failure now sets a negative error code (-90040 to -90046) and a
  message that names the file and the HDF5 slice path, and the volume
  reader never returns 0 after a failed slice read.
* Add the H5AngMissingSlice test: direct reader failures, a one-slice
  ANG and CTF volume, an ANG volume range past the file, and the
  existing CTF -77000 result.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
@imikejackson

Copy link
Copy Markdown
Collaborator Author

Closed in favor of #86, which merges this branch (with its history) together with the other open EbsdLib fixes for the next release, so simplnx can build against one EbsdLib branch. The branch is kept.

🤖 Generated with Claude Code

@imikejackson
imikejackson deleted the fix/h5ang_missing_slice_error branch November 13, 2026 16:27
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.

1 participant