def plate_wells_with_no_acq_date(itest, well_grid_factory, update_service,
                                 conn):
    """
    Creates a plate with a single well containing an image with no acquisition
    date set. Returns the plate and the time from the creation event in a map.
    """
    plate = PlateI()
    plate.name = rstring(itest.uuid())
    # Simple grid: one well with one image
    [well] = well_grid_factory({(0, 0): 1})
    plate.addWell(well)
    well.copyWellSamples()[0].image.acquisitionDate = None
    plate = update_service.saveAndReturnObject(plate)
    image = plate.copyWells()[0].copyWellSamples()[0].image
    creation_date = image.details.creationEvent.time
    return {'plate': plate, 'creation_date': creation_date.val / 1000}
def plate_wells_with_no_acq_date(itest, well_grid_factory, update_service,
                                 conn):
    """
    Creates a plate with a single well containing an image with no acquisition
    date set. Returns the plate and the time from the creation event in a map.
    """
    plate = PlateI()
    plate.name = rstring(itest.uuid())
    # Simple grid: one well with one image
    [well] = well_grid_factory({(0, 0): 1})
    plate.addWell(well)
    well.copyWellSamples()[0].image.acquisitionDate = None
    plate = update_service.saveAndReturnObject(plate)
    image = plate.copyWells()[0].copyWellSamples()[0].image
    creation_date = image.details.creationEvent.time
    return {'plate': plate,
            'creation_date': creation_date.val / 1000}
示例#3
0
    def testListParentsSPW(self):
        """Test listParents() for Image in WellSample"""

        client, exp = self.new_client_and_user()
        conn = BlitzGateway(client_obj=client)

        # setup SPW-WS-Img...
        s = ScreenI()
        s.name = wrap('ScreenA')
        p = PlateI()
        p.name = wrap('PlateA')
        s.linkPlate(p)
        w = WellI()
        w.column = wrap(0)
        w.row = wrap(0)
        p.addWell(w)
        s = client.sf.getUpdateService().saveAndReturnObject(s)
        p = s.linkedPlateList()[0]
        w = p.copyWells()[0]
        i = self.make_image(name="SPW listParents", client=client)
        ws = WellSampleI()
        ws.image = i
        ws.well = WellI(w.id.val, False)
        w.addWellSample(ws)
        ws = client.sf.getUpdateService().saveAndReturnObject(ws)

        # Traverse from Image -> Screen
        image = conn.getObject("Image", i.id.val)
        wellSample = image.listParents()[0]

        well = wellSample.listParents()[0]
        assert well.id == w.id.val

        plate = well.listParents()[0]
        assert plate.id == p.id.val

        screen = plate.listParents()[0]
        assert screen.id == s.id.val
        # Screen has no parent
        assert len(screen.listParents()) == 0
示例#4
0
def plate_well_table(itest, well_grid_factory, update_service, conn):
    """
    Returns a new OMERO Plate, linked Wells, linked WellSamples, and linked
    Images populated by an L{omeroweb.testlib.IWebTest} instance.
    """
    plate = PlateI()
    plate.name = rstring(itest.uuid())
    # Well A1 has one WellSample
    plate.addWell(well_grid_factory({(0, 0): 1})[0])
    plate = update_service.saveAndReturnObject(plate)

    col1 = WellColumn('Well', '', [])
    col2 = StringColumn('TestColumn', '', 64, [])

    columns = [col1, col2]
    tablename = "plate_well_table_test:%s" % str(random())
    table = conn.c.sf.sharedResources().newTable(1, tablename)
    table.initialize(columns)

    wellIds = [w.id.val for w in plate.copyWells()]
    print("WellIds", wellIds)

    data1 = WellColumn('Well', '', wellIds)
    data2 = StringColumn('TestColumn', '', 64, ["foobar"])
    data = [data1, data2]
    table.addData(data)

    orig_file = table.getOriginalFile()
    table.close()

    fileAnn = FileAnnotationI()
    fileAnn.ns = rstring('openmicroscopy.org/omero/bulk_annotations')
    fileAnn.setFile(OriginalFileI(orig_file.id.val, False))
    fileAnn = conn.getUpdateService().saveAndReturnObject(fileAnn)
    link = PlateAnnotationLinkI()
    link.setParent(PlateI(plate.id.val, False))
    link.setChild(FileAnnotationI(fileAnn.id.val, False))
    update_service.saveAndReturnObject(link)
    return plate, wellIds
def plate_well_table(itest, well_grid_factory, update_service, conn):
    """
    Returns a new OMERO Plate, linked Wells, linked WellSamples, and linked
    Images populated by an L{weblibrary.IWebTest} instance.
    """
    plate = PlateI()
    plate.name = rstring(itest.uuid())
    # Well A1 has one WellSample
    plate.addWell(well_grid_factory({(0, 0): 1})[0])
    plate = update_service.saveAndReturnObject(plate)

    col1 = WellColumn('Well', '', [])
    col2 = StringColumn('TestColumn', '', 64, [])

    columns = [col1, col2]
    tablename = "plate_well_table_test:%s" % str(random())
    table = conn.c.sf.sharedResources().newTable(1, tablename)
    table.initialize(columns)

    wellIds = [w.id.val for w in plate.copyWells()]
    print "WellIds", wellIds

    data1 = WellColumn('Well', '', wellIds)
    data2 = StringColumn('TestColumn', '', 64, ["foobar"])
    data = [data1, data2]
    table.addData(data)
    table.close()

    orig_file = table.getOriginalFile()
    fileAnn = FileAnnotationI()
    fileAnn.ns = rstring('openmicroscopy.org/omero/bulk_annotations')
    fileAnn.setFile(OriginalFileI(orig_file.id.val, False))
    fileAnn = conn.getUpdateService().saveAndReturnObject(fileAnn)
    link = PlateAnnotationLinkI()
    link.setParent(PlateI(plate.id.val, False))
    link.setChild(FileAnnotationI(fileAnn.id.val, False))
    update_service.saveAndReturnObject(link)
    return plate, wellIds