IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12725


Ignore:
Timestamp:
Apr 3, 2007, 10:51:30 AM (19 years ago)
Author:
eugene
Message:

delete imagename was not removing image from image table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/delstar/src/delete_imagename.c

    r12332 r12725  
    44
    55  int i, j, k;
    6   int Nimlist, Nimage;
     6  int Nimlist, Nimage, Noutimage;
    77  int *imlist;
    88  double trange;
    99  time_t start, stop;
    1010  Image *image;
     11  Image *outimage;
    1112  Catalog catalog;
    1213  SkyList *skylist;
     
    6364
    6465  /* delete the identified images */
    65   gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, imlist, Nimlist);
    66   dvo_image_update (db, VERBOSE);
     66  ALLOCATE (outimage, Image, Nimage - Nimlist);
     67  for (i = 0, k = 0; i < Nimage; i++) {
     68      for (j = 0; j < Nimlist; j++) {
     69          if (imlist[j] == i) goto skip;
     70      }
     71      outimage[k] = image[i];
     72      k++;
     73  skip:
     74      continue;
     75  }
     76  free (image);
     77  Noutimage = Nimage - Nimlist;
     78 
     79  if (VERBOSE) fprintf (stderr, "removing %d images (leaving %d of %d)\n", Nimlist, Noutimage, Nimage);
     80  // gfits_table_set_Image (&db[0].ftable, outimage, Noutimage);
     81
     82  gfits_modify (&db[0].theader, "NAXIS2", "%d", 1, Noutimage);
     83  gfits_modify (&db[0].header, "NIMAGES", "%d", 1, Noutimage);
     84  db[0].theader.Naxis[1] = Noutimage;
     85  db[0].ftable.buffer = outimage;
     86
     87  dvo_image_save (db, VERBOSE);
    6788  dvo_image_unlock (db);
    6889
Note: See TracChangeset for help on using the changeset viewer.