Skip to content

Commit b654bb6

Browse files
committed
test of body contour generator
1 parent bad5019 commit b654bb6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
function test_suite = test_generateBodyContour
2+
%The output should always be test_suite, and the function name the same as
3+
%your file name
4+
5+
%% Header
6+
% The header is required to be in this format for automatic test collection
7+
% by MOxUnit
8+
9+
%To collect all tests defined below, this is needed in newer Matlab
10+
%versions. test_functions will collect function handles to below test
11+
%functions
12+
test_functions=localfunctions();
13+
14+
% This will initialize the test suite, i.e., take the functions from
15+
% test_functions, check if they contain "test", convert them into a MOxUnit
16+
% Test Case, and add them to the test-runner
17+
initTestSuite;
18+
19+
%% Custom Tests
20+
% Tests use assert*-like Functions to check outputs etc:
21+
% assertTrue(a) - a is true
22+
% assertFalse(a) - a is false
23+
% assertEqual(a,b) - a and be are equal (isequal)
24+
% assertElementsAlmostEqual(a,b) - numerical test for all vector / matrix elements. Has Additional arguments for absolute / relative tolerance
25+
% assertVectorsAlmostEqual(a,b) - numerical test using vector norm
26+
% assertExceptionThrown(f,id) - test if exception of id is thrown. Take care of Octave issues with exception id (or don't provide id)
27+
% Check MOxUnit for more information or look at other tests
28+
29+
function test_boxphantom_contour
30+
load BOXPHANTOM.mat
31+
cstNew = matRad_generateBodyContour(ct,cst);
32+
voxIxGenerated = cstNew{end,4}{1};
33+
voxIxExisting = cstNew{1,4}{1};
34+
35+
assertEqual(numel(voxIxGenerated),numel(voxIxExisting));
36+
assertEqual(sort(voxIxGenerated),sort(voxIxExisting));
37+
38+
function test_boxphantom_contour_withThreshold
39+
load BOXPHANTOM.mat
40+
cstNew = matRad_generateBodyContour(ct,cst,10);
41+
voxIxGenerated = cstNew{end,4}{1};
42+
assertTrue(isempty(voxIxGenerated));
43+
44+

0 commit comments

Comments
 (0)