IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4018


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

moving Images to autocode

Location:
trunk/Ohana/src/imregister
Files:
1 added
4 edited

Legend:

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

    r3650 r4018  
     1# include "imregister.h"
     2# include "imphot.h"
     3
     4/* criteria struct is global */
     5int args (int argc, char **argv) {
     6
     7
     8  FILE *f;
     9  Header header;
     10  int i, j, status, N;
     11  char *dBFile, *timestr, *photstr;
     12  int Nimage, nimage, *index, Ntimes;
     13  unsigned long *tstart, *tstop;
     14  int VERBOSE, FORCE_READ, PHOTCODE, dbstate;
     15  Image *image;
     16  int PhotCodeSelect, Nin;
     17  int CodeSelect, Code;
     18  char *FitsOutput, *NameSelect;
     19  int NameSelectLength;
     20  struct stat filestatus;
     21  int size;
     22
     23  int N;
     24
     25  ConfigInit (&argc, argv); /* load elixir config data */
    126
    227  /* load photcode data */
  • trunk/Ohana/src/imregister/imphot/output.c

    r3650 r4018  
     1int DumpFitsTable (char *filename, Image *image, int Nentry, int *index, int Nkeep);
     2
    13
    24output () {
  • 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
  • trunk/Ohana/src/imregister/src/imphotsearch.c

    r3650 r4018  
    11# include "imregister.h"
    22
    3 static char PhotError[] = "unknown";
    4 static char *version = "imphotsearch $Revision: 1.5 $";
    5 
    6 int DumpFitsTable (char *filename, Image *image, int Nentry, int *index, int Nkeep);
     3static char *version = "imphotsearch $Revision: 1.6 $";
    74
    85int main (int argc, char **argv) {
    96 
    10   FILE *f;
    11   Header header;
    12   int i, j, status, N;
    13   char *dBFile, *timestr, *photstr;
    14   int Nimage, nimage, *index, Ntimes;
    15   unsigned long *tstart, *tstop;
    16   int VERBOSE, FORCE_READ, PHOTCODE, dbstate;
    17   Image *image;
    18   int PhotCodeSelect, Nin;
    19   int CodeSelect, Code;
    20   char *FitsOutput, *NameSelect;
    21   int NameSelectLength;
    22   struct stat filestatus;
    23   int size;
    24 
    257  get_version (argc, argv, version);
    26   ConfigInit (&argc, argv);
    27 
    288  args (&argc, argv);
    299 
    30   /* load image database - still a non-FITS file */
    31   dBFile = ImPhotDB;
     10  db.lockstate = (output.modify || output.delete) ? LCK_HARD : LCK_SOFT;
     11  db.timeout   = 300.0;
     12  fits_db_init (&db);
    3213
    33   /* how do we decide if it is text or fits? must examine header */
    34   if (FITS) {
    35     image = rtext (&Nimage);
    36   } else {
    37     image = rfits (&Nimage);
     14  if (!fits_db_lock (&db, ImPhotDB)) {
     15    fprintf (stderr, "ERROR: failure to lock db\n");
     16    fits_db_close (&db);
     17    exit (1);
    3818  }
     19  /* we use a varient of fits_db_load since the file may be in text format */
     20  if (!db_load (&db)) {
     21    fprintf (stderr, "ERROR: failure to load db\n");
     22    fits_db_close (&db);
     23    exit (1);
     24  }
     25
     26  if (!output.modify && !output.delete) fits_db_close (&db);
     27
     28  image = fits_table_get_RegImage (&db.ftable, &Nimage);
    3929
    4030  subset ();
Note: See TracChangeset for help on using the changeset viewer.