@@ -2,75 +2,75 @@ import { computeThreshold } from '../../threshold';
2
2
3
3
test ( 'Huang should work similarily to ImageJ' , ( ) => {
4
4
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
5
- expect ( computeThreshold ( img , 'huang' ) ) . toBe ( 132 ) ;
5
+ expect ( computeThreshold ( img , { algorithm : 'huang' } ) ) . toBe ( 132 ) ;
6
6
} ) ;
7
7
8
8
test ( 'Intermodes should work like ImageJ' , ( ) => {
9
9
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
10
- expect ( computeThreshold ( img , 'intermodes' ) ) . toBe ( 166 ) ;
10
+ expect ( computeThreshold ( img , { algorithm : 'intermodes' } ) ) . toBe ( 166 ) ;
11
11
} ) ;
12
12
13
13
test ( 'Isodata should work like ImageJ' , ( ) => {
14
14
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
15
- expect ( computeThreshold ( img , 'isodata' ) ) . toBe ( 135 ) ;
15
+ expect ( computeThreshold ( img , { algorithm : 'isodata' } ) ) . toBe ( 135 ) ;
16
16
} ) ;
17
17
18
18
test ( 'Percentile should work like ImageJ' , ( ) => {
19
19
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
20
- expect ( computeThreshold ( img , 'percentile' ) ) . toBe ( 90 ) ;
20
+ expect ( computeThreshold ( img , { algorithm : 'percentile' } ) ) . toBe ( 90 ) ;
21
21
} ) ;
22
22
23
23
test ( 'Li should work similarily to ImageJ' , ( ) => {
24
24
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
25
- expect ( computeThreshold ( img , 'li' ) ) . toBe ( 117 ) ;
25
+ expect ( computeThreshold ( img , { algorithm : 'li' } ) ) . toBe ( 117 ) ;
26
26
} ) ;
27
27
28
28
test ( 'MaxEntropy should work like ImageJ' , ( ) => {
29
29
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
30
- expect ( computeThreshold ( img , 'maxEntropy' ) ) . toBe ( 126 ) ;
30
+ expect ( computeThreshold ( img , { algorithm : 'maxEntropy' } ) ) . toBe ( 126 ) ;
31
31
} ) ;
32
32
33
33
test ( 'Mean should work like ImageJ' , ( ) => {
34
34
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
35
- expect ( computeThreshold ( img , 'mean' ) ) . toBe ( 106 ) ;
35
+ expect ( computeThreshold ( img , { algorithm : 'mean' } ) ) . toBe ( 106 ) ;
36
36
} ) ;
37
37
38
38
test ( 'MinError should work like ImageJ' , ( ) => {
39
39
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
40
- expect ( computeThreshold ( img , 'minError' ) ) . toBe ( 101 ) ;
40
+ expect ( computeThreshold ( img , { algorithm : 'minError' } ) ) . toBe ( 101 ) ;
41
41
} ) ;
42
42
43
43
test ( 'Minimum should work like ImageJ' , ( ) => {
44
44
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
45
- expect ( computeThreshold ( img , 'minimum' ) ) . toBe ( 234 ) ;
45
+ expect ( computeThreshold ( img , { algorithm : 'minimum' } ) ) . toBe ( 234 ) ;
46
46
} ) ;
47
47
48
48
test ( 'Moments should work like ImageJ' , ( ) => {
49
49
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
50
- expect ( computeThreshold ( img , 'moments' ) ) . toBe ( 127 ) ;
50
+ expect ( computeThreshold ( img , { algorithm : 'moments' } ) ) . toBe ( 127 ) ;
51
51
} ) ;
52
52
53
53
test ( 'Otsu should work like ImageJ' , ( ) => {
54
54
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
55
- expect ( computeThreshold ( img , 'otsu' ) ) . toBe ( 135 ) ;
55
+ expect ( computeThreshold ( img , { algorithm : 'otsu' } ) ) . toBe ( 135 ) ;
56
56
} ) ;
57
57
58
58
test ( 'RenyiEntropy should work similarily to ImageJ' , ( ) => {
59
59
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
60
- expect ( computeThreshold ( img , 'renyiEntropy' ) ) . toBe ( 116 ) ;
60
+ expect ( computeThreshold ( img , { algorithm : 'renyiEntropy' } ) ) . toBe ( 116 ) ;
61
61
} ) ;
62
62
63
63
test ( 'Shanbhag should work like ImageJ' , ( ) => {
64
64
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
65
- expect ( computeThreshold ( img , 'shanbhag' ) ) . toBe ( 116 ) ;
65
+ expect ( computeThreshold ( img , { algorithm : 'shanbhag' } ) ) . toBe ( 116 ) ;
66
66
} ) ;
67
67
68
68
test ( 'Triangle should work like ImageJ' , ( ) => {
69
69
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
70
- expect ( computeThreshold ( img , 'triangle' ) ) . toBe ( 87 ) ;
70
+ expect ( computeThreshold ( img , { algorithm : 'triangle' } ) ) . toBe ( 87 ) ;
71
71
} ) ;
72
72
73
73
test ( 'Yen should work like ImageJ' , ( ) => {
74
74
const img = testUtils . load ( 'various/grayscale_by_zimmyrose.png' ) ;
75
- expect ( computeThreshold ( img , 'yen' ) ) . toBe ( 108 ) ;
75
+ expect ( computeThreshold ( img , { algorithm : 'yen' } ) ) . toBe ( 108 ) ;
76
76
} ) ;
0 commit comments