Subject: Upside Down (was Re: No ST-6 FITS images ?)

From: sla at umbra.UCSC.EDU (Steve Allen)
Date: 13 Apr 1994 20:52:16 GMT

In article <2ohduo$dgp at gap.cco.caltech.edu>,
Channel Energy <eychaner at SUNCUB.BBSO.CALTECH.EDU> wrote:
>       Many FITS viewers display left to right and bottom to top (the
>first value is in the lower left).  Is this behaviour specified by the
>standard (I couldn't find it, but I have an older copy)?

The standard documents do not specify anything about the orientation of
the display of a FITS image; they merely describe how it shall be stored.

Personally, I find it somewhat hard to understand why IRAF chose to display
pixel 1,1 at the lower left.  Many CCD detectors plainly originated as video
devices intended to be used to display on a standard video screen where
the origin is at the upper left.  This is the standard video coordinate
system and it is also the system adopted by the writers of the X Window
System.  It seems only fair to acknowledge the roots of the technology,
especially when dealing with the original hardware which had little
extra power to do things such as re-rasterize the image.  (Lick uses
the standard video coordinate system.)

The draft "Representations of Celestial Coordinates in FITS" paper by
E. Greisen and M. Calabretta recommends that FITS images be displayed
with 1,1 in the lower left corner, though it leaves open the possibility
that a (powerful enough) display system should re-orient as desired.

We probably need to remember that this is akin to the other odd things about
astronomy:  FITS arrays begin with 1 not 0, temperature increases to
the left in the HR diagram, larger magnitude is a fainter star, the
longitude of the sub-solar point decreases with time, etc.  All these
things simply have to be drilled into the introductory classes and
written into the specs which control how the software will be written.
Otherwise we will all be off-by-one and flipped upside down.  :-)
--  --  --  --  --  -+-   --  --  --  --  --  --  --  -+-  --  --  --  --  --
Steve Allen          | See us on the World Wide Web    |   sla at lick.ucsc.edu
UCO/Lick Observatory | The URL is ftp://lick.ucsc.edu/ |   +1 408 459 3046
Santa Cruz, CA 95064 | pub/outgoing/sla/sms.html       |   Seabright Morris

---

From: tody at lepus.tuc.noao.edu (Doug Tody)
Date: Wed, 13 Apr 1994 22:10:03 GMT

In article <2ohm20$i2o at darkstar.UCSC.EDU>, sla at umbra.UCSC.EDU (Steve Allen) writes:
> pixel 1,1 at the lower left...

I suspect this predates IRAF, however lower left is appealing to people with
a mathematical background, where the origin (of the positive XY quadrant) is
always in the lower left.  It is the graphics folks that have it backward.

The new Ximtool display server has buttons allowing the displayed image to
be easily flipped in either axis, so this should soon become a non-issue.

As Steve points out, FITS itself does not care how the image is displayed.

	- Doug

-- 
Doug Tody	National Optical Astronomy Observatories    IRAF project
tody at noao.edu   P.O. Box 26732, Tucson, Arizona, 85726      iraf at noao.edu

---

From: eychaner at SUNCUB.BBSO.CALTECH.EDU ("Channel Energy")
Date: 13 Apr 1994 23:07:35 GMT

>the display of a FITS image; they merely describe how it shall be stored.

Pet peeve time:
(One of my pet peeves about the FITS standard is that the word-order is
opposite that of my VAX machines, forcing me to byte-swap before I write
as it is.  I realize I could probably do the image-invert in the same
lopp, but it gets increasingly complicated.)
(Or maybe that's one of my pet peeves about VAX machines.)  :-)
(Maybe the standard ought to specify THREE things about the data: number
of bits/pixel, signed/unsigned, and byte order.  But then, the standard
is more than complicated enough, thanks to the binary tables, etc.  It
could be done IF it had stayed an IMAGE standard.)
(And I'm annoyed that I'll have to store the 10-bit CCD data from our
new camera as 16-bit; I can't just say BITPIX=10, squeeze out the zero
bits, and get an instant 40% compression.)  :-)

>System. [...]  (Lick uses the standard video coordinate system.)
[...]
>that a (powerful enough) display system should re-orient as desired.

I believe I can guess why IRAF and others chose the lower left corner:
because a standard coordinate grid has its origin in the lower left of
the positive axes, and increases up and to the right.
So why don't chips read from the lower left (and video scan from the
lower left, etc.?)  Because the English language is written and read
from the upper left, rightward and downward, perhaps?

>longitude of the sub-solar point decreases with time, etc.

Did astronomers decide that as long as they got one thing backward, they
might as well get EVERYTHING backward in the hopes it would cancel?  :-)

-G.

Glenn Eychaner, C Programmer & VMS Manager, Big Bear Solar Obs., Caltech
eychaner at suncub.bbso.caltech.edu  (909)866-5791  40386 North Shore Lane
SUNCUB::EYCHANER, 5554::EYCHANER  (818)395-4014  Big Bear City, CA 92314

---

From: thompson at serts.gsfc.nasa.gov (William Thompson)
Date: 14 Apr 94 14:02:33 GMT

>the standard video coordinate system.)

Why should FITS be tied to a specific detector such as a CCD?  There are a lot
of other ways to gather data.

The FITS standard does allow for the inclusion of information relating to the
orientation of the data.  Both the World Coordinate System and the older
CRPIXn, CRVALn, CDELTn system document how the data relates to real world
coordinates.  This may or may not be the same as the way the data falls onto
the detector, depending on the optical system used to feed it.

When analyzing data, I find it convenient that images are displayed with the
origin at the lower left, because contour plots are done the same way.  This
makes it easy to combine images and graphics.  I don't use IRAF myself--I use
IDL which evidently does it the same way as IRAF.  (IDL does allow one to
display images with the origin at the upper left if desired, by manipulating a
global variable.)

Bill Thompson

---

From: cflatter at laphroaig.nrao.edu (Chris Flatters)
Date: 14 Apr 1994 17:54:02 GMT

> always in the lower left.  It is the graphics folks that have it backward.

Monitors conventionally scan from left-to-right and from top-to-bottom.
In the days of devices that were accessed as frame buffers (such as the
old IIS Model 70s) it was convenient to use the same data layout so
that data would be read sequentially and fed to the monitor in the
order that it was needed.  In this case placing the origin at the top
left was a natural choice and this has carried over to less-hardware
oriented graphics interfaces that still work at the pixel level (such
as X11).

On the other hand, truly hardware-independent graphics interfaces (such
as GKS, PEX and PostScript) generally use a coordinate system with the
origin at the bottom left-hand corner, corresponding to the normal
convention used on paper.

	Chris Flatters
	cflatter at nrao.edu