当前位置: 首页>>代码示例>>Python>>正文


Python ImagesLoader.first方法代码示例

本文整理汇总了Python中thunder.rdds.fileio.imagesloader.ImagesLoader.first方法的典型用法代码示例。如果您正苦于以下问题:Python ImagesLoader.first方法的具体用法?Python ImagesLoader.first怎么用?Python ImagesLoader.first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thunder.rdds.fileio.imagesloader.ImagesLoader的用法示例。


在下文中一共展示了ImagesLoader.first方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_fromTif

# 需要导入模块: from thunder.rdds.fileio.imagesloader import ImagesLoader [as 别名]
# 或者: from thunder.rdds.fileio.imagesloader.ImagesLoader import first [as 别名]
 def test_fromTif(self):
     imagepath = os.path.join(self.testresourcesdir, "singlelayer_tif", "dot1_lzw.tif")
     tifimage = ImagesLoader(self.sc).fromTif(imagepath, self.sc)
     firsttifimage = tifimage.first()
     assert_equals(0, firsttifimage[0], "Key error; expected first image key to be 0, was "+str(firsttifimage[0]))
     expectedshape = (70, 75, 4)  # 4 channel tif; RGBalpha
     assert_true(isinstance(firsttifimage[1], ndarray),
                 "Value type error; expected first image value to be numpy ndarray, was " +
                 str(type(firsttifimage[1])))
     assert_equals(expectedshape, firsttifimage[1].shape)
     assert_equals(248, firsttifimage[1][:, :, 0].flatten().max())
     assert_equals(8, firsttifimage[1][:, :, 0].flatten().min())
开发者ID:brokendata,项目名称:thunder,代码行数:14,代码来源:test_imagesloader.py

示例2: test_fromPng

# 需要导入模块: from thunder.rdds.fileio.imagesloader import ImagesLoader [as 别名]
# 或者: from thunder.rdds.fileio.imagesloader.ImagesLoader import first [as 别名]
 def test_fromPng(self):
     imagepath = os.path.join(self.testresourcesdir, "singlelayer_png", "dot1.png")
     pngimage = ImagesLoader(self.sc).fromPng(imagepath, self.sc)
     firstpngimage = pngimage.first()
     assert_equals(0, firstpngimage[0], "Key error; expected first image key to be 0, was "+str(firstpngimage[0]))
     expectedshape = (70, 75, 4)  # 4 channel png; RGBalpha
     assert_true(isinstance(firstpngimage[1], ndarray),
                 "Value type error; expected first image value to be numpy ndarray, was " +
                 str(type(firstpngimage[1])))
     assert_equals(expectedshape, firstpngimage[1].shape)
     assert_almost_equal(0.97, firstpngimage[1][:, :, 0].flatten().max(), places=2)
     assert_almost_equal(0.03, firstpngimage[1][:, :, 0].flatten().min(), places=2)
开发者ID:brokendata,项目名称:thunder,代码行数:14,代码来源:test_imagesloader.py

示例3: test_fromTif

# 需要导入模块: from thunder.rdds.fileio.imagesloader import ImagesLoader [as 别名]
# 或者: from thunder.rdds.fileio.imagesloader.ImagesLoader import first [as 别名]
 def test_fromTif(self):
     imagePath = os.path.join(self.testResourcesDir, "singlelayer_tif", "dot1_grey_lzw.tif")
     tiffImage = ImagesLoader(self.sc).fromTif(imagePath)
     firstTiffImage = tiffImage.first()
     assert_equals(0, firstTiffImage[0], "Key error; expected first image key to be 0, was "+str(firstTiffImage[0]))
     expectedShape = (70, 75)
     assert_true(isinstance(firstTiffImage[1], ndarray),
                 "Value type error; expected first image value to be numpy ndarray, was " +
                 str(type(firstTiffImage[1])))
     assert_equals(expectedShape, firstTiffImage[1].shape)
     assert_equals(expectedShape, tiffImage.dims.count)
     assert_equals(239, firstTiffImage[1].ravel().max())
     assert_equals(1, firstTiffImage[1].ravel().min())
开发者ID:nerduno,项目名称:thunder,代码行数:15,代码来源:test_imagesloader.py

示例4: test_fromPng

# 需要导入模块: from thunder.rdds.fileio.imagesloader import ImagesLoader [as 别名]
# 或者: from thunder.rdds.fileio.imagesloader.ImagesLoader import first [as 别名]
 def test_fromPng(self):
     imagePath = os.path.join(self.testResourcesDir, "singlelayer_png", "dot1_grey.png")
     pngImage = ImagesLoader(self.sc).fromPng(imagePath)
     firstPngImage = pngImage.first()
     assert_equals(0, firstPngImage[0], "Key error; expected first image key to be 0, was "+str(firstPngImage[0]))
     expectedShape = (70, 75)
     assert_true(isinstance(firstPngImage[1], ndarray),
                 "Value type error; expected first image value to be numpy ndarray, was " +
                 str(type(firstPngImage[1])))
     assert_equals(expectedShape, firstPngImage[1].shape)
     assert_equals(expectedShape, pngImage.dims.count)
     assert_almost_equal(0.937, firstPngImage[1].ravel().max(), places=2)  # integer val 239
     assert_almost_equal(0.00392, firstPngImage[1].ravel().min(), places=2)  # integer val 1
开发者ID:nerduno,项目名称:thunder,代码行数:15,代码来源:test_imagesloader.py

示例5: roundTrip

# 需要导入模块: from thunder.rdds.fileio.imagesloader import ImagesLoader [as 别名]
# 或者: from thunder.rdds.fileio.imagesloader.ImagesLoader import first [as 别名]
 def roundTrip(images, dtype):
     outdir = os.path.join(self.outputdir, "binary-images-" + dtype)
     images.astype(dtype).saveAsBinaryImages(outdir)
     newimages = ImagesLoader(self.sc).fromStack(outdir, ext="bin")
     array_equal(images.first()[1], newimages.first()[1])
开发者ID:nerduno,项目名称:thunder,代码行数:7,代码来源:test_images.py


注:本文中的thunder.rdds.fileio.imagesloader.ImagesLoader.first方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。