def pyramid_expand_3d(volume, upscale=2, sigma=None, order=1, mode='reflect', cval=0):
_check_factor(upscale)
#_check_float32(volume)
#volume=img_as_float(volume)
volume=volume.astype('float64') # /(12641.6) #
x = volume.shape[0]
y = volume.shape[1]
z = volume.shape[2]
out_x = math.ceil(upscale * x)
out_y = math.ceil(upscale * y)
out_z = math.ceil(upscale * z)
if sigma is None:
# automatically determine sigma which covers > 99% of distribution
sigma = 2 * upscale / 6.0
start_time = time.time()
resized = resize(volume, (out_x, out_y, out_z), order=order, mode=mode, cval=cval)
start_time = time.time()
out = _smooth_3d(resized, sigma, mode, cval)
# I want it to be float32
start_time = time.time()
out=out.astype('float32')
return out
评论列表
文章目录