/* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* imlistxy.c List image blocks needed to extract an image at a given * X,Y from a specified plate. This can be used if the * CDROM cannot be directly accessed as a file-structured * device. The procedure would be: * (1) Copy the header for the plate to be used to a directory * on disk (plate.hhh). * (2) Run imlistxy to get a list of the files which will be * required. * (3) Copy the needed files from CD to disk using whatever * procedures are available for reading the CD. * (4) Run imextrxy to extract the image from the copied * files. * * Inputs from terminal (stdin): * plate name of plate (e.g. s840) * X, Y position of source in J2000 or B1950 coordinates * nx,ny size of section to extract * * Inputs from command line: * plate_root partial name of directory where plates are located * header_dir directory where headers are located * compression compression factor ("low", "medium", or "high") * * Programmer: R. White Date: 6 August 1991 * * */ #include #include #include #include "header.h" extern void pltlist(); extern int gethdr(); extern void position(); extern void conrddms(); extern int listxy(); main (argc, argv) int argc; char *argv[]; { Header header; int nx, ny; float x, y; int rah,ram,decd,decm; float ras,decs; char decsign; double ra, dec; float mag = 0.0, colour = 0.0; /* * set plate directory, header directory, compression factor, and * plate name in header structure using command line parameters */ if (argc != 4) { fprintf(stderr, "Usage: %s plate-directory header-directory compression-factor\n", argv[0]); exit(0); } strcpy(header.plate_root, argv[1]); strcpy(header.header_dir, argv[2]); strcpy(header.compression, argv[3]); /* * list plates that are available */ pltlist(); fprintf(stderr, "Enter plate name: "); fscanf(stdin, " %s", header.plate_name); /* * read header file for this plate */ if (gethdr(&header)) { fprintf(stderr, "Could not read header for plate %s\n", header.plate_name); exit(0); } /* * get X,Y and convert to RA, Dec and convert to radians */ fprintf(stderr, "Enter target position in pixels (X Y): "); fscanf(stdin, " %f %f", &x, &y); position(&header, x, y, mag, colour, &ra, &dec); conrddms(ra,dec, &rah,&ram,&ras, &decsign,&decd,&decm,&decs); fprintf(stderr, "J2000: %2.2d %2.2d %6.3f %c%2.2d %2.2d %5.2f\n", rah,ram,ras, decsign,decd,decm,decs); /* * get section size */ fprintf(stderr, "Enter desired image size (nx ny): "); fscanf(stdin, " %d %d", &nx, &ny); /* * list files needed for this image section */ listxy(&header,x,y,nx,ny); exit(1); }