Table of Contents

Name

image, read_image, write_image, create_image, create_cube, copy_image, free_image - high level image i/o

Synopsis


#include <stdinc.h>
#include <image.h>
int read_image(instr, iptr)
stream instr;
imageptr *iptr;

int write_image (outstr, iptr)
stream outstr;
imageptr iptr;

int create_image (iptr, nx, ny)
imageptr *iptr;
int nx,ny;

int copy_image (iptr, optr)
imageptr iptr;
imageptr *optr;

int create_cube (iptr, nx, ny, nz)
imageptr *iptr;
int nx,ny,nz;

int free_image (iptr)
imageptr iptr;

real **map2_image(imageprt iptr)
real ***map3_image(imageprt iptr)

DescriptionThese routines provide a high-level interface to a CCD-like image
 structure. read_image() reads in a full image (which may be a cube), pointed
to by the pointer iptr from a file pointed to by the stream instr. It returns
0 in case of an error (allocation), 1 if OK. On success iptr contains a
valid address for an image. iptr is allocated using malloc(3), and free_image()
can be used to free the space (free(3)) used by an image. write_image()
writes the image pointed to by iptr to a file outstr. create_image() is
like read_image, but only allocates space and sets most image header (except
the size) variables to zero. create_cube() is the extension of create_image()
for 3D images. copy_image copies an image, but not the image elements.  All
header elements are copied. Simple C-style multi-dimensional data blocks can
be created using map2_image() and map3_image(), which will allow shorter
notation, at the expensive of a small array of pointers. For example, to
initialize a map to 0, you could do: 
    real **dat = map2_image(iptr)
    for (j=0; j<ny; j++)
      for (i=0; i<nx; i++)
        dat[j][i] = 0.0;

Author

Peter Teuben

See Also

mdarray(3NEMO) , image(5NEMO) , fits(5NEMO)

Files


~/src/pjt/image         image.c image.h image.3 image.5

Update History


xx-jul-87       original version        PJT
23-dec-88       V2.3 velocity added     PJT
18-jan-89       V3.0 3D implemented     PJT
27-jun-89       V4.1 added free_image   PJT
9-sep-02        V6.2 added copy_image    PJT
8-may-05    V5.0 added reference pixel to datafiles, no API impact yet here     PJT
4-aug-11    documented mapX_image    PJT


Table of Contents