本文整理汇总了Python中thunder.rdds.fileio.imagesloader.ImagesLoader.crop方法的典型用法代码示例。如果您正苦于以下问题:Python ImagesLoader.crop方法的具体用法?Python ImagesLoader.crop怎么用?Python ImagesLoader.crop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thunder.rdds.fileio.imagesloader.ImagesLoader
的用法示例。
在下文中一共展示了ImagesLoader.crop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_crop
# 需要导入模块: from thunder.rdds.fileio.imagesloader import ImagesLoader [as 别名]
# 或者: from thunder.rdds.fileio.imagesloader.ImagesLoader import crop [as 别名]
def test_crop(self):
dims = (2, 2, 4)
sz = reduce(lambda x, y: x*y, dims)
origAry = arange(sz, dtype='int16').reshape(dims)
imageData = ImagesLoader(self.sc).fromArrays([origAry])
croppedData = imageData.crop((0, 0, 0), (2, 2, 2))
crop = croppedData.collect()[0][1]
expected = squeeze(origAry[slice(0, 2), slice(0, 2), slice(0, 2)])
assert_true(array_equal(expected, crop))
assert_equals(tuple(expected.shape), croppedData._dims.count)
assert_equals(str(expected.dtype), croppedData._dtype)
示例2: _run_tst_crop
# 需要导入模块: from thunder.rdds.fileio.imagesloader import ImagesLoader [as 别名]
# 或者: from thunder.rdds.fileio.imagesloader.ImagesLoader import crop [as 别名]
def _run_tst_crop(self, minBounds, maxBounds):
dims = (2, 2, 4)
sz = reduce(lambda x, y: x * y, dims)
origAry = arange(sz, dtype=dtypeFunc("int16")).reshape(dims)
imageData = ImagesLoader(self.sc).fromArrays([origAry])
croppedData = imageData.crop(minBounds, maxBounds)
crop = croppedData.collect()[0][1]
slices = []
for minb, maxb in zip(minBounds, maxBounds):
# skip the bounds-checking that we do in actual function; assume minb is <= maxb
if minb < maxb:
slices.append(slice(minb, maxb))
else:
slices.append(minb)
expected = squeeze(origAry[slices])
assert_true(array_equal(expected, crop))
assert_equals(tuple(expected.shape), croppedData._dims.count)
assert_equals(str(expected.dtype), croppedData._dtype)