将小数组的值添加到更大数组中的位置

时间:2018-02-09 14:28:19

标签: python arrays numpy scipy scikit-image

我有以下问题。我有一个形状的阵列(21,41,91)。现在我需要用一个填充框数组中给定的线坐标。现在我想将snowmage球添加到box数组中的coodintates中,以便周围的球坐标也可以在boxarray中添加(将球添加到该线坐标)。首先,我可以以某种方式使用行的索引来提供box数组,并将值1放到box数组中的坐标中吗?然后我如何将球坐标添加到盒子阵列?

import numpy as np
from skimage.morphology import ball
box = np.zeros(21,41,91)
ball1 = ball(3)
linecoordinates = np.array([[ 14,11,35],
 [ 13,14,37],
 [ 11,17,38],
 [ 11,19,41],
 [ 12,21,43],
 [ 15,24,46],
 [ 18,27,46],
 [ 19,30,45],
 [ 20,33,45],
 [ 21,36,46],
 [ 22,37,47],
 [ 24,37,47],
 [ 23,40,49],
 [ 24,42,51],
 [ 21,44,50],
 [ 19,46,48],
 [ 18,47,45]])

0 个答案:

没有答案