|
9 | 9 | se = IceFloeTracker.MorphSE.strel_box((n, n)) |
10 | 10 | @test IceFloeTracker.MorphSE.dilate(a, se) == ones(Int, n, n) |
11 | 11 |
|
12 | | - # Bothat, opening, erode using output from Matlab |
| 12 | + # Bothat, opening, erode, filling holes, reconstruction using output from Matlab |
13 | 13 | A = zeros(Bool, 41, 41) |
14 | 14 | A[(21 - 10):(21 + 10), (21 - 10):(21 + 10)] .= 1 |
| 15 | + I = falses(8, 8) |
| 16 | + I[1:8, 3:6] .= 1 |
| 17 | + I[[CartesianIndex(4, 4), CartesianIndex(5, 5)]] .= 0 |
| 18 | + I |
15 | 19 | se = centered(IceFloeTracker.se_disk4()) |
| 20 | + |
| 21 | + #read in expected files from MATLAB |
16 | 22 | path = joinpath(test_data_dir, "morphSE") |
17 | 23 | erode_withse_exp = readdlm(joinpath(path, "erode_withse1_exp.csv"), ',', Bool) |
18 | 24 | bothat_withse_exp = readdlm(joinpath(path, "bothat_withse1_exp.csv"), ',', Bool) |
19 | 25 | open_withse_exp = readdlm(joinpath(path, "open_withse1_exp.csv"), ',', Bool) |
20 | 26 | reconstruct_exp = readdlm(joinpath(path, "reconstruct_exp.csv"), ',', Int64) |
21 | 27 | matrix_A = readdlm(joinpath(path, "mat_a.csv"), ',', Int64) |
22 | 28 | matrix_B = readdlm(joinpath(path, "mat_b.csv"), ',', Int64) |
| 29 | + filled_holes_exp = readdlm(joinpath(path, "filled_holes.csv"), ',', Int64) |
| 30 | + |
| 31 | + #run tests |
23 | 32 | @test open_withse_exp == IceFloeTracker.MorphSE.opening(A, se) |
24 | 33 | @test erode_withse_exp == IceFloeTracker.MorphSE.erode(A, se) |
25 | 34 | @test bothat_withse_exp == IceFloeTracker.MorphSE.bothat(A, se) |
26 | 35 | @test reconstruct_exp == IceFloeTracker.MorphSE.mreconstruct( |
27 | 36 | IceFloeTracker.MorphSE.dilate, matrix_B, matrix_A |
28 | 37 | ) |
| 38 | + @test filled_holes_exp == IceFloeTracker.MorphSE.fill_holes(I) |
29 | 39 | end |
0 commit comments