/* Read PGM,JPG,PGM,PPM,PBM images as float images. */ /* Last edited on 2016-04-10 18:42:03 by stolfilocal */ #ifndef dsm_region_H #define dsm_region_H #define _GNU_SOURCE #include #include #include #include typedef struct dsm_region_t { int dx; /* Columns to skip. */ int dy; /* Rows to skip. */ int nx; /* Columns to take. */ int ny; /* Rows to take. */ } dsm_region_t; /* Data for one region. */ /* COMMAND LINE PARSING */ void dsm_region_arg_parse(argparser_t *pp, const char *keyword, int nrmin, int nrmax, int *nrP, dsm_region_t **listP); /* Parses the command line for occurrences of the given {keyword}. for each occurence found, parses the next 4 arguments as a rectangular region specification, as described by {dsm_region_arg_INFO} below. Returns in {*nrP} the number of occurrences found, and in {*listP} the address of a newly allocated vector with the corresponding regions. Fails if there are less than {nrmin} or more than {nrmax} occurrences, or if any region extends outside the domain of the largest allowed images. */ #define dsm_region_arg_HELP \ "{DX} {DY} {NX} NY}" #define dsm_region_arg_INFO \ "The region" \ " starts {DX} columns to the right and {DY} rows below" \ " the top left corner pixel, and has {NX} columns" \ " and {NY} rows." #endif