#include #include #include #include #include #include #include #include main(int argc, char **argv){ FILE *fp; char infile[256], inputlist[256], PRJ[4]; char outfile[256], RAproj[9], DECproj[9]; long outimagesizeX, outimagesizeY; fitsfile *fptr_in, *fptr_out; int status=0, ncards, relax, nreject, nwcs, ctrl, i, j, anynul; long naxes[2]; float *inimage, *outimage, X_in, Y_in, X_out, Y_out; char *header; struct wcsprm *wcs_in,*wcs_out; double pixcrd_in[1][2], imgcrd[1][2], phi[1], theta[1], world[1][2], alpha, delta; double crpix1, crpix2, pixcrd_out[1][2]; int i_out, j_out, nfile; long imagesize; double pixelsize; if(argc !=9){ printf("usage: convertWCS inputfilelist PRJ outimagesizeX outimagesizeY crpix1 crpix2 pixelsize outfitsname\n"); printf("where PRJ must be one of the following; CAR, AIT, ZEA, CSC, PCO.\n"); exit(1); }else { strcpy(inputlist, argv[1]); strcpy(PRJ, argv[2]); sscanf(argv[3], "%ld", &outimagesizeX); sscanf(argv[4], "%ld", &outimagesizeY); sscanf(argv[5], "%lf", &crpix1); sscanf(argv[6], "%lf", &crpix2); sscanf(argv[7], "%lf", &pixelsize); strcpy(outfile, argv[8]); } printf("input file list = %s\n", inputlist); if(strcmp(PRJ, "CAR")!=0 &&strcmp(PRJ, "AIT")!=0&&strcmp(PRJ, "ZEA")!=0&&strcmp(PRJ, "CSC")!=0&&strcmp(PRJ, "PCO")!=0){ printf("PRJ must be one of the following: CAR, AIT, ZEA, CSC, PCO\n"); exit(1); } /* Read the input image ascii list */ if(NULL==(fp=fopen(inputlist,"r"))){ printf("cannot open %s\n", inputlist); exit(1); } inimage=malloc(512*512*4); outimage=malloc(outimagesizeX*outimagesizeY*4); for(i=0;i=0&&i_out=0&&j_out