diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-03-04 21:21:30 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-03-04 21:21:30 -0500 |
commit | d54fe7c1f704a63824c5bfa0ece65245572e9b27 (patch) | |
tree | afc52015ffc2c74e0266653eecef1c8ef8ba5d91 /src/fes/cf_fes_write.c | |
download | calfuse-d54fe7c1f704a63824c5bfa0ece65245572e9b27.tar.gz |
Initial commit
Diffstat (limited to 'src/fes/cf_fes_write.c')
-rw-r--r-- | src/fes/cf_fes_write.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/fes/cf_fes_write.c b/src/fes/cf_fes_write.c new file mode 100644 index 0000000..baa678b --- /dev/null +++ b/src/fes/cf_fes_write.c @@ -0,0 +1,60 @@ +/******************************************************************************* + * Johns Hopkins University + * Center For Astrophysical Sciences + * FUSE + ******************************************************************************* + * + * Synopsis: cf_fes_write(fitsfile *outfits, int hdu, float *image); + * + * Description: writes an FES image into HDU number hdu in the FITS file + * pointed to by *fptr. Currently cf_fes_write extracts + * BITPIX, NAXIS1, and NAXIS2 from the specified HDU and + * uses those values to write the image. + * + * Arguments: fitsfile *outfits output FITS file pointer + * int hdu HDU to be written to + * float *image Pointer to array holding FES image + * + * Returns: none + * + * History: 07/08/98 gak calfes_design.070898 design documented + * 07/20/98 mlr started work + * 04/19/99 mlr finished modifications to utilize + * libcf and FITSIO.h(error handling). + * ToDO: I may at somepoint modify this subroutine to pass in the image + * type and size in as parameters... I already have the information + * I shouldn't read it in... or perhaps I should just verify that + * they match??? + * ToDo: I should check bitpix and write out the requested size. At the + * moment I only write float. + * + ******************************************************************************/ + +#include "calfuse.h" + +#define CF_PRGM_ID "cf_fes_write" + +int cf_fes_write(fitsfile *outfits, int hdu, float *image) +{ + char buffer[FLEN_CARD]; + int status, hdutype; + int naxis, naxis1, naxis2; + int fpixel, npixels, bitpix; + short *short_image; + + hdutype = -1; + status = 0; + + FITS_movabs_hdu(outfits, hdu, &hdutype, &status); + + FITS_read_key(outfits, TINT, "NAXIS1", &naxis1, buffer, &status); + FITS_read_key(outfits, TINT, "NAXIS2", &naxis2, buffer, &status); + FITS_read_key(outfits, TINT, "BITPIX", &bitpix, buffer, &status); + + fpixel = 1; + npixels = naxis1 * naxis2; + + FITS_write_img(outfits, TFLOAT, fpixel, npixels, image, &status); + + return(status); +} |