Changeset 4018 for trunk/Ohana/src/imregister/imphot/rtext.c
- Timestamp:
- May 23, 2005, 9:15:51 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/imregister/imphot/rtext.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/imregister/imphot/rtext.c
r3650 r4018 1 1 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 } 2 int rtext (FITS_DB *db) { 16 3 17 4 /* check that file size makes sense */ 18 5 Nimage = 0; 19 fits_scan (& header, "NIMAGES", "%d", 1, &Nimage);6 fits_scan (&db[0].header, "NIMAGES", "%d", 1, &Nimage); 20 7 if (stat (dBFile, &filestatus) == -1) { 21 8 if (VERBOSE) fprintf (stderr, "ERROR: failed to get status of image catalog\n"); … … 33 20 } 34 21 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 35 31 /* alloc, read images */ 36 32 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); 38 34 if (nimage != Nimage) { 39 35 if (VERBOSE) fprintf (stderr, "ERROR: problem loading image catalog\n"); 40 36 exit (1); 41 37 } 42 fclearlockfile (dBFile, f, LCK_SOFT, &dbstate); 38 db[0].ftable.buffer = image; 39 return (TRUE); 40 } 43 41 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.
