"Fossies" - the Fresh Open Source Software Archive

Member "gnuastro-0.8/bin/crop/args.h" (3 Dec 2018, 6787 Bytes) of package /linux/privat/gnuastro-0.8.tar.lz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "args.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 0.6_vs_0.7.

    1 /*********************************************************************
    2 Crop - Crop a given size from one or multiple images.
    3 Crop 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) 2016-2018, 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 ARGS_H
   24 #define ARGS_H
   25 
   26 
   27 
   28 
   29 
   30 /* Array of acceptable options. */
   31 struct argp_option program_options[] =
   32   {
   33     /* Input. */
   34     {
   35       "mode",
   36       UI_KEY_MODE,
   37       "STR",
   38       0,
   39       "Coordinate mode `img' or `wcs'.",
   40       GAL_OPTIONS_GROUP_INPUT,
   41       &p->mode,
   42       GAL_TYPE_STRING,
   43       GAL_OPTIONS_RANGE_ANY,
   44       GAL_OPTIONS_MANDATORY,
   45       GAL_OPTIONS_NOT_SET,
   46       ui_parse_coordinate_mode
   47     },
   48     {
   49       "hstartwcs",
   50       UI_KEY_HSTARTWCS,
   51       "INT",
   52       0,
   53       "Header keyword number to start reading WCS.",
   54       GAL_OPTIONS_GROUP_INPUT,
   55       &p->hstartwcs,
   56       GAL_TYPE_SIZE_T,
   57       GAL_OPTIONS_RANGE_GE_0,
   58       GAL_OPTIONS_NOT_MANDATORY,
   59       GAL_OPTIONS_NOT_SET
   60     },
   61     {
   62       "hendwcs",
   63       UI_KEY_HENDWCS,
   64       "INT",
   65       0,
   66       "Header keyword number to stop reading WCS.",
   67       GAL_OPTIONS_GROUP_INPUT,
   68       &p->hendwcs,
   69       GAL_TYPE_SIZE_T,
   70       GAL_OPTIONS_RANGE_GE_0,
   71       GAL_OPTIONS_NOT_MANDATORY,
   72       GAL_OPTIONS_NOT_SET
   73     },
   74     {
   75       "zeroisnotblank",
   76       UI_KEY_ZEROISNOTBLANK,
   77       0,
   78       0,
   79       "0.0 in float or double images are not blank.",
   80       GAL_OPTIONS_GROUP_INPUT,
   81       &p->zeroisnotblank,
   82       GAL_OPTIONS_NO_ARG_TYPE,
   83       GAL_OPTIONS_RANGE_0_OR_1,
   84       GAL_OPTIONS_NOT_MANDATORY,
   85       GAL_OPTIONS_NOT_SET
   86     },
   87 
   88 
   89 
   90 
   91     /* Output. */
   92     {
   93       "noblank",
   94       UI_KEY_NOBLANK,
   95       0,
   96       0,
   97       "Remove parts of the crop box out of input image.",
   98       GAL_OPTIONS_GROUP_OUTPUT,
   99       &p->noblank,
  100       GAL_OPTIONS_NO_ARG_TYPE,
  101       GAL_OPTIONS_RANGE_0_OR_1,
  102       GAL_OPTIONS_NOT_MANDATORY,
  103       GAL_OPTIONS_NOT_SET
  104     },
  105     {
  106       "suffix",
  107       UI_KEY_SUFFIX,
  108       "STR",
  109       0,
  110       "Suffix (postfix) of cropped images.",
  111       GAL_OPTIONS_GROUP_OUTPUT,
  112       &p->suffix,
  113       GAL_TYPE_STRING,
  114       GAL_OPTIONS_RANGE_ANY,
  115       GAL_OPTIONS_MANDATORY,
  116       GAL_OPTIONS_NOT_SET
  117     },
  118 
  119 
  120 
  121 
  122 
  123     {
  124       0, 0, 0, 0,
  125       "Crop by center",
  126       UI_GROUP_CENTER_GENERAL
  127     },
  128     {
  129       "checkcenter",
  130       UI_KEY_CHECKCENTER,
  131       "FLT/INT",
  132       0,
  133       "Width (in pixels) of box at center to check.",
  134       UI_GROUP_CENTER_GENERAL,
  135       &p->incheckcenter,
  136       GAL_TYPE_STRING,
  137       GAL_OPTIONS_RANGE_ANY,
  138       GAL_OPTIONS_NOT_MANDATORY,
  139       GAL_OPTIONS_NOT_SET,
  140       gal_options_parse_csv_float64
  141     },
  142     {
  143       "width",
  144       UI_KEY_WIDTH,
  145       "FLT[,...]",
  146       0,
  147       "Width when crop is defined by its center.",
  148       UI_GROUP_CENTER_GENERAL,
  149       &p->width,
  150       GAL_TYPE_STRING,
  151       GAL_OPTIONS_RANGE_ANY,
  152       GAL_OPTIONS_NOT_MANDATORY,
  153       GAL_OPTIONS_NOT_SET,
  154       gal_options_parse_csv_float64
  155     },
  156     {
  157       "center",
  158       UI_KEY_CENTER,
  159       "FLT[,...]",
  160       0,
  161       "Central coordinates of a single crop.",
  162       UI_GROUP_CENTER_GENERAL,
  163       &p->center,
  164       GAL_TYPE_STRING,
  165       GAL_OPTIONS_RANGE_ANY,
  166       GAL_OPTIONS_NOT_MANDATORY,
  167       GAL_OPTIONS_NOT_SET,
  168       gal_options_parse_csv_float64
  169     },
  170 
  171 
  172 
  173 
  174 
  175 
  176 
  177     {
  178       0, 0, 0, 0,
  179       "Crop by center (when a catalog is given)",
  180       UI_GROUP_CENTER_CATALOG
  181     },
  182     {
  183       "catalog",
  184       UI_KEY_CATALOG,
  185       "STR",
  186       0,
  187       "Input catalog filename.",
  188       UI_GROUP_CENTER_CATALOG,
  189       &p->catname,
  190       GAL_TYPE_STRING,
  191       GAL_OPTIONS_RANGE_ANY,
  192       GAL_OPTIONS_NOT_MANDATORY,
  193       GAL_OPTIONS_NOT_SET
  194     },
  195     {
  196       "cathdu",
  197       UI_KEY_CATHDU,
  198       "STR/INT",
  199       0,
  200       "HDU of catalog, if it is a FITS table.",
  201       UI_GROUP_CENTER_CATALOG,
  202       &p->cathdu,
  203       GAL_TYPE_STRING,
  204       GAL_OPTIONS_RANGE_ANY,
  205       GAL_OPTIONS_NOT_MANDATORY,
  206       GAL_OPTIONS_NOT_SET
  207     },
  208     {
  209       "namecol",
  210       UI_KEY_NAMECOL,
  211       "STR/INT",
  212       0,
  213       "Column no./info of crop filename (no suffix).",
  214       UI_GROUP_CENTER_CATALOG,
  215       &p->namecol,
  216       GAL_TYPE_STRING,
  217       GAL_OPTIONS_RANGE_ANY,
  218       GAL_OPTIONS_NOT_MANDATORY,
  219       GAL_OPTIONS_NOT_SET
  220     },
  221     {
  222       "coordcol",
  223       UI_KEY_COORDCOL,
  224       "STR/INT",
  225       0,
  226       "Column no./info containing coordinates.",
  227       UI_GROUP_CENTER_CATALOG,
  228       &p->coordcol,
  229       GAL_TYPE_STRLL,
  230       GAL_OPTIONS_RANGE_ANY,
  231       GAL_OPTIONS_NOT_MANDATORY,
  232       GAL_OPTIONS_NOT_SET
  233     },
  234 
  235 
  236 
  237 
  238 
  239     {
  240       0, 0, 0, 0,
  241       "Crop by region",
  242       UI_GROUP_REGION
  243     },
  244     {
  245       "section",
  246       UI_KEY_SECTION,
  247       "STR",
  248       0,
  249       "Image section string specifying crop range.",
  250       UI_GROUP_REGION,
  251       &p->section,
  252       GAL_TYPE_STRING,
  253       GAL_OPTIONS_RANGE_ANY,
  254       GAL_OPTIONS_NOT_MANDATORY,
  255       GAL_OPTIONS_NOT_SET
  256     },
  257     {
  258       "polygon",
  259       UI_KEY_POLYGON,
  260       "STR",
  261       0,
  262       "Polygon vertices of region to crop, keep inside.",
  263       UI_GROUP_REGION,
  264       &p->polygon,
  265       GAL_TYPE_STRING,
  266       GAL_OPTIONS_RANGE_ANY,
  267       GAL_OPTIONS_NOT_MANDATORY,
  268       GAL_OPTIONS_NOT_SET
  269     },
  270     {
  271       "outpolygon",
  272       UI_KEY_OUTPOLYGON,
  273       0,
  274       0,
  275       "Keep the polygon's outside, mask the inside.",
  276       UI_GROUP_REGION,
  277       &p->outpolygon,
  278       GAL_OPTIONS_NO_ARG_TYPE,
  279       GAL_OPTIONS_RANGE_0_OR_1,
  280       GAL_OPTIONS_NOT_MANDATORY,
  281       GAL_OPTIONS_NOT_SET
  282     },
  283 
  284 
  285 
  286 
  287 
  288 
  289     /* Operating mode */
  290 
  291 
  292 
  293 
  294     {0}
  295   };
  296 
  297 
  298 
  299 
  300 
  301 /* Define the child argp structure. */
  302 struct argp
  303 gal_options_common_child = {gal_commonopts_options,
  304                             gal_options_common_argp_parse,
  305                             NULL, NULL, NULL, NULL, NULL};
  306 
  307 /* Use the child argp structure in list of children (only one for now). */
  308 struct argp_child
  309 children[]=
  310 {
  311   {&gal_options_common_child, 0, NULL, 0},
  312   {0, 0, 0, 0}
  313 };
  314 
  315 /* Set all the necessary argp parameters. */
  316 struct argp
  317 thisargp = {program_options, parse_opt, args_doc, doc, children, NULL, NULL};
  318 #endif