Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.

Ticket #8440: getPlane.py

File getPlane.py, 2.4 KB (added by cblackburn, 12 years ago)
Line 
1import sys, time
2
3from omero.gateway import BlitzGateway
4from path import path
5
6def getPlane():
7    conn = BlitzGateway("root", "omero", host="localhost", port=4064)
8    conn.connect()
9    #for imageIds in range(1,31): images 26/76 fails to render - known issue
10    for imageIds in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30]:
11        sumPlanes = []
12        sumImage = []
13        for imageId in (imageIds, imageIds+50):
14            image = conn.getObject("Image", imageId)
15            sizeX = image.getSizeX()
16            sizeY = image.getSizeY()
17            sizeZ = image.getSizeZ()
18            sizeC = image.getSizeC()
19            sizeT = image.getSizeT()
20           
21            zctList = []
22            for z in range(sizeZ):
23                for c in range(sizeC):
24                    for t in range(sizeT):
25                        zctList.append((z,c,t))
26           
27            ztList = []
28            for z in range(sizeZ):
29                for t in range(sizeT):
30                    ztList.append((z,t))
31           
32            print path(image.getName()).name, " ",
33            if image.getArchived():
34                print "(fslite)",
35            else:
36                print "(pixels)",
37            print " id=%d (X=%d, Y=%d, Z=%d, C=%d, T=%d)" % (imageId,sizeX,sizeY,sizeZ,sizeC,sizeT)
38
39            count = 10
40            timeList = []
41            for i in range(count):
42                startTime = time.time()
43                pixels = image.getPrimaryPixels()
44                planes = pixels.getPlanes(zctList)
45                for plane in planes:
46                    p = plane
47                t1 = time.time() - startTime
48                timeList.append(t1)
49            print "Getplanes (secs): min = %.3f  max = %.3f  mean = %.3f" % (min(timeList),max(timeList),sum(timeList)/count)
50            sumPlanes.append(sum(timeList))
51
52            timeList = []
53            for i in range(count):
54                startTime = time.time()
55                for zt in ztList:
56                    z,t = zt
57                    image.renderJpeg(z,t)
58                t1 = time.time() - startTime
59                timeList.append(t1)
60            print "Render individual planes (secs): min = %.3f  max = %.3f  mean = %.3f" % (min(timeList),max(timeList),sum(timeList)/count)
61            sumImage.append(sum(timeList))
62
63        print "getPlanes %.3f" % (sumPlanes[0]/sumPlanes[1])
64        print "renderImage %.3f" % (sumImage[0]/sumImage[1])
65        print
66
67       

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.54073 sec.)

We're Hiring!