<div dir="ltr"><div><div><div><div>Benjamin,<br></div>You are amazing!<br>I am attaching the results of my test.<br></div>Look at the top left point of the 2nd image (which I extracted using my openslide python script "img.read_region()") and compare it with the black marker point in the first image to the left of the rectangle (assigned by the program NPD.view according the the ndpa file)<br>I would say they are fairly accurate!!<br></div>Ahmed<br></div>PS Am happy to contribute this code to python-openslide<br><div><div><br><div><img alt="Inline image 1" src="cid:ii_149a7697ad9c3035" height="327" width="523"><img alt="Inline image 2" src="cid:ii_149a769975253e04" height="523" width="523"><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 12, 2014 at 8:11 PM, Benjamin Gilbert <span dir="ltr"><<a href="mailto:bgilbert@cs.cmu.edu" target="_blank">bgilbert@cs.cmu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, November 10, 2014 10:40 pm, Ahmed Bassiouni wrote:<br>
> In this way, we need the complete width+length of the whole slide to<br>
> calculate coordinates.<br>
<br>
</span>We've been trying to do the calculation in the wrong order! We don't<br>
need the slide size after all. Here's the approach:<br>
<br>
0. The point coordinates are in physical units, relative to the center<br>
of the entire slide<br>
1. Add the [XY]OffsetFromSlideCentre ==> physical units, relative to the<br>
center of the main image<br>
2. Divide by (mpp-[xy] * 1000) ==> pixel coordinates, relative to the<br>
center of the main image<br>
3. Subtract (level-0 dimensions / 2) ==> level 0 pixel coordinates<br>
<div class="HOEnZb"><div class="h5"><br>
--Benjamin Gilbert<br>
_______________________________________________<br>
openslide-users mailing list<br>
<a href="mailto:openslide-users@lists.andrew.cmu.edu">openslide-users@lists.andrew.cmu.edu</a><br>
<a href="https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users" target="_blank">https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users</a><br>
</div></div></blockquote></div><br></div>