本文整理汇总了Python中nipy.core.reference.coordinate_map.AffineTransform.identity方法的典型用法代码示例。如果您正苦于以下问题:Python AffineTransform.identity方法的具体用法?Python AffineTransform.identity怎么用?Python AffineTransform.identity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nipy.core.reference.coordinate_map.AffineTransform
的用法示例。
在下文中一共展示了AffineTransform.identity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_affine_identity
# 需要导入模块: from nipy.core.reference.coordinate_map import AffineTransform [as 别名]
# 或者: from nipy.core.reference.coordinate_map.AffineTransform import identity [as 别名]
def test_affine_identity():
aff = AffineTransform.identity('ijk')
yield assert_equal, aff.affine, np.eye(4)
yield assert_equal, aff.function_domain, aff.function_range
x = np.array([3, 4, 5])
# AffineTransform's aren't CoordinateMaps, so
# they don't have "function" attributes
yield assert_false, hasattr(aff, 'function')
示例2: setup
# 需要导入模块: from nipy.core.reference.coordinate_map import AffineTransform [as 别名]
# 或者: from nipy.core.reference.coordinate_map.AffineTransform import identity [as 别名]
def setup():
def f(x):
return 2 * x
def g(x):
return x / 2.0
x = CoordinateSystem("x", "x")
E.a = CoordinateMap(x, x, f)
E.b = CoordinateMap(x, x, f, inverse_function=g)
E.c = CoordinateMap(x, x, g)
E.d = CoordinateMap(x, x, g, inverse_function=f)
E.e = AffineTransform.identity("ijk")
A = np.identity(4)
A[0:3] = np.random.standard_normal((3, 4))
E.mapping = AffineTransform.from_params("ijk", "xyz", A)
E.singular = AffineTransform.from_params(
"ijk", "xyzt", np.array([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [8, 9, 10, 11], [0, 0, 0, 1]])
)
示例3: test_bounding_box
# 需要导入模块: from nipy.core.reference.coordinate_map import AffineTransform [as 别名]
# 或者: from nipy.core.reference.coordinate_map.AffineTransform import identity [as 别名]
def test_bounding_box():
shape = (10, 14, 16)
coordmap = AffineTransform.identity(names)
yield assert_equal(
bounding_box(coordmap, shape),
((0., 9.), (0, 13), (0, 15)))
示例4: test_bounding_box
# 需要导入模块: from nipy.core.reference.coordinate_map import AffineTransform [as 别名]
# 或者: from nipy.core.reference.coordinate_map.AffineTransform import identity [as 别名]
def test_bounding_box(self):
shape = (10, 14, 16)
coordmap = AffineTransform.identity(names)
#print coordmap.affine.dtype, 'affine'
self.assertEqual(bounding_box(coordmap, shape), ([0., 9.], [0, 13], [0, 15]))