<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div></div><div><br></div><div><br></div><div>On 7 Feb 2011, at 21:43, Adam Fraser wrote:<div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Will,&nbsp;<div><br></div><div>Thanks for your response, I would have gotten back to you sooner but I was traveling.<br><br><div class="gmail_quote">On Sat, Feb 5, 2011 at 3:04 AM, Will Moore <span dir="ltr">&lt;<a href="mailto:will@lifesci.dundee.ac.uk">will@lifesci.dundee.ac.uk</a>&gt;</span> wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word">Hi Adam,<div><br></div><div>Sorry for the confusion, but the connection you're using for most stuff is the&nbsp;'blitzcon' connection?&nbsp;<br> </div></div></blockquote><div><br></div><div>No, I was primarily connecting via:</div><div>c = omero.client('<a href="http://ome2-copy.fzk.de">ome2-copy.fzk.de</a>')</div><div>s = c.createSession('afraser', '****')</div> <div><div>g = s.createGateway()</div></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>Or is 'blitzcon' the "second" connection you're using to get Dataset ID?<br> </div></div></blockquote><div><br></div><div>yup.</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>Confusingly, we have a 'gateway' service in the createSession() connection, but we also refer to the 'blitzcon' connection as omero.gateway</div> </div></blockquote><div><br></div><div>hrm, I'm definitely confused then because I can do g.getPlane(ID, 0,0,0) with the above gateway, but there's no such getPlane method in what we're calling blitzcon.</div> <div><br></div><div>Also confusingly, I can get a session from blitzcon, but it's apparently not the same as the type of session I get from omero.clients.BaseClient.createSession(user, password)</div><div><br></div><div> <div>blitzcon = client_wrapper("afraser", "****", host="<a href="http://ome2-copy.fzk.de">ome2-copy.fzk.de</a>", port=4064)</div><div>blitzcon.connect()</div></div><div>s = blitzcon.getSession()</div> <div>s.getGateway() #fails</div><div><br></div><div>... of course the only reason I'm trying to get the gateway here is because I need getPlane().</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div style="word-wrap:break-word"><br>You want to allow the user to browse their Projects and Datasets by name, to get Dataset ID?<br>You can use the container service to list Projects and Datasets...</div></blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "> &nbsp;</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div><div>&gt;&gt;&gt; projects = cs.loadContainerHierarchy("Project", None, None)</div> <div>&gt;&gt;&gt; for p in projects:</div><div>&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;print p.getName().getValue()</div><div>&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;for d in p.linkedDatasetList():</div><div>&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print d.getName().getValue()</div> </div></div></blockquote><div><br></div><div>Ok, this would prevent me from having to connect via the blitzcon thing but...</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div style="word-wrap:break-word"><div><div><br></div><div>But if you know the name of the Dataset from the start, and you simply want the ID, you CAN use the query service.</div></div></div></blockquote><div><br></div><div> Hrm, I know _nothing_ about the db schema, so I'd like to avoid this unless it's going to give me a serious performance improvement.</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div style="word-wrap:break-word"><div><div>Generally you will find it much easier to work with the blitzcon connection.</div></div></div></blockquote><div><br></div><div>Ok, so I should use blitzcon = omero.client_wrapper(...), that's fine. Thanks for clearing this up. I don't want to use the gateway if it's going to change on me, I had the impression it was the right thing to use after reading <a href="http://trac.openmicroscopy.org.uk/omero/wiki/OmeroPy/Gateway">this page</a>.</div> <div><br></div><div>So here's where this puts me in terms of code:</div><div><br></div><div><div>import omero</div><div>from omero import client_wrapper</div></div><div>import numpy as np</div><div><br></div><div><div> user = 'xxx'</div><div>pw = 'xxx'</div><div>host = 'xxx'</div><div>project = 'xxx'</div><div>dataset = 'xxx'</div><div><br></div><div>blitzcon = client_wrapper(user, pw, host, port=4064)</div> <div>blitzcon.connect()</div><div><br></div><div># get all image ids from dataset:</div><div><b>image_ids = #???</b></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div>for image_id in image_ids:</div><div>&nbsp;&nbsp; &nbsp;im = blitzcon.getImage(image_id)</div> <div>&nbsp;&nbsp; &nbsp;# Get raw image plane.</div><div>&nbsp;&nbsp; &nbsp;# &nbsp; &nbsp;previously: plane = g.getPlane(image_id, 0, 0, 0)</div><div>&nbsp;&nbsp; &nbsp;<b>plane = #???</b></div><div>&nbsp;&nbsp; &nbsp;px = im.getPixels(0)</div><div>&nbsp;&nbsp; &nbsp;h = px.getSizeY().getValue()</div><div> &nbsp;&nbsp; &nbsp;w = px.getSizeX().getValue()</div><div>&nbsp;&nbsp; &nbsp;imdata = np.array(list(plane))</div><div>&nbsp;&nbsp; &nbsp;imdata.shape = (h,w)</div><div>&nbsp;&nbsp; &nbsp;# now I can do stuff with imdata</div></div><div><br></div><div>Any chance you can help me fill in those 2 blanks?</div> <div><br></div><div>Thanks again,</div><div>Adam</div></div></div></blockquote></div><br><div apple-content-edited="true"> <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>William Moore</div><div><div>Wellcome Trust Centre for Gene Regulation &amp; Expression</div><div>College of Life Sciences</div><div>MSI/WTB/JBC Complex</div><div>University of Dundee</div><div>Dow Street</div><div>Dundee&nbsp; DD1 5EH</div><div>United Kingdom</div><div><br></div><div>Phone 01382 386364</div></div><div><a href="http://openmicroscopy.org">http://openmicroscopy.org</a></div></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"> </div><br></div></body></html>