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


Python ImageI.setAcquisitionDate方法代码示例

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


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

示例1: testWrappers

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def testWrappers(self):
        image = ImageI()
        info = image._field_info

        assert info.name.wrapper == rstring
        assert info.acquisitionDate.wrapper == rtime

        assert not info.name.nullable
        assert not info.acquisitionDate.nullable

        image.setAcquisitionDate("1", wrap=True)
        assert type(image.acquisitionDate) == type(rtime(0))

        # The following causes pytest to fail!
        # image.setAcquisitionDate("", wrap=True)

        # Note: collections still don't work well
        if False:
            image.addPixels(PixelsI())
            image.setPixels(0, "Pixels:1", wrap=True)
            assert type(image.pixels) == omero.model.PixelsI

            image.setPixels(0, "Pixels", wrap=True)
            image.setPixels(0, "Unknown", wrap=True)

        link = DatasetImageLinkI()
        link.setParent("Dataset:1")
        link.setChild("Image:1")
开发者ID:sbesson,项目名称:openmicroscopy,代码行数:30,代码来源:test_model.py

示例2: testCreateAfterBlitzPort

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
 def testCreateAfterBlitzPort(self):
     ipojo = self.client.sf.getContainerService()
     i = ImageI()
     i.setName(rstring("name"))
     i.setAcquisitionDate(rtime(0))
     i = ipojo.createDataObject(i,None)
     o = i.getDetails().owner
     self.assertEquals( -1, o.sizeOfGroupExperimenterMap() )
开发者ID:DirkHaehnel,项目名称:openmicroscopy,代码行数:10,代码来源:icontainer.py

示例3: test1184

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def test1184(self):
        uuid = self.uuid()
        client = self.new_client(perms="rw----")

        share = client.sf.getShareService()
        query = client.sf.getQueryService()
        update = client.sf.getUpdateService()
        admin = client.sf.getAdminService()
        cont = client.sf.getContainerService()

        ds = DatasetI()
        ds.setName(rstring('test1184-ds-%s' % (uuid)))

        for i in range(1,2001):
            img = ImageI()
            img.setName(rstring('img1184-%s' % (uuid)))
            img.setAcquisitionDate(rtime(time.time()))
            # Saving in one go
            #dil = DatasetImageLinkI()
            #dil.setParent(ds)
            #dil.setChild(img)
            #update.saveObject(dil)
            ds.linkImage(img)
        ds = update.saveAndReturnObject(ds)

        c = cont.getCollectionCount(ds.__class__.__name__, ("imageLinks"), [ds.id.val], None)
        assert c[ds.id.val] == 2000

        page = 1
        p = omero.sys.Parameters()
        p.map = {}
        p.map["eid"] = rlong(admin.getEventContext().userId)
        p.map["oid"] = rlong(ds.id.val)
        if page is not None:
            f = omero.sys.Filter()
            f.limit = rint(24)
            f.offset = rint((int(page)-1)*24)
            p.theFilter = f

        sql = "select im from Image im join fetch im.details.owner join fetch im.details.group " \
              "left outer join fetch im.datasetLinks dil left outer join fetch dil.parent d " \
              "where d.id = :oid and im.details.owner.id=:eid order by im.id asc"

        start = time.time()
        res = query.findAllByQuery(sql,p)
        assert 24 ==  len(res)
        end = time.time()
        elapsed = end - start
        assert elapsed < 3.0,\
            "Expected the test to complete in < 3 seconds, took: %f" % elapsed
开发者ID:bramalingam,项目名称:openmicroscopy,代码行数:52,代码来源:test_tickets2000.py

示例4: test2327

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def test2327(self):

        ### create two users in two groups
        client_share1, user1 = self.new_client_and_user()
        client_share2, user2 = self.new_client_and_user()

        ## login as user1
        share1 = client_share1.sf.getShareService()
        update1 = client_share1.sf.getUpdateService()

        # create image
        img = ImageI()
        img.setName(rstring('test2327'))
        img.setAcquisitionDate(rtime(0))
        img = update1.saveAndReturnObject(img)
        img.unload()

        # create share
        description = "my description"
        timeout = None
        objects = [img]
        experimenters = [user2]
        guests = []
        enabled = True
        sid = share1.createShare(description, timeout, objects, experimenters, guests, enabled)
        self.assert_(len(share1.getContents(sid)) == 1)
        # add comment by the owner
        share1.addComment(sid, 'test comment by the owner %s' % user1.id.val)

        ## login as user2
        share2 = client_share2.sf.getShareService()
        query2 = client_share2.sf.getQueryService()

        l = share2.getMemberShares(False)
        self.assertEquals(1, len(l))

        # add comment by the member
        share2.addComment(sid, 'test comment by the member %s' % (user2.id.val))

        # Don't have to activate share2

        #get comments
        # by user1
        c1 = len(share1.getComments(sid))
        self.assertEquals(2, c1)
        # by user2
        c2 = len(share2.getComments(sid))
        self.assertEquals(2, c2)
开发者ID:hflynn,项目名称:openmicroscopy,代码行数:50,代码来源:ishare.py

示例5: test1154

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def test1154(self):
        uuid = self.root.sf.getAdminService().getEventContext().sessionUuid

        
        ### create two users in one group
        client_share1, user1 = self.new_client_and_user()
        client_share2, user2 = self.new_client_and_user()

        ## login as user1
        share1 = client_share1.sf.getShareService()
        update1 = client_share1.sf.getUpdateService()
        
        # create image
        img = ImageI()
        img.setName(rstring('test1154-img-%s' % (uuid)))
        img.setAcquisitionDate(rtime(0))
        img = update1.saveAndReturnObject(img)
        img.unload()
        
        # create share
        description = "my description"
        timeout = None
        objects = [img]
        experimenters = [user2]
        guests = []
        enabled = True
        sid = share1.createShare(description, timeout, objects,experimenters, guests, enabled)
        
        self.assertEquals(1,len(share1.getContents(sid)))
        
        ## login as user2
        share2 = client_share2.sf.getShareService()
        query2 = client_share2.sf.getQueryService()
        
        content = share2.getContents(sid)
        self.assertEquals(1,len(share2.getContents(sid)))
        
        # get shared image when share is activated
        share2.activate(sid)

        p = omero.sys.Parameters()
        p.map = {}
        p.map["ids"] = rlist([rlong(img.id.val)])
        sql = "select im from Image im where im.id in (:ids) order by im.name"
        res = query2.findAllByQuery(sql, p)
        self.assertEquals(1,len(res))
        for e in res:
            self.assert_(e.id.val == img.id.val)
开发者ID:hflynn,项目名称:openmicroscopy,代码行数:50,代码来源:ishare.py

示例6: test1157

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def test1157(self):
        uuid = self.root.sf.getAdminService().getEventContext().sessionUuid
        share = self.root.sf.getShareService()
        
        ### create two users in one group
        client_share1, user1 = self.new_client_and_user()
        client_share2, user2 = self.new_client_and_user()
        
        ## login as user1 
        share1 = client_share1.sf.getShareService()
        update1 = client_share1.sf.getUpdateService()
        
        # create image
        img = ImageI()
        img.setName(rstring('test1154-img-%s' % (uuid)))
        img.setAcquisitionDate(rtime(0))
        img = update1.saveAndReturnObject(img)
        img.unload()
        
        # create share
        description = "my description"
        timeout = None
        objects = [img]
        experimenters = [user2]
        guests = []
        enabled = True
        sid = share1.createShare(description, timeout, objects,experimenters, guests, enabled)
        self.assert_(len(share1.getContents(sid)) == 1)
        # add comment by the owner
        share.addComment(sid, 'test comment by the owner %s' % (uuid))
        
        ## login as user2
        share2 = client_share2.sf.getShareService()
        query2 = client_share2.sf.getQueryService()
        
        # add comment by the member
        share2.addComment(sid, 'test comment by the member %s' % (uuid))

        # Don't have to activate share2

        #get comments
        # by user1
        c1 = len(share.getComments(sid))
        self.assertEquals(2,c1)
        # by user2
        c2 = len(share2.getComments(sid))
        self.assertEquals(2,c2)
开发者ID:hflynn,项目名称:openmicroscopy,代码行数:49,代码来源:ishare.py

示例7: test2327

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def test2327(self):
        # create two users in two groups
        client_share1, user1 = self.new_client_and_user()
        client_share2, user2 = self.new_client_and_user()

        # login as user1
        share1 = client_share1.sf.getShareService()
        update1 = client_share1.sf.getUpdateService()

        # create image
        img = ImageI()
        img.setName(rstring("test2327"))
        img.setAcquisitionDate(rtime(0))
        img = update1.saveAndReturnObject(img)
        img.unload()

        # create share
        description = "my description"
        timeout = None
        objects = [img]
        experimenters = [user2]
        guests = []
        enabled = True
        sid = share1.createShare(description, timeout, objects, experimenters, guests, enabled)
        assert len(share1.getContents(sid)) == 1
        # add comment by the owner
        share1.addComment(sid, "test comment by the owner %s" % user1.id.val)

        # login as user2
        share2 = client_share2.sf.getShareService()
        l = share2.getMemberShares(False)
        assert 1 == len(l)

        # add comment by the member
        share2.addComment(sid, "test comment by the member %s" % user2.id.val)

        # get comments
        # by user1
        c1 = len(share1.getComments(sid))
        assert 2 == c1
        # by user2
        c2 = len(share2.getComments(sid))
        assert 2 == c2
开发者ID:sbesson,项目名称:openmicroscopy,代码行数:45,代码来源:test_ishare.py

示例8: test1163

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def test1163(self):
        uuid = self.uuid()
        new_gr1 = self.new_group(perms="rw----")
        client_share1, new_exp_obj = self.new_client_and_user(new_gr1)
        update1 = client_share1.sf.getUpdateService()
        search1 = client_share1.sf.createSearchService()

        # create image and index
        img = ImageI()
        img.setName(rstring('test1154-img-%s' % (uuid)))
        img.setAcquisitionDate(rtime(0))
        img = update1.saveAndReturnObject(img)
        img.unload()
        self.index(img)

        # search
        search1.onlyType('Image')
        search1.addOrderByAsc("name")
        search1.byFullText("test*")
        assert search1.hasNext()
        res = search1.results()
        assert 1 ==  len(res)
开发者ID:bramalingam,项目名称:openmicroscopy,代码行数:24,代码来源:test_tickets2000.py

示例9: test8118

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
 def test8118(self):
     uuid = self.root.sf.getAdminService().getEventContext().sessionUuid
     share_serv = self.root.sf.getShareService()
     update_serv = self.root.sf.getUpdateService()
     
     # create user
     user1 = self.new_user()
     
     # create image
     img = ImageI()
     img.setName(rstring('test8118-img-%s' % (uuid)))
     img.setAcquisitionDate(rtime(0))
     img = update_serv.saveAndReturnObject(img)
     img.unload()
     
     # create share
     description = "my description"
     timeout = None
     objects = [img]
     experimenters = [user1]
     guests = []
     enabled = True
     sid = share_serv.createShare(description, timeout, objects,experimenters, guests, enabled)
     suuid = share_serv.getShare(sid).uuid
     
     self.assertEquals(1,len(share_serv.getContents(sid)))
     
     # join share
     user1_client = omero.client()
     try:
         user1_client.createSession(suuid,suuid)
         user1_share = user1_client.sf.getShareService()
         user1_share.activate(sid)
         self.assertEquals(1, len(user1_share.getContents(sid)))
     finally:
         user1_client.__del__()
开发者ID:hflynn,项目名称:openmicroscopy,代码行数:38,代码来源:ishare.py

示例10: test1172

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def test1172(self):
        uuid = self.root.sf.getAdminService().getEventContext().sessionUuid
        share = self.root.sf.getShareService()
        query = self.root.sf.getQueryService()
        update = self.root.sf.getUpdateService()
        
        ### create user
        client_share1, user1 = self.new_client_and_user()
        
        #create dataset with image
        #dataset with image
        ds = omero.model.DatasetI()
        ds.setName(rstring("dataset-%s" % (uuid)))
        ds = update.saveAndReturnObject(ds)
        ds.unload()
        
        # create image
        img = ImageI()
        img.setName(rstring('test-img in dataset-%s' % (uuid)))
        img.setAcquisitionDate(rtime(0))
        img = update.saveAndReturnObject(img)
        img.unload()
        
        dil = DatasetImageLinkI()
        dil.setParent(ds)
        dil.setChild(img)
        dil = update.saveAndReturnObject(dil)
        dil.unload()
        
        # create share by root
        items = list()
        ms = list()
        
        p = omero.sys.Parameters()
        p.map = {}
        p.map["oid"] = ds.id
        sql = "select ds from Dataset ds join fetch ds.details.owner join fetch ds.details.group " \
              "left outer join fetch ds.imageLinks dil left outer join fetch dil.child i " \
              "where ds.id=:oid"
        items.extend(query.findAllByQuery(sql, p))
        self.assertEquals(1, len(items))
        
        #members
        p.map["eid"] = rlong(user1.id.val)
        sql = "select e from Experimenter e where e.id =:eid order by e.omeName"
        ms = query.findAllByQuery(sql, p)
        sid = share.createShare(("test-share-%s" % uuid), rtime(long(time.time()*1000 + 86400)) , items, ms, [], True)
        
        # USER RETRIEVAL
        ## login as user1
        share1 = client_share1.sf.getShareService()
        query1 = client_share1.sf.getQueryService()
        cntar1 = client_share1.sf.getContainerService()
        
        content = share1.getContents(sid)
        # Content now contains just the dataset with nothing loaded
        self.assertEquals(1, len(content))

        # get shared dataset and image when share is activated
        share1.activate(sid)

        #retrieve dataset
        p = omero.sys.Parameters()
        p.map = {}
        p.map["ids"] = rlist([ds.id])
        sql = "select ds from Dataset ds join fetch ds.details.owner join fetch ds.details.group " \
              "left outer join fetch ds.imageLinks dil left outer join fetch dil.child i " \
              "where ds.id in (:ids) order by ds.name"
        try:
            res1 = query1.findAllByQuery(sql, p)
            self.fail("This should throw an exception")
        except:
            pass

        #
        # Now we add all the other elements to the share to prevent
        # the security violation
        #
        # Not working imgs = cntar.getImages("Dataset",[ds.id.val], None)
        img = query.findByQuery("select i from Image i join fetch i.datasetLinks dil join dil.parent d where d.id = %s " % ds.id.val, None)
        self.assert_(img)
        share.addObject(sid, img)
        share.addObjects(sid, img.copyDatasetLinks())
        self.assertEquals(3, len(share.getContents(sid)))

        #
        # And try again to load them
        #
        share1.activate(sid)
        res1 = query1.findAllByQuery(sql, p)
        self.assert_(len(res1) == 1)
        for e in res1:
            self.assert_(e.id.val == ds.id.val)

        # retrieve only image
        p = omero.sys.Parameters()
        p.map = {}
        p.map["oid"] = rlong(img.id)
        sql = "select im from Image im " \
              "where im.id=:oid order by im.name"
#.........这里部分代码省略.........
开发者ID:hflynn,项目名称:openmicroscopy,代码行数:103,代码来源:ishare.py

示例11: testFindAndCountAnnotationsForSharedData

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
    def testFindAndCountAnnotationsForSharedData(self):
        uuid = self.root.sf.getAdminService().getEventContext().sessionUuid
        query = self.root.sf.getQueryService()
        update = self.root.sf.getUpdateService()
        admin = self.root.sf.getAdminService()
        ipojo = self.root.sf.getContainerService()
        
        ### create new users
        #group1
        new_gr1 = ExperimenterGroupI()
        new_gr1.name = rstring("group1_%s" % uuid)
        gid = admin.createGroup(new_gr1)
        
        #new user1
        new_exp = ExperimenterI()
        new_exp.omeName = rstring("user1_%s" % uuid)
        new_exp.firstName = rstring("New")
        new_exp.lastName = rstring("Test")
        
        defaultGroup = admin.getGroup(gid)
        listOfGroups = list()
        listOfGroups.append(admin.lookupGroup("user"))
        
        eid = admin.createExperimenterWithPassword(new_exp, rstring("ome"), defaultGroup, listOfGroups)
        
        #new user2
        new_exp2 = ExperimenterI()
        new_exp2.omeName = rstring("user2_%s" % uuid)
        new_exp2.firstName = rstring("New2")
        new_exp2.lastName = rstring("Test2")
        
        defaultGroup = admin.getGroup(gid)
        listOfGroups = list()
        listOfGroups.append(admin.lookupGroup("user"))
        
        eid2 = admin.createExperimenterWithPassword(new_exp2, rstring("ome"), defaultGroup, listOfGroups)
    
        ## get users
        user1 = admin.getExperimenter(eid)
        user2 = admin.getExperimenter(eid2)
        
        ## login as user1
        cl1 = self.new_client(user=user1, password="ome")
        update1 = cl1.sf.getUpdateService()
        ipojo1 = cl1.sf.getContainerService()
        
        # create image
        img = ImageI()
        img.setName(rstring('test1154-img-%s' % (uuid)))
        img.setAcquisitionDate(rtime(0))

        # default permission 'rw----':
        img = update1.saveAndReturnObject(img)
        img.unload()

        ann1 = CommentAnnotationI()
        ann1.textValue = rstring("user comment - %s" % uuid)
        l_ann1 = ImageAnnotationLinkI()
        l_ann1.setParent(img)
        l_ann1.setChild(ann1)
        update1.saveObject(l_ann1)

        #user retrives the annotations for image
        coll_count = ipojo1.getCollectionCount("Image", "ome.model.containers.Image_annotationLinks", [img.id.val], None)
        self.assertEquals(1, coll_count.get(img.id.val, []))
        #self.assertEquals(1, len(ipojo1.findAnnotations("Image", [img.id.val], None, None).get(img.id.val, [])))

        ## login as user2
        cl2 = self.new_client(user=user2, password="ome")
        update2 = cl1.sf.getUpdateService()
        
        ann = CommentAnnotationI()
        ann.textValue = rstring("user2 comment - %s" % uuid)
        l_ann = ImageAnnotationLinkI()
        l_ann.setParent(img)
        l_ann.setChild(ann)
        update2.saveObject(l_ann)
        
        #do they see the same vals?
        #print ipojo1.getCollectionCount("Image", "ome.model.containers.Image_annotationLinks", [img.id.val], None)
        #print ipojo.getCollectionCount("Image", "ome.model.containers.Image_annotationLinks", [img.id.val], None)
        #print len(ipojo1.findAnnotations("Image", [img.id.val], None, None).get(img.id.val, []))
        #print len(ipojo.findAnnotations("Image", [img.id.val], None, None).get(img.id.val, []))
        coll_count = ipojo1.getCollectionCount("Image", "ome.model.containers.Image_annotationLinks", [img.id.val], None)
        self.assertEquals(2, coll_count.get(img.id.val, []))
        #anns = ipojo1.findAnnotations("Image", [img.id.val], None, None).get(img.id.val, [])
        #self.assertEquals(2, len(anns))
        
        #self.assert_(anns[0].details.permissions == 'rw----')
        #self.assert_(anns[1].details.permissions == 'rw----')
        
        cl1.sf.closeOnDestroy()
        cl2.sf.closeOnDestroy()
开发者ID:DirkHaehnel,项目名称:openmicroscopy,代码行数:95,代码来源:icontainer.py

示例12: testFindAnnotations

# 需要导入模块: from omero_model_ImageI import ImageI [as 别名]
# 或者: from omero_model_ImageI.ImageI import setAcquisitionDate [as 别名]
 def testFindAnnotations(self):
     ipojo = self.client.sf.getContainerService()
     i = ImageI()
     i.setName(rstring("name"))
     i.setAcquisitionDate(rtime(0))
     i = ipojo.createDataObject(i,None)
开发者ID:DirkHaehnel,项目名称:openmicroscopy,代码行数:8,代码来源:icontainer.py


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