@@ -1239,10 +1239,9 @@ def polymask(data,Poly,Spots=[]):
12391239 ax0 = figure .add_subplot ()
12401240 ax0 .axis ("off" )
12411241 figure .subplots_adjust (bottom = 0. ,top = 1. ,left = 0. ,right = 1. ,wspace = 0. ,hspace = 0. )
1242- for poly in Poly :
1243- px = np .array (poly ).T [0 ]/ scalex
1244- py = np .array (poly ).T [1 ]/ scaley
1245- ax0 .fill (px ,py ,inmask )
1242+ px = np .array (Poly ).T [0 ]/ scalex
1243+ py = np .array (Poly ).T [1 ]/ scaley
1244+ ax0 .fill (px ,py ,inmask )
12461245 for spot in Spots :
12471246 px = np .array (spot ).T [0 ]/ scalex
12481247 py = np .array (spot ).T [1 ]/ scaley
@@ -1271,21 +1270,14 @@ def MakeMaskMap(data,masks,iLim,jLim):
12711270 pixelSize = data ['pixelSize' ]
12721271 scalex = pixelSize [0 ]/ 1000.
12731272 scaley = pixelSize [1 ]/ 1000.
1274- frame = []
1275- poly = []
1273+ frame = np . zeros ( data [ 'size' ], dtype = 'uint8' )
1274+ poly = np . zeros ( data [ 'size' ], dtype = 'uint8' )
12761275 if iLim [0 ] == jLim [0 ] == 0 :
12771276 if masks ['Frames' ]:
12781277 frame = np .abs (polymask (data ,masks ['Frames' ])- 255 ) #turn inner to outer mask
12791278 if masks ['Polygons' ] or masks ['Points' ]:
12801279 poly = polymask (data ,masks ['Polygons' ],masks ['Points' ])
1281- if len (frame ):
1282- masks ['Pmask' ] = frame
1283- if len (poly ):
1284- masks ['Pmask' ] = masks ['Pmask' ]+ poly
1285- if len (poly ):
1286- masks ['Pmask' ] = poly
1287- else :
1288- masks ['Pmask' ] = []
1280+ masks ['Pmask' ] = frame + poly
12891281 tay ,tax = np .mgrid [iLim [0 ]+ 0.5 :iLim [1 ]+ .5 ,jLim [0 ]+ .5 :jLim [1 ]+ .5 ] #bin centers not corners
12901282 tax = np .asarray (tax * scalex ,dtype = np .float32 ).flatten ()
12911283 tay = np .asarray (tay * scaley ,dtype = np .float32 ).flatten ()
0 commit comments