我有一个图像,这是一个4D numpy数组。我想根据阈值做一个面具。这是基于如下所示的第一个4D阵列(平均值的40%)。所以我想把低于这个值的所有东西都归零来制作遮罩。我下面有一些代码,但当我有了nifti图像的面具看起来是错误的。有人能指出原因吗?我必须首先将numpy数组规范化为[0 1]吗?谢谢你的好意
mean = np.mean(im_aray[:,:,:,0])
threshold = 0.4 * mean_echo1
idx = im_array[:,:,:,0] < threshold
mask = np.ones(np.shape(im_array))
mask[idx,0] = threshold
字符串
1条答案
按热度按时间ghhkc1vu1#
你必须首先对图像进行归一化,然后计算阈值等等。
字符串