Nanozoomer annotation coordinate system to openslide pixels

Ahmed Bassiouni ahmedbassi at
Mon Nov 10 22:40:38 EST 2014

Hi Benjamin,

I tracked this and reached some preliminary conclusions.

In summary, I had only been able to extract regions in special cases while
for the rest of the areas/slides I was not able to extractdue to the yet
unknown coordinates system.

It looks like when you put in the offset coordinates into the ndpa file (
XOffsetFromSlideCentre and hamamatsu.
YOffsetFromSlideCentre). I did this by manually editing the xml itself.
This will give you a point EXACTLY in the centre of the main image.

However, these offset values themselves are actually relative to the centre
of the whole slide (as you guessed). Or this is at least what appears to
me, I can't think of another option.
The way I knew that is I went hunting for a slide that the roi of the macro
image is slightly to the left of the centre of the physical slide and there
the XOffsetFromSlideCentre was negative!

There is another tag, which I then investigated, but
it does not look like the correct value to look at, since I have a slide
where the x from is actually smaller than the
abs(-XOffsetFromSlideCentre). Unless this tag uses a different measurement

In this way, we need the complete width+length of the whole slide to
calculate coordinates. This has to be somewhere in the ndpi file itself ( I
hope). Otherwise, I wonder how the ndp.view software calculates it to place
the annotations at the correct site?? I sent hamamatsu an email querying

BTW There are also tiff.ResolutionUnit (in my slides it says centimeter),
tiff.XResolution and tiff.YResolution. Can these tags help?

Best wishes,

On Mon, Nov 10, 2014 at 8:57 PM, Benjamin Gilbert <bgilbert at>

> On 11/10/2014 02:27 AM, Ahmed Bassiouni wrote:
> > The NDP annotations seems to use their own coordinate system which I can
> > not convert to the openslide pixel based system to extract the pictures.
> There are several other coordinate values in NDPI and VMS slides which
> seem consistent with yours:
> hamamatsu.XOffsetFromSlideCentre
> hamamatsu.YOffsetFromSlideCentre
> and in VMS only:
> hamamatsu.PhysicalHeight
> hamamatsu.PhysicalWidth
> hamamatsu.PhysicalMacroHeight
> hamamatsu.PhysicalMacroWidth
> The values of PhysicalMacroWidth/Height imply that the units are nm.
> Playing around in GIMP, I found that the OffsetFromSlideCentre values
> are the offset of the center of the main image relative to the center of
> the macro image (i.e., the slide), with +x pointing right and +y
> pointing down.
> > (some of the point coordinates are actually negative!! weird! see
> > example below)
> More specifically, all of your X coordinates are negative.  Perhaps the
> origin is the center of the physical slide (or the center of the main
> image)?
> If the coordinates are relative to the main image, you can use the
> openslide.mpp-x/y properties to compute the correct scaling factor.
> If the coordinates are relative to the entire slide, there's a problem,
> since NDPI doesn't seem to provide an equivalent of the VMS-only
> properties above.  In order to convert the annotation coordinates to
> main image coordinates, you would need to know the size of the slide,
> which would need to be either hardcoded or calculated from (a) the
> downsample of the macro image and (b) its pixel dimensions.  The
> downsample, in turn, can be calculated from (c) the X/YResolution tags
> of the macro IFD, which OpenSlide does not expose right now.  However,
> the resulting slide dimensions would be fairly inaccurate because of the
> low resolutions of (b) and (c).
> I could add properties to expose the downsample of the macro image if
> needed, but I'm hoping there's a better solution.  Please let us know
> what you find.
> --Benjamin Gilbert
> _______________________________________________
> openslide-users mailing list
> openslide-users at
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the openslide-users mailing list