def list_datasets(conn): print "\nList Datasets:" print "=" * 50 params = ParametersI() params.exp(conn.getUser().getId()) datasets = conn.getObjects("Dataset", params=params) for dataset in datasets: print "+Dataset: %s(%s)" % (dataset.getName(), dataset.getId()) for image in dataset.listChildren(): print "|-Image: %s(%s)" % (image.getName(), image.getId())
def read_data(conn): imageId = 9 datasetId = 2 plateId = -1 print "\nList Projects:" print "=" * 50 my_expId = conn.getUser().getId() for project in conn.listProjects(my_expId): print_obj(project) for dataset in project.listChildren(): print_obj(dataset, 2) for image in dataset.listChildren(): print_obj(image, 4) print "\nList Datasets:" print "=" * 50 params = ParametersI() params.exp(conn.getUser().getId()) datasets = conn.getObjects("Dataset", params=params) for dataset in datasets: print_obj(dataset) print "\nDataset:%s" % datasetId print "=" * 50 dataset = conn.getObject("Dataset", datasetId) print "\nImages in Dataset:", dataset.getName() for image in dataset.listChildren(): print_obj(image) image = conn.getObject("Image", imageId) print "\nImage:%s" % imageId print "=" * 50 print image.getName(), image.getDescription() #Retrieve information about an image print "X:", image.getSizeX() print "Y:", image.getSizeY() print "Z:", image.getSizeZ() print "C:", image.getSizeC() print "T:", image.getSizeT() #render the first timepoint, mid Z section z = image.getSizeZ() / 2 t = 0 renderedImage = image.renderImage(z, t) #renderedImage.show() #popup (use for debug only) #renderedImage.save("test.jpg") #save in the currend folder print "\nList Screens:" print "=" * 50 for screen in conn.getObjects("Screen"): print_obj(screen) for plate in screenlistChildren(): print_obj(plate, 2) plateId = plate.getId() if plateId >= 0: print "\nPlate:%s" % plateId print "=" * 50 plate = conn.getObject("Plate", plateid) print "\nNumber ob fields:", plate.getNumberOfFields() print "\nGrid size:", plate.getGridSize() print "\n Wells in Plate:", plate.getName() for well in plate.listChildren(): index = well.countWellSample() print " Well: ", well.row, well.column, " Fields:", index for index in xrange(0, index): print " Image: ", \ well.getImage(index).getName(), \ well.getImage(index).getId()
def get_images(conn): params=ParametersI() params.exp(conn.getUser().getId()) images = conn.getObjects('Image', params=params) return images
def get_datasets(conn): params = ParametersI() params.exp(conn.getUser().getId()) datasets = conn.getObjects('Dataset', params=params) return datasets