<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div>Dear All,</div><div><br></div><div> I only replied to Jerome on this before, but if anyone else is interested, here's my reply...</div><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>From: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Will Moore <<a href="mailto:will@lifesci.dundee.ac.uk">will@lifesci.dundee.ac.uk</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Date: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">20 January 2011 16:49:41 GMT</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>To: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Jerome Avondo <<a href="mailto:jeromeavondo@msn.com">jeromeavondo@msn.com</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Subject: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><b>Re: [ome-devel] Python Scripts: downloadPlane( ) in script_utils.py</b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> </div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Jerome,<div><br></div><div> I think this is the way that numpy (and PIL Image) works. </div><div><br></div><div>This is a little script you can try, which grabs a plane from OMERO and displays it using PIL. </div><div>I just pass the 2D array to PIL (after scaling) and it seems to be the right way around. </div><div><br></div><div>Numpy examples here might help <a href="http://www.scipy.org/Tentative_NumPy_Tutorial">http://www.scipy.org/Tentative_NumPy_Tutorial</a></div></div></blockquote><blockquote type="cite"><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><br></div><div>It seems that if you have a long stream of data (ie - a plane) and you want to convert to 2D array, you specify </div><div>reshape(y, x)</div><div><br></div><div>Looks like this:</div><div><pre dir="ltr" id="CA-429b7b085781847859fecb0e120dfe8455879daf_001" lang="en"><span class="line"><span class="Operator">>></span><span class="Operator">></span> <span class="ResWord">import</span> <span class="ID">numpy</span></span>
<span class="line"><span class="Operator">>></span><span class="Operator">></span> <span class="ID">a</span> <span class="Operator">=</span> <span class="ID">numpy</span><span class="Operator">.</span><span class="ID">arange</span><span class="Operator">(</span><span class="Number">10</span><span class="Operator">)</span><span class="Operator">.</span><span class="ID">reshape</span><span class="Operator">(</span><span class="Number">2</span><span class="Operator">,</span><span class="Number">5</span><span class="Operator">)</span></span>
<span class="line"><span class="Operator">>></span><span class="Operator">></span> <span class="ID">a</span></span>
<span class="line"><span class="ID">array</span><span class="Operator">(</span><span class="Operator">[</span><span class="Operator">[</span><span class="Number">0</span><span class="Operator">,</span> <span class="Number">1</span><span class="Operator">,</span> <span class="Number">2</span><span class="Operator">,</span> <span class="Number">3</span><span class="Operator">,</span> <span class="Number">4</span><span class="Operator">]</span><span class="Operator">,</span></span>
<span class="line"> <span class="Operator">[</span><span class="Number">5</span><span class="Operator">,</span> <span class="Number">6</span><span class="Operator">,</span> <span class="Number">7</span><span class="Operator">,</span> <span class="Number">8</span><span class="Operator">,</span> <span class="Number">9</span><span class="Operator">]</span><span class="Operator">]</span><span class="Operator">)</span></span></pre><div><div>Any help?</div></div></div></span></blockquote><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div> Will. </div><div><br></div><div><br></div><div></div></div></blockquote></div></body></html>