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&#39;s confusing that I can get these objects that tell me all all about an image yet they won&#39;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">&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>I should warn you that the whole python API is a bit ad hoc at the moment, since it&#39;s been developed experimentally for a number of different use cases (E.g. scripts, web-client) and we&#39;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&#39;ve seen). </div><div><br></div><div>The solution I&#39;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&#39;t sure what you meant by </div><div>project = &#39;xxx&#39;</div><div>dataset = &#39;xxx&#39;</div><div><br></div><div>I imagine you want to let users connect to OMERO, browse their Projects (choose one) browse it&#39;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&#39;s choice. </div><div><br></div><div>Hope that gets you going, and that any changes in the API don&#39;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">&lt;<a href="mailto:will@lifesci.dundee.ac.uk" target="_blank">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&#39;re using for most stuff is the &#39;blitzcon&#39; connection? <br>

 </div></div></blockquote><div><br></div><div>No, I was primarily connecting via:</div><div>c = omero.client(&#39;<a href="http://ome2-copy.fzk.de" target="_blank">ome2-copy.fzk.de</a>&#39;)</div><div>s = c.createSession(&#39;afraser&#39;, &#39;****&#39;)</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 &#39;blitzcon&#39; the &quot;second&quot; connection you&#39;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 &#39;gateway&#39; service in the createSession() connection, but we also refer to the &#39;blitzcon&#39; connection as omero.gateway</div>

 </div></blockquote><div><br></div><div>hrm, I&#39;m definitely confused then because I can do g.getPlane(ID, 0,0,0) with the above gateway, but there&#39;s no such getPlane method in what we&#39;re calling blitzcon.</div>

 <div><br></div><div>Also confusingly, I can get a session from blitzcon, but it&#39;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(&quot;afraser&quot;, &quot;****&quot;, host=&quot;<a href="http://ome2-copy.fzk.de" target="_blank">ome2-copy.fzk.de</a>&quot;, 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&#39;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>&gt;&gt;&gt; projects = cs.loadContainerHierarchy(&quot;Project&quot;, None, None)</div>

 <div>&gt;&gt;&gt; for p in projects:</div><div>&gt;&gt;&gt;        print p.getName().getValue()</div><div>&gt;&gt;&gt;        for d in p.linkedDatasetList():</div><div>&gt;&gt;&gt;             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&#39;d like to avoid this unless it&#39;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&#39;s fine. Thanks for clearing this up. I don&#39;t want to use the gateway if it&#39;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&#39;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 = &#39;xxx&#39;</div><div>pw = &#39;xxx&#39;</div><div>host = &#39;xxx&#39;</div><div>project = &#39;xxx&#39;</div><div>dataset = &#39;xxx&#39;</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 &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  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>