IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 23, 2005, 9:15:51 AM (21 years ago)
Author:
eugene
Message:

moving Images to autocode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/imregister/imphot/rtext.c

    r3650 r4018  
    11
    2 Image *rtext () {
    3 
    4   f = fsetlockfile (dBFile, 120.0, LCK_SOFT, &dbstate);
    5   if (f == (FILE *) NULL) {
    6     fprintf (stderr, "ERROR: can't set lock on %s, state is %d\n", dBFile, dbstate);
    7     exit (1);
    8   }
    9   Fseek (f, 0, SEEK_SET);
    10 
    11   /* read header */
    12   if (!fits_fread_header (f, &header)) {
    13     if (VERBOSE) fprintf (stderr, "ERROR: can't read image catalog %s\n", dBFile);
    14     exit (1);
    15   }
     2int rtext (FITS_DB *db) {
    163
    174  /* check that file size makes sense */
    185  Nimage = 0;
    19   fits_scan (&header, "NIMAGES", "%d", 1, &Nimage);
     6  fits_scan (&db[0].header, "NIMAGES", "%d", 1, &Nimage);
    207  if (stat (dBFile, &filestatus) == -1) {
    218    if (VERBOSE) fprintf (stderr, "ERROR: failed to get status of image catalog\n");
     
    3320  }
    3421
     22  /* create a dummy set of table information */
     23  /* (original table has NAXIS = 2, change to 0) */
     24  fits_modify (&db[0].header, "NAXIS", "%d", 1, 0);
     25  fits_create_matrix (&db[0].header, &db[0].matrix);
     26  fits_table_mkheader_Image (&db[0].theader);
     27  db[0].ftable.header = &db[0].theader;
     28
     29  /* set theader size information to match loaded data */
     30
    3531  /* alloc, read images */
    3632  ALLOCATE (image, Image, MAX (Nimage, 1));
    37   nimage = Fread (image, sizeof(Image), Nimage, f, "image");
     33  nimage = fread (image, sizeof(Image), Nimage, db[0].f);
    3834  if (nimage != Nimage) {
    3935    if (VERBOSE) fprintf (stderr, "ERROR: problem loading image catalog\n");
    4036    exit (1);
    4137  }
    42   fclearlockfile (dBFile, f, LCK_SOFT, &dbstate);
     38  db[0].ftable.buffer = image;
     39  return (TRUE);
     40}
    4341
    44   return (image);
    45 }
     42/* the old Image.dat files used a fake FITS header defining a finite data block
     43   this function reads in the
     44*/
     45
     46
Note: See TracChangeset for help on using the changeset viewer.