@@ -12,6 +12,7 @@ def setUp(self):
12
12
self .img1 = Image (img = np .zeros ((3 , 3 , 3 ), dtype = np .float ))
13
13
self .img2 = Image (img = np .zeros ((3 , 3 , 3 ), dtype = np .float )+ 1 )
14
14
self .img3 = Image (img = np .zeros ((3 , 3 , 3 ), dtype = np .float )+ 2 )
15
+ self .img4 = Image (img = np .zeros ((3 , 3 , 3 ), dtype = np .float )+ 7 )
15
16
16
17
def test_min_stack (self ):
17
18
stack = Stack ('min' , 2 )
@@ -77,6 +78,20 @@ def test_median_stack(self):
77
78
result = stack .calculate ().img
78
79
self .assertItemsEqual (result , np .ones ((3 , 3 , 3 ), dtype = np .uint16 ))
79
80
81
+ def test_sigma_stack (self ):
82
+ stack = Stack ('sigma' , 9 , kwargs = {'kappa' : 2 , 'max_iters' : 1 })
83
+ self .assertEqual (stack .mode , 'sigma' )
84
+ self .assertEqual (stack .num , 9 )
85
+ self .assertEqual (stack ._num , 0 )
86
+ for i in range (3 ):
87
+ stack ._update_stack (self .img2 )
88
+ stack ._update_stack (self .img3 )
89
+ stack ._update_stack (self .img4 )
90
+
91
+ result = stack .calculate ().img
92
+ self .assertItemsEqual (result , 1. / 3. + 3 * np .ones ((3 , 3 , 3 ),
93
+ dtype = np .uint16 ))
94
+
80
95
def assertItemsEqual (self , a , b ):
81
96
if isinstance (a , np .ndarray ):
82
97
self .assertTrue (np .all (a == b ))
0 commit comments