/* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* LISTXY * * PURPOSE: * List subimages required to extract a NX,NY section at position XC,YC * from a plate. This may be used to find out which images GETXY is * going to require so they can be moved from CD to disk in case the * CD cannot be read directly from the program. * * CALLING SEQUENCE: * listxy(h,xc,yc,nx,ny) * * INPUTS: * h (* Header) header structure * xc,yc (float) center of image on plate * nx,ny (int) size of image * * OUTPUTS: * list of required images is printed on stdout * * PROCEDURE: * The plate is assumed to be stored in compressed 500x500 blocks * (or 500x499 for the last row). * A warning is printed if the entire image is off the plate. * * MODIFICATION HISTORY * Created by R. White, 5 August 1991 */ #include #include #include #include "header.h" static char translate[37] = "0123456789abcdefghijklmnopqr"; extern char *makepname(); extern void listxy(h,xc,yc,nx,ny) Header *h; double xc,yc; int nx,ny; { int i, j, i1, i2, j1, j2, x0, y0, x1, x2, y1, y2; char *filename; int nf; /* * calculate corner position */ x0=xc-(nx/2); y0=yc-(ny/2); /* * get plate file template */ filename = makepname(h); nf = strlen(filename)+1; /* * get range of image pixels which we will extract if we're not off edge */ x1 = x0; x2 = x0+nx-1; y1 = y0; y2 = y0+ny-1; /* * now get actual range of sections (limited to 0 -- 27) */ i1=x1/500; if (i1< 0) i1 = 0; i2=x2/500; if (i2>27) i1 = 27; j1=y1/500; if (j1< 0) j1 = 0; j2=y2/500; if (j2>27) j2 = 27; if ((i2 < i1) || (j2 < j1)) { fprintf(stderr, "warning: image section lies entirely off edge of plate\n"); return; } /* * get filename for each section */ fprintf(stdout,"%1d files required:\n",(i2-i1+1)*(j2-j1+1)); for (i = i1; i <= i2; i++) { for (j = j1; j <= j2; j++) { filename[nf-3] = translate[j]; filename[nf-2] = translate[i]; fprintf(stdout,"%s\n", filename); } } }