|
| 1 | +function tests = test_orthogonalProjection |
| 2 | +% Test suite for the file orthogonalProjection. |
| 3 | +% |
| 4 | +% Test suite for the file orthogonalProjection |
| 5 | +% |
| 6 | +% Example |
| 7 | +% test_orthogonalProjection |
| 8 | +% |
| 9 | +% See also |
| 10 | +% orthogonalProjection |
| 11 | + |
| 12 | +% ------ |
| 13 | +% Author: David Legland |
| 14 | +% e-mail: david.legland@inrae.fr |
| 15 | +% Created: 2021-01-27, using Matlab 9.8.0.1323502 (R2020a) |
| 16 | +% Copyright 2021 INRAE - BIA-BIBS. |
| 17 | + |
| 18 | +tests = functiontests(localfunctions); |
| 19 | + |
| 20 | + |
| 21 | +function test_Proj_Z(testCase) %#ok<*DEFNU> |
| 22 | +% Test call of function without argument. |
| 23 | + |
| 24 | +img = createTestImage3d(); |
| 25 | + |
| 26 | +projXY = orthogonalProjection(img, 3, 'max'); |
| 27 | + |
| 28 | +assertEqual(testCase, size(projXY), [30 20]); |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +function test_Proj_Z_mean(testCase) %#ok<*DEFNU> |
| 33 | +% Test call of function without argument. |
| 34 | + |
| 35 | +img = createTestImage3d(); |
| 36 | + |
| 37 | +projXY = orthogonalProjection(img, 3, 'mean'); |
| 38 | + |
| 39 | +assertEqual(testCase, size(projXY), [30 20]); |
| 40 | + |
| 41 | + |
| 42 | +function test_Proj_Y(testCase) %#ok<*DEFNU> |
| 43 | +% Test call of function without argument. |
| 44 | + |
| 45 | +img = createTestImage3d(); |
| 46 | + |
| 47 | +projXZ = orthogonalProjection(img, 2, 'max'); |
| 48 | + |
| 49 | +assertEqual(testCase, size(projXZ), [30 1 10]); |
| 50 | + |
| 51 | + |
| 52 | +function test_Proj_X(testCase) %#ok<*DEFNU> |
| 53 | +% Test call of function without argument. |
| 54 | + |
| 55 | +img = createTestImage3d(); |
| 56 | + |
| 57 | +projYZ = orthogonalProjection(img, 1, 'max'); |
| 58 | + |
| 59 | +assertEqual(testCase, size(projYZ), [1 20 10]); |
| 60 | + |
| 61 | + |
| 62 | +function img = createTestImage3d |
| 63 | +% Create an image with size 30x20x10 containing a 20x10x5 cuboid. |
| 64 | + |
| 65 | +data = zeros([30 20 10], 'uint8'); |
| 66 | +data(6:25, 6:15, 3:7) = 100; |
| 67 | +img = Image('Data', data); |
0 commit comments