1 /********************************************************************* 2 Fits - View and manipulate FITS extensions and/or headers. 3 Fits is part of GNU Astronomy Utilities (Gnuastro) package. 4 5 Original author: 6 Mohammad Akhlaghi <mohammad@akhlaghi.org> 7 Contributing author(s): 8 Copyright (C) 2015-2021, Free Software Foundation, Inc. 9 10 Gnuastro is free software: you can redistribute it and/or modify it 11 under the terms of the GNU General Public License as published by the 12 Free Software Foundation, either version 3 of the License, or (at your 13 option) any later version. 14 15 Gnuastro is distributed in the hope that it will be useful, but 16 WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with Gnuastro. If not, see <http://www.gnu.org/licenses/>. 22 **********************************************************************/ 23 #ifndef MAIN_H 24 #define MAIN_H 25 26 #include <gnuastro/list.h> 27 #include <gnuastro/fits.h> 28 29 #include <gnuastro-internal/options.h> 30 31 /* Progarm name macros: */ 32 #define PROGRAM_NAME "Fits" /* Program full name. */ 33 #define PROGRAM_EXEC "astfits" /* Program executable name. */ 34 #define PROGRAM_STRING PROGRAM_NAME" (" PACKAGE_NAME ") " PACKAGE_VERSION 35 36 37 38 39 40 enum fits_mode 41 { 42 FITS_MODE_INVALID, /* ==0, by C standard. */ 43 44 FITS_MODE_HDU, 45 FITS_MODE_KEY, 46 }; 47 48 49 50 51 52 /* Main program's structure */ 53 struct fitsparams 54 { 55 /* From the environment. */ 56 struct gal_options_common_params cp; /* Common parameters. */ 57 int hdu_in_commandline; /* HDU wasn't given in config. file. */ 58 gal_list_str_t *input; /* Name of input file. */ 59 char *outhdu; /* HDU of output (only when necessary). */ 60 gal_list_str_t *remove; /* Remove extensions from a file. */ 61 gal_list_str_t *copy; /* Copy extensions to output. */ 62 gal_list_str_t *cut; /* Copy ext. to output and remove. */ 63 uint8_t numhdus; /* Print number of HDUs in FITS file. */ 64 uint8_t datasum; /* Calculate and print HDU's datasum. */ 65 uint8_t pixelscale; /* Calculate and print HDU's pixelscale. */ 66 uint8_t skycoverage; /* Calculate and image coverage in WCS. */ 67 uint8_t hastablehdu; /* File has atleast one table HDU. */ 68 uint8_t hasimagehdu; /* File has atleast one image HDU. */ 69 uint8_t listtablehdus; /* List all table HDUs within the file. */ 70 uint8_t listimagehdus; /* List all image HDUs within the file. */ 71 uint8_t listallhdus; /* List all HDUs within the file. */ 72 uint8_t primaryimghdu; /* Copy/cut HDU into primary HDU. */ 73 uint8_t printallkeys; /* Print all the header keywords. */ 74 uint8_t printkeynames; /* List all keyword names. */ 75 uint8_t date; /* Set DATE to current time. */ 76 gal_list_str_t *asis; /* Strings to write asis. */ 77 gal_list_str_t *keyvalue; /* Strings to write asis. */ 78 gal_list_str_t *delete; /* Keywords to remove. */ 79 gal_list_str_t *rename; /* Rename a keyword. */ 80 gal_list_str_t *update; /* For keywords to update. */ 81 gal_list_str_t *write; /* Full arg. for keywords to add. */ 82 gal_list_str_t *history; /* HISTORY value. */ 83 gal_list_str_t *comment; /* COMMENT value. */ 84 uint8_t *verify; /* Verify the CHECKSUM and DATASUM keys. */ 85 char *copykeys; /* Range of keywords to copy in output. */ 86 char *datetosec; /* Convert FITS date to seconds. */ 87 char *wcscoordsys; /* Name of new WCS coordinate system. */ 88 char *wcsdistortion; /* WCS distortion to write in output. */ 89 uint8_t quitonerror; /* Quit if an error occurs. */ 90 uint8_t colinfoinstdout; /* Print column info in output. */ 91 92 /* Internal: */ 93 int mode; /* Operating on HDUs or keywords. */ 94 int coordsysid; /* ID of desired coordinate system.*/ 95 int distortionid; /* ID of desired distortion. */ 96 long copykeysrange[2]; /* Start and end of copy. */ 97 gal_fits_list_key_t *write_keys; /* Keys to write in the header. */ 98 gal_fits_list_key_t *update_keys; /* Keys to update in the header. */ 99 time_t rawtime; /* Starting time of the program. */ 100 }; 101 102 #endif 103