Repository navigation
BUG: Reject an h5ebsd slice that is larger than the volume - #78
Closed
imikejackson wants to merge 1 commit into
Closed
imikejackson wants to merge 1 commit into
imikejackson wants to merge 1 commit into
Conversation
- H5AngVolumeReader::loadData and H5CtfVolumeReader::loadData center each slice in the volume at (volume - slice) / 2. A slice with more columns or rows than the volume got a negative start, so its cells were written into the previous slice, and past the start or end of the buffer for the first or last slice. loadData returned 0. - Both readers now return a new error code (-90050 for ANG, -77001 for CTF) with a message naming the file, the slice index, the slice size and the volume size when a slice is larger than the volume. - A slice smaller than the volume is still centered with zero padding: converters write the largest slice size as the volume size, so such files are valid. - Add H5EbsdVolumeReaderTest with synthetic ANG and CTF volumes for both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
H5AngVolumeReader::loadData()andH5CtfVolumeReader::loadData()place each slice in the volume starting at(volume size - slice size) / 2in X and Y. The volume size is the caller'sxpoints/ypoints, normally theXPoints/YPointsvalues in the.h5ebsdheader (getDims()). The slice size comes from that slice's own header. Nothing checked that the slice fits.loadData()returned 0.XPoints/YPointsis smaller than a slice: a file written by another tool, a damaged file, or a caller that passes smaller dimensions toloadData(). simplnxEbsdToH5Ebsdwrites the largest slice size, so files it writes are not affected.Slice 1 in file '/path/vol.h5ebsd' has 8 x 4 cells, which is larger than the volume size of 6 x 4 cells. Each slice must fit inside the volume size.H5AngVolumeReaderH5CtfVolumeReaderEbsdToH5Ebsd(and DREAM.3D 6) write the largest slice size as the volume size, so a stack with mixed slice sizes is a valid file that this reader must keep loading. A new test pins this behavior.Overlap with #72
#72 (
fix/h5ang_missing_slice_error) also changesH5AngVolumeReader::loadData(), a few lines above this change (the error code copied afterreader->readFile()fails). The hunks do not overlap and the error codes do not collide (#72 uses -90040 to -90046). Either merge order works; if Git reports a conflict, keep both changes.Test Plan
EbsdLib::ebsdlib::H5EbsdVolumeReader-SliceLargerThanVolume(in the newH5EbsdVolumeReaderTest.cpp) fails ondevelopand passes with this change. It writes a three-slice ANG volume and a three-slice CTF volume whose middle slice has two more columns than the header. Ondevelop,loadData()returns 0 and the last cell of slice 0 holds the first cell of slice 1 (1000 == 23), for both ANG and CTF.EbsdLib::ebsdlib::H5EbsdVolumeReader-SliceSmallerThanVolumeIsCenteredpasses ondevelopand with this change (the behavior is kept).ctestsuite passes, 431/431 (429 baseline + 2 new).Related Issue
Related to BlueQuartzSoftware/simplnx#1882 (the
ReadH5Ebsd"not verified" note on slice placement in the volume readers).🤖 Generated with Claude Code