IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 23, 2005, 8:55:22 PM (21 years ago)
Author:
eugene
Message:

converted to the libohana/dvo_image I/O routines; improvements in fits_db.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/badimages.c

    r4689 r4864  
    88int badimages (int argc, char **argv) {
    99 
    10   FILE *f;
    11   int i, Nimage, nimage, entry, First, Cross;
     10  int i, Nimage, entry, First, Cross;
    1211  float *ptr;
    1312  double nominal, big, small, value;
    14   Header header;
    1513  Image *image;
    16   char ImageCat[256];
    1714
    18   VarConfig ("IMAGE_CATALOG", "%s", ImageCat);
    19  
    2015  if (argc != 3) {
    2116    fprintf (stderr, "USAGE: badimages entry value\n");
     
    2419  }
    2520 
     21  image = LoadImages (&Nimage);
     22
    2623  Cross = FALSE;
    2724  First = FALSE;
     
    3633      Cross = TRUE;
    3734    }
    38   }
    39  
    40   /* check if image datafile exists, get header */
    41   if (!fits_read_header (ImageCat, &header)) {
    42     fprintf (stderr, "can't open image catalog %s\n", ImageCat);
    43     return (FALSE);
    44   }
    45  
    46   /* get ready to read data on images */
    47   f = fopen (ImageCat, "r");
    48   if (f == (FILE *) NULL) {
    49     fprintf (stderr, "can't open image catalog %s\n", ImageCat);
    50     return (FALSE);
    51   }
    52   fseek (f, header.size, SEEK_SET);
    53  
    54   /* read in image data */
    55   Nimage = 0;
    56   fits_scan (&header, "NIMAGES", "%d", 1, &Nimage);
    57   ALLOCATE (image, Image, Nimage);
    58   nimage = Fread (image, sizeof(Image), Nimage, f, "image");
    59   fclose (f);
    60   if (nimage != Nimage) {
    61     fprintf (stderr, "error reading all data from image file (%d != %d)\n", nimage, Nimage);
    62     free (image);
    63     return (FALSE);
    6435  }
    6536 
     
    10172
    10273}
    103  
Note: See TracChangeset for help on using the changeset viewer.