[NeXus-committee] data array orientation

Osborn, Raymond rosborn at anl.gov
Thu Apr 26 16:09:40 BST 2018

I couldn’t see anything in the NeXus documentation addressing this after an admittedly very quick search, but we have always assumed that the data started at the bottom-left. That is also the convention that PyFAI uses (http://pyfai.readthedocs.io/en/latest/geometry.html#default-geometry-in-pyfai) and how our single crystal orientation software assumes the data is stored. However, it is usual for TIFF images to be inverted (as with most image formats) so that the first pixel is in the top-left. We have just completed a cycle with the new APS CdTe Pilatus 2M, and all the TIFF images were defined this way so that we had to flip the images to view them as they physically were measured. When integrating the PyFAI powder calibrations into NeXpy, I discovered that Dioptas, which is used a lot at the APS, automatically inverts the images when reading them. I prefer not to touch the data, but just invert the plots. It’s trivial to do in Matplotlib.

So our compromise is that NeXpy will, by default, display all images assuming the first pixel is bottom-left, but there is a checkbox and a keyboard shortcut (‘F’) that flips them. When we use our plugin to perform powder calibrations, I turn on the flip checkbox programmatically so that all powder scans correspond to reality. That way, it’s not really an issue, although users need to be aware of it.

With best regards,

On Apr 26, 2018, at 9:51 AM, Benjamin Watts <benjamin.watts at psi.ch<mailto:benjamin.watts at psi.ch>> wrote:

Hi Everyone,
   When writing an image to an array, there is the age-old question of whether the first array element corresponds to the top-left pixel, or the bottom-left pixel of the image. Is there any convention in NeXus about which to use, or an attribute to specify? I don't find anything specific in the documentation. This has become an issue for me because I have been following one image orientation convention and another beamline has followed the other and now a user wants a switch in the data analysis software to flip the image. I would assuming that the first data element corresponds to the first element of each axis array and so the image orientation could be detected by looking at whether the values in the sample_y array were increasing or decreasing in value. But perhaps I am missing something?

NeXus-committee mailing list
NeXus-committee at nexusformat.org<mailto:NeXus-committee at nexusformat.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nexusformat.org/pipermail/nexus-committee/attachments/20180426/34209c81/attachment.html>

More information about the NeXus-committee mailing list