本文整理汇总了Python中nipy.core.api.Image.reordered_axes方法的典型用法代码示例。如果您正苦于以下问题:Python Image.reordered_axes方法的具体用法?Python Image.reordered_axes怎么用?Python Image.reordered_axes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nipy.core.api.Image
的用法示例。
在下文中一共展示了Image.reordered_axes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_synchronized_order
# 需要导入模块: from nipy.core.api import Image [as 别名]
# 或者: from nipy.core.api.Image import reordered_axes [as 别名]
def test_synchronized_order():
data = np.random.standard_normal((3,4,7,5))
im = Image(data, AffineTransform.from_params('ijkl', 'xyzt', np.diag([1,2,3,4,1])))
im_scrambled = im.reordered_axes('iljk').reordered_reference('xtyz')
im_unscrambled = image.synchronized_order(im_scrambled, im)
yield assert_equal, im_unscrambled.coordmap, im.coordmap
yield assert_almost_equal, im_unscrambled.get_data(), im.get_data()
yield assert_equal, im_unscrambled, im
yield assert_true, im_unscrambled == im
yield assert_false, im_unscrambled != im
# the images don't have to be the same shape
data2 = np.random.standard_normal((3,11,9,4))
im2 = Image(data, AffineTransform.from_params('ijkl', 'xyzt', np.diag([1,2,3,4,1])))
im_scrambled2 = im2.reordered_axes('iljk').reordered_reference('xtyz')
im_unscrambled2 = image.synchronized_order(im_scrambled2, im)
yield assert_equal, im_unscrambled2.coordmap, im.coordmap
# or the same coordmap
data3 = np.random.standard_normal((3,11,9,4))
im3 = Image(data, AffineTransform.from_params('ijkl', 'xyzt', np.diag([1,9,3,-2,1])))
im_scrambled3 = im3.reordered_axes('iljk').reordered_reference('xtyz')
im_unscrambled3 = image.synchronized_order(im_scrambled3, im)
yield assert_equal, im_unscrambled3.axes, im.axes
yield assert_equal, im_unscrambled3.reference, im.reference