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


Python SeriesLoader.pack方法代码示例

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


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

示例1: _run_fromFishTif

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
 def _run_fromFishTif(self, blocksize="150M"):
     imagepath = TestSeriesLoader._findSourceTreeDir("utils/data/fish/tif-stack")
     series = SeriesLoader(self.sc).fromMultipageTif(imagepath, blockSize=blocksize)
     series_ary = series.pack()
     series_ary_xpose = series.pack(transpose=True)
     assert_equals((76, 87, 2), series.dims.count)
     assert_equals((20, 76, 87, 2), series_ary.shape)
     assert_equals((20, 2, 87, 76), series_ary_xpose.shape)
开发者ID:getBioinfo,项目名称:thunder,代码行数:10,代码来源:test_seriesloader.py

示例2: _run_fromFishTif

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
 def _run_fromFishTif(self, blocksize):
     imagepath = TestSeriesLoader._findSourceTreeDir("utils/data/fish/images")
     series = SeriesLoader(self.sc).fromTif(imagepath, blockSize=blocksize)
     assert_equals('float16', series._dtype)
     seriesAry = series.pack()
     seriesAry_xpose = series.pack(transpose=True)
     assert_equals('float16', str(seriesAry.dtype))
     assert_equals((76, 87, 2), series.dims.count)
     assert_equals((20, 76, 87, 2), seriesAry.shape)
     assert_equals((20, 2, 87, 76), seriesAry_xpose.shape)
开发者ID:MiguelPeralvo,项目名称:thunder,代码行数:12,代码来源:test_seriesloader.py

示例3: test_fromMultipleArrays

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
    def test_fromMultipleArrays(self):
        ary = arange(8, dtype=dtype('int16')).reshape((2, 4))
        ary2 = arange(8, 16, dtype=dtype('int16')).reshape((2, 4))

        series = SeriesLoader(self.sc).fromArrays([ary, ary2])

        seriesvals = series.collect()
        seriesary = series.pack()

        # check ordering of keys
        assert_equals((0, 0), seriesvals[0][0])  # first key
        assert_equals((1, 0), seriesvals[1][0])  # second key
        assert_equals((3, 0), seriesvals[3][0])
        assert_equals((0, 1), seriesvals[4][0])
        assert_equals((3, 1), seriesvals[7][0])

        # check dimensions tuple is reversed from numpy shape
        assert_equals(ary.shape[::-1], series.dims.count)

        # check that values are in original order, with subsequent point concatenated in values
        collectedvals = array([kv[1] for kv in seriesvals], dtype=dtype('int16'))
        assert_true(array_equal(ary.ravel(), collectedvals[:, 0]))
        assert_true(array_equal(ary2.ravel(), collectedvals[:, 1]))

        # check that packing returns concatenation of input arrays, with time as first dimension
        assert_true(array_equal(ary.T, seriesary[0]))
        assert_true(array_equal(ary2.T, seriesary[1]))
开发者ID:mfcabrera,项目名称:thunder,代码行数:29,代码来源:test_seriesloader.py

示例4: test_fromArrays

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
    def test_fromArrays(self):
        ary = arange(8, dtype=dtype('int16')).reshape((2, 4))

        series = SeriesLoader(self.sc).fromArrays(ary)

        seriesvals = series.collect()
        seriesary = series.pack()

        # check ordering of keys
        assert_equals((0, 0), seriesvals[0][0])  # first key
        assert_equals((1, 0), seriesvals[1][0])  # second key
        assert_equals((2, 0), seriesvals[2][0])
        assert_equals((3, 0), seriesvals[3][0])
        assert_equals((0, 1), seriesvals[4][0])
        assert_equals((1, 1), seriesvals[5][0])
        assert_equals((2, 1), seriesvals[6][0])
        assert_equals((3, 1), seriesvals[7][0])

        # check dimensions tuple is reversed from numpy shape
        assert_equals(ary.shape[::-1], series.dims.count)

        # check that values are in original order
        collectedvals = array([kv[1] for kv in seriesvals], dtype=dtype('int16')).ravel()
        assert_true(array_equal(ary.ravel(), collectedvals))

        # check that packing returns transpose of original array
        assert_true(array_equal(ary.T, seriesary))
开发者ID:mfcabrera,项目名称:thunder,代码行数:29,代码来源:test_seriesloader.py

示例5: test_loadStacksAsSeries

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
    def test_loadStacksAsSeries(self):
        rangeary = arange(64*128, dtype=dtype('int16'))
        rangeary.shape = (64, 128)
        filepath = os.path.join(self.outputdir, "rangeary.stack")
        rangeary.tofile(filepath)

        series = SeriesLoader(self.sc).fromStack(filepath, dims=(128, 64))
        series_ary = series.pack()

        assert_equals((128, 64), series.dims.count)
        assert_equals((128, 64), series_ary.shape)
        assert_true(array_equal(rangeary.T, series_ary))
开发者ID:mfcabrera,项目名称:thunder,代码行数:14,代码来源:test_seriesloader.py

示例6: _run_tst_roundtripConvertToSeries

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
    def _run_tst_roundtripConvertToSeries(self, images, strategy):
        outdir = os.path.join(self.outputdir, "fish-series-dir")

        partitionedimages = images.toBlocks(strategy)
        series = partitionedimages.toSeries()
        series_ary = series.pack()

        partitionedimages.saveAsBinarySeries(outdir)
        converted_series = SeriesLoader(self.sc).fromBinary(outdir)
        converted_series_ary = converted_series.pack()

        assert_equals(images.dims.count, series.dims.count)
        expected_shape = tuple([images.nrecords] + list(images.dims.count))
        assert_equals(expected_shape, series_ary.shape)
        assert_true(array_equal(series_ary, converted_series_ary))
开发者ID:nerduno,项目名称:thunder,代码行数:17,代码来源:test_images.py

示例7: test_roundtripConvertToSeries

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
    def test_roundtripConvertToSeries(self):
        imagepath = TestImagesUsingOutputDir._findSourceTreeDir("utils/data/fish/tif-stack")
        outdir = os.path.join(self.outputdir, "fish-series-dir")

        images = ImagesLoader(self.sc).fromMultipageTif(imagepath)
        series = images.toSeries(blockSize=76*20)
        series_ary = series.pack()

        images.saveAsBinarySeries(outdir, blockSize=76*20)
        converted_series = SeriesLoader(self.sc).fromBinary(outdir)
        converted_series_ary = converted_series.pack()

        assert_equals((76, 87, 2), series.dims.count)
        assert_equals((20, 76, 87, 2), series_ary.shape)
        assert_true(array_equal(series_ary, converted_series_ary))
开发者ID:getBioinfo,项目名称:thunder,代码行数:17,代码来源:test_images.py

示例8: test_fromMultipageTif

# 需要导入模块: from thunder.rdds.fileio.seriesloader import SeriesLoader [as 别名]
# 或者: from thunder.rdds.fileio.seriesloader.SeriesLoader import pack [as 别名]
    def test_fromMultipageTif(self):
        testresourcesdir = TestSeriesLoader._findTestResourcesDir()
        imagepath = os.path.join(testresourcesdir, "multilayer_tif", "dotdotdot_lzw.tif")

        testimg_pil = Image.open(imagepath)
        testimg_arys = list()
        testimg_arys.append(pil_to_array(testimg_pil))
        testimg_pil.seek(1)
        testimg_arys.append(pil_to_array(testimg_pil))
        testimg_pil.seek(2)
        testimg_arys.append(pil_to_array(testimg_pil))

        series = SeriesLoader(self.sc).fromMultipageTif(imagepath)
        series_ary = series.pack()

        assert_equals((70, 75, 3), series.dims.count)
        assert_equals((70, 75, 3), series_ary.shape)
        assert_true(array_equal(testimg_arys[0], series_ary[:, :, 0]))
        assert_true(array_equal(testimg_arys[1], series_ary[:, :, 1]))
        assert_true(array_equal(testimg_arys[2], series_ary[:, :, 2]))
开发者ID:getBioinfo,项目名称:thunder,代码行数:22,代码来源:test_seriesloader.py


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