#5: Add a test suite - #6
Merged
Merged
Conversation
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.
Add automated test suite and CI
Summary
Adds a MATLAB
matlab.unittesttest suite for the toolbox and wires it up to GitHub Actions so every push and PR runs the tests automatically.Closes #5
What's in this PR
Unit tests (
tests/unit/, 33 tests) covering the pure helpers in+petraToCT/+tools/(radius2measure,getLargestCC,fillAllHoles,fillSmallHoles,applyHUMapping) and the histogram normalisation. All run in seconds and need no external tools or data.Integration tests (
tests/integration/, 4 tests) exercisingdebias,segmentationSPM, and the fullconvertpipeline against a small defaced PETRA fixture attests/fixtures/petra.nii.gz. Gated withassumeTrueso they filter (not fail) when SPM or 3D Slicer aren't available. Intended for local pre-release runs; they report as filtered in CI.Small refactor: extracted the hard-coded HU calibration (
-1000/42/-2929.6 * x + 3274.9) fromconvert.minto a new pure helper+petraToCT/+tools/applyHUMapping.mso the calibration numbers can be pinned by a unit test.GitHub Actions workflow (
.github/workflows/ci.yml) running the suite onubuntu-latestwithmatlab-actions/setup-matlab@v3(Image Processing + Signal Processing toolboxes) on every push tomainand every PR.README updated with a CI badge and a
## Testingsection documenting how to run the suite locally.Test plan
runtests("tests", IncludeSubfolders=true)passes locally (33 unit + 4 integration = 37 tests).mainrequiring theMATLAB testscheck.Notes
tests/fixtures/petra.nii.gz, 4.6 MB) is a defaced, 2 mm isotropic PETRA volume. Generation pipeline is documented intests/fixtures/README.md.