本文整理汇总了Python中msct_image.Image.data[X_pos[i],Y_pos[i],Z_pos[i]]方法的典型用法代码示例。如果您正苦于以下问题:Python Image.data[X_pos[i],Y_pos[i],Z_pos[i]]方法的具体用法?Python Image.data[X_pos[i],Y_pos[i],Z_pos[i]]怎么用?Python Image.data[X_pos[i],Y_pos[i],Z_pos[i]]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msct_image.Image
的用法示例。
在下文中一共展示了Image.data[X_pos[i],Y_pos[i],Z_pos[i]]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plan_ref
# 需要导入模块: from msct_image import Image [as 别名]
# 或者: from msct_image.Image import data[X_pos[i],Y_pos[i],Z_pos[i]] [as 别名]
def plan_ref(self):
"""
Generate a plane in the reference space for each label present in the input image
"""
image_output = Image(self.image_ref, self.verbose)
image_output.data *= 0
image_input_neg = Image(self.image_input, self.verbose).copy()
image_input_pos = Image(self.image_input, self.verbose).copy()
image_input_neg.data *=0
image_input_pos.data *=0
X, Y, Z = (self.image_input.data< 0).nonzero()
for i in range(len(X)):
image_input_neg.data[X[i], Y[i], Z[i]] = -self.image_input.data[X[i], Y[i], Z[i]] # in order to apply getNonZeroCoordinates
X_pos, Y_pos, Z_pos = (self.image_input.data> 0).nonzero()
for i in range(len(X_pos)):
image_input_pos.data[X_pos[i], Y_pos[i], Z_pos[i]] = self.image_input.data[X_pos[i], Y_pos[i], Z_pos[i]]
coordinates_input_neg = image_input_neg.getNonZeroCoordinates()
coordinates_input_pos = image_input_pos.getNonZeroCoordinates()
image_output.changeType('float32')
for coord in coordinates_input_neg:
image_output.data[:, :, int(coord.z)] = -coord.value #PB: takes the int value of coord.value
for coord in coordinates_input_pos:
image_output.data[:, :, int(coord.z)] = coord.value
return image_output