Thanks Will, <div><br><div>This is great! It works for me and should keep me busy for a while.</div><div><br></div><div>One suggestion for the API would be to add a getPlane() method to omero.model.Pixels and/or omero.model.ImageI ...it's confusing that I can get these objects that tell me all all about an image yet they won't let me at the raw pixel data.</div>
<div><br></div><div>Again, thanks very much,</div><div>-Adam</div><div><br><div class="gmail_quote">On Mon, Feb 7, 2011 at 6:21 PM, Will Moore <span dir="ltr"><<a href="mailto:will@lifesci.dundee.ac.uk">will@lifesci.dundee.ac.uk</a>></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>I should warn you that the whole python API is a bit ad hoc at the moment, since it's been developed experimentally for a number of different use cases (E.g. scripts, web-client) and we're in the process of rationalising this to some extent.</div>
<div>At the moment you have to look in a bunch of different places to find the functionality you need (as you've seen). </div><div><br></div><div>The solution I've attached uses the latest trunk code, although the methods may have been unchanged since the 4.2.2 release? </div>
<div><br></div><div>I wasn't sure what you meant by </div><div>project = 'xxx'</div><div>dataset = 'xxx'</div><div><br></div><div>I imagine you want to let users connect to OMERO, browse their Projects (choose one) browse it's Datasets and select one with images to process.</div>
<div>The only bit that is missing from the attached script is getting the user's choice. </div><div><br></div><div>Hope that gets you going, and that any changes in the API don't cause too much pain!</div><div><br>
</div><font color="#888888"><div> Will. </div><div><br></div><div><br></div><div></div></font></div><br><div style="word-wrap:break-word"><div></div><div><br></div><div><br></div><div>On 7 Feb 2011, at 21:43, Adam Fraser wrote:<div>
<br><blockquote type="cite">Hi Will, <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"><<a href="mailto:will@lifesci.dundee.ac.uk" target="_blank">will@lifesci.dundee.ac.uk</a>></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 'blitzcon' connection? <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" target="_blank">ome2-copy.fzk.de</a>')</div><div>s = c.createSession('afraser', '****')</div>
<div><div>g = s.createGateway()</div></div><div> </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> </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" target="_blank">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> </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">
</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>>>> projects = cs.loadContainerHierarchy("Project", None, None)</div>
<div>>>> for p in projects:</div><div>>>> print p.getName().getValue()</div><div>>>> for d in p.linkedDatasetList():</div><div>>>> 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> </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" target="_blank">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> </div><div>for image_id in image_ids:</div><div> im = blitzcon.getImage(image_id)</div>
<div> # Get raw image plane.</div><div> # previously: plane = g.getPlane(image_id, 0, 0, 0)</div><div> <b>plane = #???</b></div><div> px = im.getPixels(0)</div><div> h = px.getSizeY().getValue()</div><div>
w = px.getSizeX().getValue()</div><div> imdata = np.array(list(plane))</div><div> imdata.shape = (h,w)</div><div> # 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> <div style="word-wrap:break-word"><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;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<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;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<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;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<div><div>William Moore</div><div><div>Wellcome Trust Centre for Gene Regulation & 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 DD1 5EH</div><div>United Kingdom</div><div><br></div><div>Phone 01382 386364</div></div><div><a href="http://openmicroscopy.org" target="_blank">http://openmicroscopy.org</a></div></div></div></span><br></div></span><br>
</div></span><br></div><br> </div><br></div></div><br></blockquote></div><br></div></div>