From rlm@astro.physics.uiowa.edu Mon Jan  3 11:54:12 1994
X-VM-VHeader: ("Resent-" "From:" "Sender:" "To:" "Apparently-To:" "Cc:" "Subject:" "Date:") nil
X-VM-Bookmark: 3
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	["1527" "Mon" "3" "January" "1994" "14:46:26" "GMT" "Robert Mutel" "rlm@astro.physics.uiowa.edu" nil "34" "Re: ST-6 Image: FITS format" "^From:" nil nil "1" nil nil])
Status: RO
Newsgroups: sci.astro
Path: cv3.cv.nrao.edu!hearst.acc.Virginia.EDU!darwin.sura.net!howland.reston.ans.net!vixen.cso.uiuc.edu!newsrelay.iastate.edu!hobbes.physics.uiowa.edu!sunlight!rlm
Message-ID: <CJ26DF.B5I@space.physics.uiowa.edu>
Nntp-Posting-Host: sunlight.physics.uiowa.edu
Reply-To: rlm@astro.physics.uiowa.edu
Organization: University of Iowa
References: <2fvs2u$ck2@canopus.cc.umanitoba.ca>
Lines: 34
From: rlm@astro.physics.uiowa.edu (Robert Mutel)
Sender: news@space.physics.uiowa.edu
Subject: Re: ST-6 Image: FITS format
Date: Mon, 3 Jan 1994 14:46:26 GMT

In article ck2@canopus.cc.umanitoba.ca, youngs@cc.umanitoba.ca (Scott D. Young) writes:
>
>   Just a note to anyone who is using the ST-6 software: it does NOT support
>   the FITS format. Yes, I know there is an option to save a file as a "FITS"
>   but it does not work. They write the file incorrectly; something about
>   flipping the high-order bit or something (I'm not sure of the details). 
>   We have a program to convert SBIG files to FITS files; it is easy enough
>   to do if you have the FITS format information (see sci.data.formats).
>
>   Scott Young
>   youngs@ccu.umanitoba.ca

This is not quite correct.  The exported FITS format of  ST-6 images is
fine except for an ambiguity with [all] 16-bit integer FITS files, viz
that the most  significant bit (MSB) is either treated as a sign bit or
a magnitude bit. The ST-6 uses the MSB as a mag. bit, so that FITS
readers which treat it as a sign bit will 'fold' all intensities
i>32767 to -65536+i. [I believe the keyword BIXPIX=SIMPLE is supposed
to sort this out, but a FITS expert can comment.] We have both ST-6 and
HPC-1 cameras, both of which use the MSB as a magnitude bit. Our FITS
image readers (e.g. Imagine-32 ,SAOimage, AIPS) assume MSB is a sign
bit. The work-around is to convert to floating point format and add
32767 to all images.


Robert Mutel
Department of Physics and Astronomy
University of Iowa
Iowa City IA 52242

Telephone: 319-335-1950      FAX: 319-335-1753
Email: rlm@sunlight.physics.uiowa.edu  (internet) 
       iowa::rlm (span)


From hanisch@stsci.edu Mon Jan  3 13:36:13 1994
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	["2315" "Mon" "3" "January" "1994" "17:38:03" "GMT" "Bob Hanisch, ST ScI" "hanisch@stsci.edu" nil "50" "Re: ST-6 Image: FITS format" "^From:" nil nil "1" nil nil])
Status: RO
Newsgroups: sci.astro
Path: cv3.cv.nrao.edu!hearst.acc.Virginia.EDU!darwin.sura.net!paladin.american.edu!europa.eng.gtefsd.com!uunet!organpipe.uug.arizona.edu!CS.Arizona.EDU!noao!stsci!iris.stsci.edu!hanisch
Message-ID: <1994Jan3.173803.15823@stsci.edu>
Reply-To: hanisch@stsci.edu
Organization: Space Telescope Science Institute, Baltimore MD
References: <CJ26DF.B5I@space.physics.uiowa.edu>
Lines: 50
From: hanisch@stsci.edu (Bob Hanisch, ST ScI)
Sender: news@stsci.edu
Subject: Re: ST-6 Image: FITS format
Date: Mon, 3 Jan 1994 17:38:03 GMT

In article B5I@space.physics.uiowa.edu, rlm@astro.physics.uiowa.edu (Robert Mutel) writes:
>In article ck2@canopus.cc.umanitoba.ca, youngs@cc.umanitoba.ca (Scott D. Young) writes:
>>
>>   Just a note to anyone who is using the ST-6 software: it does NOT support
>>   the FITS format. Yes, I know there is an option to save a file as a "FITS"
>>   but it does not work. They write the file incorrectly; something about
>>   flipping the high-order bit or something (I'm not sure of the details). 
>>   We have a program to convert SBIG files to FITS files; it is easy enough
>>   to do if you have the FITS format information (see sci.data.formats).
>>
>>   Scott Young
>>   youngs@ccu.umanitoba.ca
>
>This is not quite correct.  The exported FITS format of  ST-6 images is
>fine except for an ambiguity with [all] 16-bit integer FITS files, viz
>that the most  significant bit (MSB) is either treated as a sign bit or
>a magnitude bit. The ST-6 uses the MSB as a mag. bit, so that FITS
>readers which treat it as a sign bit will 'fold' all intensities
>i>32767 to -65536+i. [I believe the keyword BIXPIX=SIMPLE is supposed
>to sort this out, but a FITS expert can comment.] We have both ST-6 and
>HPC-1 cameras, both of which use the MSB as a magnitude bit. Our FITS
>image readers (e.g. Imagine-32 ,SAOimage, AIPS) assume MSB is a sign
>bit. The work-around is to convert to floating point format and add
>32767 to all images.
>
>
>Robert Mutel
>Department of Physics and Astronomy
>University of Iowa
>Iowa City IA 52242
>
>Telephone: 319-335-1950      FAX: 319-335-1753
>Email: rlm@sunlight.physics.uiowa.edu  (internet) 
>       iowa::rlm (span)
>

The FITS standard for 16-bit integer data is for it to be twos-complement,
signed integers.  Unsigned 16-bit integers are not FITS compliant, i.e.,
are inconsistent with SIMPLE = T.  In principle you could write unsigned
16-bit integers with SIMPLE = F, but there is no guarantee that a FITS
reader will be able to interpret your data properly then.

Bob Hanisch

---
Robert J. Hanisch                       Tel. (410)338-4910   Fax. (410)338-5090
Space Telescope Science Institute       NSI: hanisch@stsci.edu [130.167.1.2]
3700 San Martin Drive                   DECNet: STSCIC::HANISCH [6549::] 
Baltimore, MD  21218  USA               Bitnet: hanisch@stsci


From dwells@fits.cv.nrao.edu Mon Jan  3 13:55:33 1994
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	["2090" "Mon" "3" "January" "1994" "18:33:17" "GMT" "Don Wells" "dwells@fits.cv.nrao.edu" nil "43" "Re: ST-6 Image: FITS format" "^From:" nil nil "1" nil nil])
Status: RO
Xref: cv3.cv.nrao.edu sci.astro:35072 sci.astro.fits:572
Newsgroups: sci.astro,sci.astro.fits
Path: cv3.cv.nrao.edu!cv3.cv.nrao.edu!dwells
In-Reply-To: rlm@astro.physics.uiowa.edu's message of Mon, 3 Jan 1994 14: 46:26 GMT
Message-ID: <DWELLS.94Jan3133318@fits.cv.nrao.edu>
Organization: nrao
References: <2fvs2u$ck2@canopus.cc.umanitoba.ca> <CJ26DF.B5I@space.physics.uiowa.edu>
Lines: 43
From: dwells@fits.cv.nrao.edu (Don Wells)
Sender: news@nrao.edu
Subject: Re: ST-6 Image: FITS format
Date: Mon, 3 Jan 1994 18:33:17 GMT

    [I have added sci.astro.fits to the Newsgroups line -DCW]

In article <CJ26DF.B5I@space.physics.uiowa.edu>
    rlm@astro.physics.uiowa.edu (Robert Mutel) writes:

 RM> .. an ambiguity with [all] 16-bit integer FITS files, viz that
 RM> the most  significant bit (MSB) is either treated as a sign bit
 RM> or a magnitude bit. ..

There is no ambiguity in the definition of FITS for BITPIX=16: FITS
readers should always construe 16-bit pixels as 2-s complement signed
integers. FITS readers should also obey the BSCALE and BZERO keywords
when they are present (and should default to BSCALE=1 and BZERO=0 when
they are absent).  The formula which FITS readers should use to
interpret FITS pixels is

    physical_value = BZERO + BSCALE * array_value

(See Eq.5.3 in Sect.5.2.2.5 on p.19 of the NOST 100-1.0 version of the
FITS standard, or item III.D.1 on p.368 of the Basic FITS paper in
June 1981 A&A supplement Series, or Eq.3.2 in Sect.3.1.1.2 of the NOST
FITS User's Guide).  

 RM> The ST-6 uses the MSB as a mag. bit, so that FITS readers which
 RM> treat it as a sign bit will 'fold' all intensities i>32767 to
 RM> -65536+i. .. We have both ST-6 and HPC-1 cameras, both of which
 RM> use the MSB as a magnitude bit. ..

16-bit A-to-D converters produce unsigned integers; unsigned integers
are not supported by FITS.  When these pixels are being written to
FITS files with BITPIX=16 the camera software can utilize the optional
BZERO FITS keyword to shift the zero point of the number system in
order to give a 16-bit positive range instead of the default positive
and negative 15-bit range. The camera software should subtract 32768
>from the pixels (or, equivalently, add 8000_hex) and set BZERO=32768
and BSCALE=1 in the header. If this is done, properly coded FITS
readers will construe the pixels correctly.
--

  Donald C. Wells         Associate Scientist         dwells@nrao.edu
                    http://fits.cv.nrao.edu/~dwells
  National Radio Astronomy Observatory                +1-804-296-0277
  520 Edgemont Road,   Charlottesville, Virginia       22903-2475 USA

From R.DELOACH@larc.nasa.gov Sun Jan 23 08:03:12 1994
Path: saips.cv.nrao.edu!hearst.acc.Virginia.EDU!caen!usenet.cis.ufl.edu!eng.ufl.edu!saimiri.primate.wisc.edu!sdd.hp.com!sgiblab!swrinde!cs.utexas.edu!howland.reston.ans.net!usenet.ins.cwru.edu!lerc.nasa.gov!news.larc.nasa.gov!eigen.larc.nasa.gov!R.DELOACH
From: R.DELOACH@larc.nasa.gov (Dick DeLoach)
Newsgroups: sci.astro
Subject: Re: Hubble FITS location/availability?
Date: Fri, 21 Jan 1994 13:16:47
Organization: NASA Langley Research Center
Lines: 16
Distribution: usa
Message-ID: <R.DELOACH.143.000D4800@larc.nasa.gov>
References: <2h7hr4$1dkc@bigblue.oit.unc.edu> <2hmogv$gcv@news.cerf.net>
NNTP-Posting-Host: eigen.larc.nasa.gov
X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]

In article <2hmogv$gcv@news.cerf.net> sikes@nic.cerf.net (Terry Sikes) writes:
>From: sikes@nic.cerf.net (Terry Sikes)
>Subject: Re: Hubble FITS location/availability?
>Date: 20 Jan 1994 20:11:11 GMT


>On a related note, where is the FITS file format documented?

The formal ftp format specification can be found in the libraries of the 
CompuServe graphics support forum ("GO GRAPHICS" to access from any CompuServe 
prompt.)  It no doubt exists elsewhere but this is the only place I've seen it 
myself.

   --- Dick



From nrt@mail.ast.cam.ac.uk Mon Jan 24 15:18:45 1994
Newsgroups: sci.astro
Path: saips.cv.nrao.edu!hearst.acc.Virginia.EDU!concert!news-feed-2.peachnet.edu!darwin.sura.net!haven.umd.edu!news.umbc.edu!europa.eng.gtefsd.com!howland.reston.ans.net!pipex!pavo.csi.cam.ac.uk!news
From: nrt@mail.ast.cam.ac.uk (Nial Tanvir)
Subject: Re: FITS/GIF
Message-ID: <1994Jan24.171528.483@infodev.cam.ac.uk>
Sender: news@infodev.cam.ac.uk (USENET news)
Nntp-Posting-Host: coral.ast.cam.ac.uk
Reply-To: nrt@mail.ast.cam.ac.uk
Organization: Institute of Astronomy, Cambridge
References: <2hv987$jk8@enzu.unm.edu>
Date: Mon, 24 Jan 1994 17:15:28 GMT
Lines: 16

You can use XV, but you need some patches to allow it to read and write
FITS.  You need XV version 3.00a (can be obtained from ftp.cis.upenn.edu
in /pub/xv), the patches were written by David Robinson here and can be
obtained from our anonymous ftp server which is called ftp-hst.ast.cam.ac.uk
Look in directory /pub/software/xv-patches.

Hope this helps (don't know of any way using IRAF),

        Nial Tanvir.
  ------============-----
  HST UK Support Facility
    -----==========----





From fitz@noao.edu Mon Jan 24 18:14:36 1994
Newsgroups: sci.astro
Path: saips.cv.nrao.edu!hearst.acc.Virginia.EDU!darwin.sura.net!paladin.american.edu!howland.reston.ans.net!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!newncar!noao!fitz
From: fitz@noao.edu (Mike Fitzpatrick)
Subject: Re: FITS/GIF
Message-ID: <1994Jan24.203316.3111@noao.edu>
Originator: fitz@pisces.tuc.noao.edu
Sender: news@noao.edu
Nntp-Posting-Host: pisces.tuc.noao.edu
Organization: National Optical Astronomy Observatories, Tucson, AZ, USA
References: <1994Jan24.171528.483@infodev.cam.ac.uk>
Date: Mon, 24 Jan 1994 20:33:16 GMT
Lines: 15

	There currently isn't any way to do this directly in IRAF, although
we may provide this capability in the future.  Another solution would be to
get Jef Poskanzer's pbmplus package (from ftp.ee.lbl.gov, ucsd.edu, ftp.x.org
among others) and use a recipe such as

	% cat foo.fits | fitstopgm | pgmtoppm | ppmtogif > foo.gif

It *is* possible to get Sun rasterfiles out of IRAF and convert from there,
but using XV or the above is easier (for now).  IRAF questions can be sent
directly to iraf@noao.edu, we normally don't monitor sci.astro. I hope this
helps.

Mike Fitzpatrick
NOAO/IRAF Group
fitz@noao.edu

From keel@hera.astr.ua.edu Tue Jan 25 12:11:19 1994
Newsgroups: sci.astro
Path: saips.cv.nrao.edu!hearst.acc.Virginia.EDU!caen!sol.ctr.columbia.edu!howland.reston.ans.net!darwin.sura.net!ua1ix!hera.astr.ua.edu!keel
From: keel@hera.astr.ua.edu (&)
Subject: Re: FITS/GIF
Message-ID: <1994Jan25.150456.115773@ua1ix.ua.edu>
Sender: news@ua1ix.ua.edu
Nntp-Posting-Host: hera.astr.ua.edu
Organization: The University of Alabama
X-Newsreader: TIN [version 1.1 PL8]
References: <2hv987$jk8@enzu.unm.edu>
Date: Tue, 25 Jan 1994 15:04:56 GMT
Lines: 25

heli  fairweather (helix@unm.edu) wrote:
: Does anyone know how to make a FITS image into a gif? preferable using IRAF.

If there's a Silicon Graphics machine available, what I do is:
   display from IRAF into SAOImage or a similar display window
   capture this into an SGI-format image using the imgsnap utility
   convert into GIF using the SGI togif program.
   You can even composite three monochrome images into color by doing
   it for each of the individual frames as far as SGI format, then
   using tobw to make each RGB frame B&W and applying cglue to paste
   them together (some examples can be found on crux.astr.ua.edu in
   the web and pub/outgoing/hstgifs directories).

   I am told (but cannot personally verify) that functionally similar
   routines are available for Sun machines.
   --------------------------------------------------------------------------
Bill Keel                                 Astronomy, University of Alabama
keel@bildad.astr.ua.edu                   (that's Tuscaloosa)

I am professionally bound to deal with only those dimwits who
   1) wrote a proposal I'm reviewing,
   2) wrote a paper I'm refereeing, or 
   3) are currently faculty, staff, or students at the University of Alabama.
 Others will be dealt with as my need for amusement allows.


From tim@zeno.as.arizona.edu Tue Jan 25 17:15:01 1994
Path: saips.cv.nrao.edu!hearst.acc.Virginia.EDU!caen!malgudi.oar.net!news.ans.net!howland.reston.ans.net!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!newncar!noao!CS.Arizona.EDU!organpipe.uug.arizona.edu!zeno.as.arizona.edu!tim
From: tim@zeno.as.arizona.edu (Tim Pickering)
Newsgroups: sci.astro
Subject: Re: FITS/GIF
Date: 25 Jan 1994 17:37:18 GMT
Organization: University of Arizona UNIX Users Group
Lines: 7
Distribution: na
Message-ID: <2i3lce$m3n@organpipe.uug.arizona.edu>
References: <1994Jan24.171528.483@infodev.cam.ac.uk> <1994Jan24.203316.3111@noao.edu>
NNTP-Posting-Host: zeno.as.arizona.edu

A kludgy way to do it is to display the FITS or IRAF image file with 
SAOimage and then use xv to "grab" the image. xv can then save the 
grabbed image to .gif or whatever format. I use it to make postscript 
output without the stupid SAOimage headers and buttons. I don't notice 
any reduction in quality. 

Tim

From adam@csi.jpl.nasa.gov Tue Jan 25 23:52:07 1994
Path: saips.cv.nrao.edu!hearst.acc.Virginia.EDU!concert!news-feed-1.peachnet.edu!oldnews2.cis.umn.edu!zip.eecs.umich.edu!yeshua.marcam.com!news.kei.com!sol.ctr.columbia.edu!usc!elroy.jpl.nasa.gov!netline-fddi.jpl.nasa.gov!grover.jpl.nasa.gov!csi.jpl.nasa.gov!adam
From: adam@csi.jpl.nasa.gov (Adam Bernstein)
Newsgroups: sci.astro
Subject: Re: FITS/GIF
Date: 26 Jan 1994 01:42:44 GMT
Organization: Jet Propulsion Laboratory
Lines: 30
Distribution: na
Message-ID: <2i4hqk$g12@grover.jpl.nasa.gov>
References: <1994Jan24.171528.483@infodev.cam.ac.uk> <1994Jan24.203316.3111@noao.edu> <2i3lce$m3n@organpipe.uug.arizona.edu>
NNTP-Posting-Host: bloodhound.jpl.nasa.gov

In article <2i3lce$m3n@organpipe.uug.arizona.edu>, tim@zeno.as.arizona.edu 
(Tim Pickering) writes:
|> A kludgy way to do it is to display the FITS or IRAF image file with 
|> SAOimage and then use xv to "grab" the image. xv can then save the 
|> grabbed image to .gif or whatever format. 
[...etc]

	Actually, xv can be modified to read FITS directly, at which point
you can save it in any one of the other available formats.  In the 
unsupported routines that come with the xv package (in the directory 'unsupt')
are a few FITS read/write routines that can be built into the package, with
instructions on how to do it.  Unfortunately, the instructions are not exactly
right, and the routines include some variables that have changed names from
one version of xv to the next, so it'll take you a few hours; or if you want,
I could send you a copy of the correctly modified routines.

	What's more, in order to be able to non-interactively convert a list
of FITS images into GIF format, I adapted the xv code to create a routine
that would do just that and nothing else.  If anyone wants a copy of that,
let me know and I'll send it along.

		Adam

------------------------------------------------------------------------
Adam Bernstein               Phone: 818 354-9784    Jet Propulsion Lab
Guidance & Control /         FAX:   818 393-6105    MS 198-235
  Optical Tracking Group                            4800 Oak Grove Dr.
adam@bloodhound.jpl.nasa.gov                        Pasadena, CA 91109
------------------------------------------------------------------------


From roland@sics.se Wed Jan 26 10:59:10 1994
Newsgroups: sci.astro
Path: saips.cv.nrao.edu!hearst.acc.Virginia.EDU!concert!gatech!howland.reston.ans.net!cs.utexas.edu!convex!cnn.exu.ericsson.se!ericom!sics.se!roland
From: roland@sics.se (Roland Karlsson)
Subject: Re: FITS/GIF
In-Reply-To: adam@csi.jpl.nasa.gov's message of 26 Jan 1994 01:42:44 GMT
Message-ID: <ROLAND.94Jan26083522@zith.sics.se>
Lines: 14
Sender: news@sics.se
Organization: Swedish Institute of Computer Science, Kista
References: <1994Jan24.171528.483@infodev.cam.ac.uk> <1994Jan24.203316.3111@noao.edu>
	<2i3lce$m3n@organpipe.uug.arizona.edu> <2i4hqk$g12@grover.jpl.nasa.gov>
Distribution: na
Date: Wed, 26 Jan 1994 07:35:24 GMT



The PBMPLUS package contains a FITS to PGM (portable gray map)
converter called fitstopgm.  This format can then be converted to
almost any format you can imagine.  You can even combine three RGB PGM
files to one color PPM (portable pix map) file.  From this file you
can generate GIF or JPEG or whatever.  xv knows both the PGM and the
PPM format.


--
Roland Karlsson             SICS, PO Box 1263, S-164 28 KISTA, SWEDEN
Internet: roland@sics.se    Tel: +46 8 752 15 40          Fax: +46 8 751 72 30
Telex: 812 6154 7011 SICS   Ttx: 2401-812 6154 7011=SICS

