本文整理匯總了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