|
2 | 2 | println("------------------------------------------------") |
3 | 3 | println("------------ Create Segmentation-D,E Test --------------") |
4 | 4 |
|
5 | | - matlab_segmented_D = load("$(test_data_dir)/matlab_not_ice_mask.png") .> 0.5 |
6 | | - |
7 | | - matlab_segmented_E = convert(BitMatrix, load("$(test_data_dir)/matlab_segmented_c.png")) |
8 | | - matlab_watershed_D = convert(BitMatrix, load("$(test_data_dir)/matlab_watershed_B.png")) |
9 | | - matlab_watershed_E = convert(BitMatrix, load("$(test_data_dir)/matlab_watershed_C.png")) |
| 5 | + matlab_segmented_B = load("$(test_data_dir)/matlab_not_ice_mask.png") .<= 1 |
| 6 | + matlab_segmented_C = convert(BitMatrix, load("$(test_data_dir)/matlab_segmented_c.png")) |
| 7 | + matlab_watershed_D = convert(BitMatrix, load("$(test_data_dir)/matlab_watershed_D.png")) |
| 8 | + matlab_watershed_E = convert(BitMatrix, load("$(test_data_dir)/matlab_watershed_E.png")) |
10 | 9 | matlab_watershed_intersect = convert( |
11 | 10 | BitMatrix, load("$(test_data_dir)/matlab_watershed_intersect.png") |
12 | 11 | ) |
13 | 12 |
|
14 | 13 | ## Run function with Matlab inputs |
15 | | - @time watershed_D_borders = IceFloeTracker.segmentation_D(matlab_segmented_D) #Matlab_not_ice_mask |
16 | | - @time watershed_E_borders = IceFloeTracker.segmentation_E(matlab_segmented_E) #matlab_segmented_c |
| 14 | + @time watershed_D_borders = IceFloeTracker.segmentation_D(matlab_segmented_C) #Matlab_segmented_c |
| 15 | + @time watershed_E_borders = IceFloeTracker.segmentation_E(matlab_segmented_B) #Matlab_not_ice_mask |
17 | 16 | @time watershed_intersect = IceFloeTracker.segmentation_D_E( |
18 | 17 | watershed_D_borders, watershed_E_borders |
19 | 18 | ) |
20 | 19 |
|
21 | | - watershed_D_filename = |
22 | | - "$(test_output_dir)/watershed_d_" * |
23 | | - Dates.format(Dates.now(), "yyyy-mm-dd-HHMMSS") * |
24 | | - ".png" |
25 | | - IceFloeTracker.@persist watershed_D_borders watershed_D_filename |
26 | | - |
27 | | - watershed_E_filename = |
28 | | - "$(test_output_dir)/watershed_e_" * |
29 | | - Dates.format(Dates.now(), "yyyy-mm-dd-HHMMSS") * |
30 | | - ".png" |
31 | | - IceFloeTracker.@persist watershed_E_borders watershed_E_filename |
| 20 | + IceFloeTracker.@persist watershed_D_borders "./test_outputs/watershed_d.png" true |
| 21 | + |
| 22 | + IceFloeTracker.@persist watershed_D_borders "./test_outputs/watershed_e.png" true |
32 | 23 |
|
33 | | - watershed_intersect_filename = |
34 | | - "$(test_output_dir)/watershed_intersect_" * |
35 | | - Dates.format(Dates.now(), "yyyy-mm-dd-HHMMSS") * |
36 | | - ".png" |
37 | | - IceFloeTracker.@persist watershed_intersect watershed_intersect_filename |
| 24 | + IceFloeTracker.@persist watershed_D_borders "./test_outputs/watershed_intersect.png" true |
38 | 25 |
|
39 | 26 | ## Tests with Matlab inputs |
40 | | - @test typeof(watershed_E_borders) == typeof(matlab_watershed_D) |
41 | | - @test typeof(watershed_D_borders) == typeof(matlab_watershed_E) |
| 27 | + @test typeof(watershed_E_borders) == typeof(matlab_watershed_E) |
| 28 | + @test typeof(watershed_D_borders) == typeof(matlab_watershed_D) |
42 | 29 | @test typeof(watershed_intersect) == typeof(matlab_watershed_intersect) |
43 | | - @test test_similarity(matlab_watershed_D, watershed_D_borders, 0.064) |
44 | | - @test test_similarity(matlab_watershed_E, watershed_E_borders, 0.08) |
45 | | - @test test_similarity(matlab_watershed_intersect, watershed_intersect, 0.017) |
| 30 | + @test test_similarity(matlab_watershed_D, watershed_D_borders, 0.078) |
| 31 | + @test test_similarity(matlab_watershed_E, watershed_E_borders, 0.024) |
| 32 | + @test test_similarity(matlab_watershed_intersect, watershed_intersect, 0.0028) |
46 | 33 | end |
0 commit comments