"Fossies" - the Fresh Open Source Software Archive

Member "gnuastro-0.8/bin/crop/main.h" (27 Dec 2018, 5411 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 "main.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 MAIN_H
   24 #define MAIN_H
   25 
   26 /* Include necessary headers */
   27 #include <gnuastro/data.h>
   28 
   29 #include <gnuastro-internal/options.h>
   30 
   31 /* Progarm names.  */
   32 #define PROGRAM_NAME   "Crop"     /* Program full name.       */
   33 #define PROGRAM_EXEC   "astcrop"    /* Program executable name. */
   34 #define PROGRAM_STRING PROGRAM_NAME" (" PACKAGE_NAME ") " PACKAGE_VERSION
   35 
   36 
   37 
   38 
   39 
   40 /* Macros */
   41 #define LOGFILENAME             PROGRAM_EXEC".log"
   42 #define FILENAME_BUFFER_IN_VERB 30
   43 #define MAXDIM                  2
   44 
   45 
   46 /* Modes to interpret coordinates. */
   47 enum crop_modes
   48 {
   49   IMGCROP_MODE_INVALID,         /* For sanity checks.     */
   50 
   51   IMGCROP_MODE_IMG,             /* Use image coordinates. */
   52   IMGCROP_MODE_WCS,             /* Use WCS coordinates.   */
   53 };
   54 
   55 
   56 
   57 
   58 /* The sides of the image keep the celestial coordinates of the four
   59    sides of this image. With respect to the pixels they are. */
   60 struct inputimgs
   61 {
   62   char             *name;  /* File name of input image.                   */
   63   size_t            ndim;  /* Number of dimensions of this image.         */
   64   size_t          *dsize;  /* Size of the image.                          */
   65   int               nwcs;  /* Number of WCS in each input image.          */
   66   struct wcsprm     *wcs;  /* WCS structure of each input image.          */
   67   char           *wcstxt;  /* Text output of each WCS.                    */
   68   int           nwcskeys;  /* Number of keywords in the header WCS.       */
   69   double      corners[8];  /* RA and Dec of this image corners (within).  */
   70   double        sized[2];  /* Width and height of image in degrees.       */
   71   double  equatorcorr[2];  /* If image crosses the equator, see wcsmode.c.*/
   72 };
   73 
   74 
   75 
   76 
   77 
   78 /* Main program parameters: */
   79 struct cropparams
   80 {
   81   /* Directly from command-line */
   82   struct gal_options_common_params cp;  /* Common parameters.             */
   83   gal_list_str_t       *inputs;  /* All input FITS files.                 */
   84   size_t             hstartwcs;  /* Header keyword No. to start read WCS. */
   85   size_t               hendwcs;  /* Header keyword No. to end read WCS.   */
   86   int                     mode;  /* Image or WCS mode.                    */
   87   uint8_t       zeroisnotblank;  /* ==1: In float or double, keep 0.0.    */
   88   uint8_t              noblank;  /* ==1: no blank (out of image) pixels.  */
   89   char                 *suffix;  /* Ending of output file name.           */
   90   gal_data_t    *incheckcenter;  /* Value given to `--checkcenter'.       */
   91   gal_data_t           *center;  /* Center position of crop.              */
   92   gal_data_t            *width;  /* Width of crop when defined by center. */
   93   char                *catname;  /* Name of input catalog.                */
   94   char                 *cathdu;  /* HDU of catalog if its a FITS file.    */
   95   char                *namecol;  /* Filename (without suffix) of crop col.*/
   96   gal_list_str_t     *coordcol;  /* Column in catalog with coordinates.   */
   97   char                *section;  /* Section string.                       */
   98   char                *polygon;  /* Input string of polygon vertices.     */
   99   uint8_t           outpolygon;  /* ==1: Keep the inner polygon region.   */
  100 
  101   /* Internal */
  102   size_t                 numin;  /* Number of input images.               */
  103   size_t                numout;  /* Number of output images.              */
  104   double        **centercoords;  /* The center coordinates.               */
  105   size_t           checkcenter;  /* width of a box to check for zeros     */
  106   char                  **name;  /* filename of crop in row.              */
  107   double             *wpolygon;  /* Array of WCS polygon vertices.        */
  108   double             *ipolygon;  /* Array of image polygon vertices.      */
  109   size_t             nvertices;  /* Number of polygon vertices.           */
  110   long               iwidth[2];  /* Image mode width (in pixels).         */
  111   double             *pixscale;  /* Resolution in each dimension.         */
  112   time_t               rawtime;  /* Starting time of the program.         */
  113   int            outnameisfile;  /* Output filename is a directory.       */
  114   int                     type;  /* Type of output(s).                    */
  115   void                 *bitnul;  /* Null value for this data-type.        */
  116   struct inputimgs       *imgs;  /* WCS and size information for inputs.  */
  117   gal_data_t              *log;  /* Log file contents.                    */
  118 };
  119 
  120 #endif