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


Python BlitzGateway.createImageFromNumpySeq方法代码示例

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


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

示例1: array

# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import createImageFromNumpySeq [as 别名]
# hard-coded array of data.
from numpy import array
sizeX, sizeY, sizeZ, sizeC, sizeT = 5, 4, 1, 2, 1
plane1 = array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9]])
plane2 = array([[5, 6, 7, 8, 9], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [0, 1, 2, 3, 4]])
planes = [plane1, plane2]


def planeGen():
    """generator will yield planes"""
    for p in planes:
        yield p


desc = "Image created from a hard-coded arrays"
i = conn.createImageFromNumpySeq(planeGen(), "numpy image",\
        sizeZ, sizeC, sizeT, description=desc, dataset=None)


# Create an Image from an existing image
# =================================================================
# We are going to create a new image by passing the method a 'generator' of 2D
# planes This will come from an existing image, by taking the average of 2 channels.
zctList = []
image = conn.getObject('Image', imageId)
sizeZ, sizeC, sizeT = image.getSizeZ(), image.getSizeC(), image.getSizeT()
dataset = image.getParent()
pixels = image.getPrimaryPixels()
newSizeC = 1


def planeGen():
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: planeGen

# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import createImageFromNumpySeq [as 别名]

def planeGen():
    """set up a generator of 2D numpy arrays."""
    for z in range(sizeZ):          # all Z sections
        for c in range(sizeC):
            for t in range(sizeT):      # all time-points
                print "Plane: ", z, c, t
                if c == replaceChannel:
                    yield pixels2.getPlane(z, c, t)
                else:
                    yield pixels.getPlane(z, c, t)


desc = "Image created from Image ID: %s, replacing Channel %s from Image ID: %s" % (imageId, replaceChannel, imageId2)
newImg = conn.createImageFromNumpySeq(planeGen(), "ImageFromTwo", \
        sizeZ, sizeC, sizeT, description=desc, dataset=dataset)


# Get original channel names and colors to apply to new image
# =================================================================
cNames = []
colors = []
for ch in image.getChannels():
    cNames.append(ch.getLabel())
    colors.append(ch.getColor().getRGB())


# Save channel names and colors
# =================================================================
print "Applying channel Names:", cNames, " Colors:", colors
for i, c in enumerate(newImg.getChannels()):
开发者ID:DirkHaehnel,项目名称:openmicroscopy,代码行数:33,代码来源:Create_Image_advanced.py


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