Nanozoomer annotation coordinate system to openslide pixels

Benjamin Gilbert bgilbert at cs.cmu.edu
Mon Nov 10 05:27:59 EST 2014


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



More information about the openslide-users mailing list