1funimageput(3)                SAORD Documentation               funimageput(3)
2
3
4

NAME

6       FunImagePut - put an image to a Funtools file
7

SYNOPSIS

9         #include <funtools.h>
10
11         int FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix,
12                         char *plist)
13

DESCRIPTION

15       The FunImagePut() routine outputs an image array to a FITS file. The
16       image is written either as a primary header/data unit or as an image
17       extension, depending on whether other data have already been written to
18       the file.  That is, if the current file position is at the beginning of
19       the file, a primary HDU is written. Otherwise, an image extension is
20       written.
21
22       The first argument is the Funtools handle returned by FunOpen().  The
23       second buf argument is a pointer to a data buffer to write.  The
24       dim1and dim2 arguments that follow specify the dimensions of the image,
25       where dim1 corresponds to naxis1 and dim2 corresponds to naxis2.  The
26       bitpix argument specifies the data type of the image and can have the
27       following FITS-standard values:
28
29       ·   8 unsigned char
30
31       ·   16 short
32
33       ·   32 int
34
35       ·   -32 float
36
37       ·   -64 double
38
39       When FunTableRowPut() is first called for a given image, Funtools
40       checks to see if the primary header has already been written (by having
41       previously written an image or a binary table.) If not, this image is
42       written to the primary HDU.  Otherwise, it is written to an image
43       extension.
44
45       Thus, a simple program to generate a FITS image might look like this:
46
47         int i;
48         int dim1=512, dim2=512;
49         double *dbuf;
50         Fun fun;
51         dbuf = malloc(dim1*dim2*sizeof(double));
52         /* open the output FITS image, preparing to copy input params */
53         if( !(fun = FunOpen(argv[1], "w", NULL)) )
54           gerror(stderr, "could not FunOpen output file: %s\n", argv[1]);
55         for(i=0; i<(dim1*dim2); i++){
56           ... fill dbuf ...
57         }
58         /* put the image (header will be generated automatically */
59         if( !FunImagePut(fun, buf, dim1, dim2, -64, NULL) )
60           gerror(stderr, "could not FunImagePut: %s\n", argv[1]);
61         FunClose(fun);
62         free(dbuf);
63
64       In addition, if a Funtools reference handle was specified when this ta‐
65       ble was opened, the parameters from this Funtools reference handle are
66       merged into the new image header.  Furthermore, if a reference image
67       was specified during FunOpen(), the values of dim1, dim2, and bitpix in
68       the calling sequence can all be set to 0.  In this case, default values
69       are taken from the reference image section.  This is useful if you are
70       reading an image section in its native data format, processing it, and
71       then writing that section to a new FITS file.  See the imblank example
72       code.
73
74       The data are assumed to be in the native machine format and will auto‐
75       matically be swapped to FITS big-endian format if necessary.  This
76       behavior can be over-ridden with the convert=[true⎪false] keyword in
77       the plist param list string.
78
79       When you are finished writing the image, you should call FunFlush() to
80       write out the FITS image padding. However, this is not necessary if you
81       subsequently call FunClose() without doing any other I/O to the FITS
82       file.
83

SEE ALSO

85       See funtools(n) for a list of Funtools help pages
86
87
88
89version 1.4.0                   August 15, 2007                 funimageput(3)
Impressum