-
-
Notifications
You must be signed in to change notification settings - Fork 749
Merge MetaIO 2026-07-22 (8c41a1d9): fix #6575 B64/B65/B66 #6692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hjmjohnson
merged 3 commits into
InsightSoftwareConsortium:main
from
hjmjohnson:update-vendored-metaio-8c41a1d
Jul 23, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha.cid
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| bafkreigfnnwheantnltrycahox5r3agtmf4q2vfmbabrjx7rjs66iikozi | ||
| bafkreifuvkmy4vvxyhxwcga5rvs3y75dwyt4bf3h6g2fyoxt3am5jqzbra |
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
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
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
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
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
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
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
119 changes: 119 additions & 0 deletions
119
Modules/ThirdParty/MetaIO/src/MetaIO/src/tests/testMeta13ImageList.cxx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| // Regression tests for the "ElementDataFile = LIST" reader. | ||
|
|
||
| #include <cstdio> | ||
| #include <fstream> | ||
| #include <iostream> | ||
| #include <string> | ||
|
|
||
| #include <metaImage.h> | ||
|
|
||
| namespace | ||
| { | ||
|
|
||
| const char * const slice0 = "testMeta13_s0.raw"; | ||
| const char * const slice1 = "testMeta13_s1.raw"; | ||
|
|
||
| void | ||
| WriteSlice(const char * name, unsigned char value) | ||
| { | ||
| std::ofstream out(name, std::ios::binary); | ||
| const unsigned char buf[4] = { value, value, value, value }; | ||
| out.write(reinterpret_cast<const char *>(buf), 4); | ||
| } | ||
|
|
||
| // A 2x2x2 MET_UCHAR volume whose slices come from a LIST. "listBody" supplies | ||
| // the ElementDataFile value and the file names that follow it. | ||
| void | ||
| WriteHeader(const std::string & name, const std::string & listBody) | ||
| { | ||
| std::ofstream out(name.c_str()); | ||
| out << "ObjectType = Image\n" | ||
| << "NDims = 3\n" | ||
| << "DimSize = 2 2 2\n" | ||
| << "ElementType = MET_UCHAR\n" | ||
| << "ElementSpacing = 1 1 1\n" | ||
| << "ElementByteOrderMSB = False\n" | ||
| << listBody; | ||
| } | ||
|
|
||
| bool | ||
| SlicesAreOneThenTwo(MetaImage & image) | ||
| { | ||
| for (int i = 0; i < 8; ++i) | ||
| { | ||
| const int expected = (i < 4) ? 1 : 2; | ||
| if (static_cast<int>(image.ElementData(i)) != expected) | ||
| { | ||
| std::cout << " element " << i << " is " << image.ElementData(i) << ", expected " << expected << '\n'; | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| } // namespace | ||
|
|
||
| int | ||
| main(int, char *[]) | ||
| { | ||
| WriteSlice(slice0, 1); | ||
| WriteSlice(slice1, 2); | ||
|
|
||
| const std::string bothSlices = std::string(slice0) + "\n" + slice1 + "\n"; | ||
|
|
||
| // A well-formed list reads both slices. | ||
| WriteHeader("testMeta13_valid.mhd", "ElementDataFile = LIST\n" + bothSlices); | ||
| { | ||
| MetaImage image; | ||
| if (!image.Read("testMeta13_valid.mhd")) | ||
| { | ||
| std::cout << "Well-formed LIST failed to read: FAIL" << '\n'; | ||
| return EXIT_FAILURE; | ||
| } | ||
| if (!SlicesAreOneThenTwo(image)) | ||
| { | ||
| std::cout << "Well-formed LIST read wrong values: FAIL" << '\n'; | ||
| return EXIT_FAILURE; | ||
| } | ||
| } | ||
|
|
||
| // A list naming fewer files than DimSize requires must not report success, | ||
| // because the tail of the buffer is never written. | ||
| WriteHeader("testMeta13_short.mhd", std::string("ElementDataFile = LIST\n") + slice0 + "\n"); | ||
| { | ||
| MetaImage image; | ||
| if (image.Read("testMeta13_short.mhd")) | ||
| { | ||
| std::cout << "Short LIST reported success: FAIL" << '\n'; | ||
| return EXIT_FAILURE; | ||
| } | ||
| } | ||
|
|
||
| // An out-of-range file dimension must fall back to NDims - 1 rather than | ||
| // indexing m_DimSize/m_SubQuantity outside [0, NDims). | ||
| const char * const outOfRange[] = { "ElementDataFile = LIST -1\n", "ElementDataFile = LIST 3\n" }; | ||
| for (const char * const listType : outOfRange) | ||
| { | ||
| WriteHeader("testMeta13_range.mhd", listType + bothSlices); | ||
| MetaImage image; | ||
| if (!image.Read("testMeta13_range.mhd")) | ||
| { | ||
| std::cout << "Out-of-range file dimension failed to read: FAIL (" << listType << ')' << '\n'; | ||
| return EXIT_FAILURE; | ||
| } | ||
| if (!SlicesAreOneThenTwo(image)) | ||
| { | ||
| std::cout << "Out-of-range file dimension read wrong values: FAIL (" << listType << ')' << '\n'; | ||
| return EXIT_FAILURE; | ||
| } | ||
| } | ||
|
|
||
| std::remove(slice0); | ||
| std::remove(slice1); | ||
| std::remove("testMeta13_valid.mhd"); | ||
| std::remove("testMeta13_short.mhd"); | ||
| std::remove("testMeta13_range.mhd"); | ||
|
|
||
| std::cout << "LIST element data file tests: PASS" << '\n'; | ||
| return EXIT_SUCCESS; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.