def _make_border_mask(sz, borderSize, omitSlices=[]):
""" Creates a logical tensor of size
(#slices, #rows, #colums)
where 1/true is an "included" pixel, where "included" means
- not within borderSize pixels the edge of the xy plane
- not within a slice that is to be omitted.
"""
[s,m,n] = sz
bitMask = np.ones(sz, dtype=bool)
bitMask[omitSlices,:,:] = 0
if borderSize > 0:
bitMask[:, 0:borderSize, :] = 0
bitMask[:, (m-borderSize):m, :] = 0
bitMask[:, :, 0:borderSize] = 0
bitMask[:, :, (n-borderSize):n] = 0
return bitMask
评论列表
文章目录