Changeset 8480 for trunk/pois/src/poisParseConfig.c
- Timestamp:
- Aug 22, 2006, 2:48:04 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/pois/src/poisParseConfig.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pois/src/poisParseConfig.c
r5717 r8480 1 // Copyright (C) 2006 Paul A. Price (price@ifa.hawaii.edu) 2 // 3 // This program is free software; you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation; either version 2 of the License, or 6 // (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with this program; if not, write to the Free Software 15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 1 17 #include <stdio.h> 2 18 #include <unistd.h> … … 7 23 { 8 24 fprintf (stderr, "POIS: Pan-STARRS (or Pricey's) Optimal Image Subtraction\n" 9 "Usage: pois [-h] [-v] [-k X Y] [-t T] [-s S1 S2] [-b B1 B2] [-B BG] [-o N] [-n NSTAMPS] [-S STAMPS] [-i ITER] [-r REJ] [-m] REF IN OUT\n"10 "where\n"11 "\t-h Help (this info)\n"12 "\t-v Increase verbosity level\n"13 "\t-k X Y Kernel half-size in x and y (5)\n"14 "\t-t T Threshold for stamps on reference image (0)\n"15 "\t-s S1 S2 Saturation level for reference (S1) and input (S2) (50000)\n"16 "\t-b B1 B2 Bad level for both images (0)\n"17 "\t-B BG Level to add to background to get above zero (0)\n"18 "\t-o ORDER Order of spatial variations in the kernel (0)\n"19 "\t-n NSTAMPS Number of stamps in each dimension (5)\n"20 "\t-S STAMPS File from which to read stamps\n"21 "\t-R Reverse the sense of the subtraction (REF - IN)\n"22 "\t-i ITER Number of rejection iterations (10)\n"23 "\t-r REJ Rejection level in standard deviations (2.5)\n"24 "\t-m Output mask frame (OUT.mask)\n"25 "\tREF Reference image\n"26 "\tIN Input image (to be matched to REF)\n"27 "\tOUT Output image\n"28 );25 "Usage: pois [-h] [-v] [-k X Y] [-t T] [-s S1 S2] [-b B1 B2] [-B BG] [-o N] [-n NSTAMPS] [-S STAMPS] [-i ITER] [-r REJ] [-m] REF IN OUT\n" 26 "where\n" 27 "\t-h Help (this info)\n" 28 "\t-v Increase verbosity level\n" 29 "\t-k X Y Kernel half-size in x and y (5)\n" 30 "\t-t T Threshold for stamps on reference image (0)\n" 31 "\t-s S1 S2 Saturation level for reference (S1) and input (S2) (50000)\n" 32 "\t-b B1 B2 Bad level for both images (0)\n" 33 "\t-B BG Level to add to background to get above zero (0)\n" 34 "\t-o ORDER Order of spatial variations in the kernel (0)\n" 35 "\t-n NSTAMPS Number of stamps in each dimension (5)\n" 36 "\t-S STAMPS File from which to read stamps\n" 37 "\t-R Reverse the sense of the subtraction (REF - IN)\n" 38 "\t-i ITER Number of rejection iterations (10)\n" 39 "\t-r REJ Rejection level in standard deviations (2.5)\n" 40 "\t-m Output mask frame (OUT.mask)\n" 41 "\tREF Reference image\n" 42 "\tIN Input image (to be matched to REF)\n" 43 "\tOUT Output image\n" 44 ); 29 45 } 30 46 31 47 poisConfig *poisParseConfig(int argc, // Number of command-line arguments 32 char **argv // Command-line arguments48 char **argv // Command-line arguments 33 49 ) 34 50 { 35 poisConfig *config; // Configuration values51 poisConfig *config; // Configuration values 36 52 37 53 /* Variables for getopt */ … … 68 84 while ((opt = getopt(argc, argv, "hvRmk:f:q:t:s:o:b:B:n:i:r:p:S:")) != -1) { 69 85 switch (opt) { 70 case 'h':71 help();72 exit(EXIT_SUCCESS);73 case 'v':86 case 'h': 87 help(); 88 exit(EXIT_SUCCESS); 89 case 'v': 74 90 config->verbose++; 75 91 break; 76 case 'k':92 case 'k': 77 93 if ((sscanf(argv[optind-1], "%d", &config->xKernel) != 1) || 78 94 (sscanf(argv[optind++], "%d", &config->yKernel) != 1)) { … … 84 100 exit(EXIT_FAILURE); 85 101 } 86 break;87 case 'f':88 if (sscanf(optarg, "%d", &config->footprint) != 1) {89 help();90 exit(EXIT_FAILURE); 91 }92 break;93 case 't':94 if (sscanf(optarg, "%f", &config->threshold) != 1) {95 help();96 exit(EXIT_FAILURE); 97 }98 break;99 case 's':102 break; 103 case 'f': 104 if (sscanf(optarg, "%d", &config->footprint) != 1) { 105 help(); 106 exit(EXIT_FAILURE); 107 } 108 break; 109 case 't': 110 if (sscanf(optarg, "%f", &config->threshold) != 1) { 111 help(); 112 exit(EXIT_FAILURE); 113 } 114 break; 115 case 's': 100 116 if ((sscanf(argv[optind-1], "%f", &config->refSat) != 1) || 101 117 (sscanf(argv[optind++], "%f", &config->inSat) != 1)) { … … 107 123 exit(EXIT_FAILURE); 108 124 } 109 break;110 case 'o':111 if (sscanf(optarg, "%d", &config->spatialOrder) != 1) {112 help();113 exit(EXIT_FAILURE); 114 }115 break;116 case 'b':125 break; 126 case 'o': 127 if (sscanf(optarg, "%d", &config->spatialOrder) != 1) { 128 help(); 129 exit(EXIT_FAILURE); 130 } 131 break; 132 case 'b': 117 133 if ((sscanf(argv[optind-1], "%f", &config->refBad) != 1) || 118 134 (sscanf(argv[optind++], "%f", &config->inBad) != 1)) { … … 124 140 exit(EXIT_FAILURE); 125 141 } 126 break;127 case 'B':128 if (sscanf(optarg, "%f", &config->background) != 1) {129 help();130 exit(EXIT_FAILURE); 131 }132 break;133 case 'n':142 break; 143 case 'B': 144 if (sscanf(optarg, "%f", &config->background) != 1) { 145 help(); 146 exit(EXIT_FAILURE); 147 } 148 break; 149 case 'n': 134 150 if (sscanf(argv[optind-1], "%d", &config->nsx) != 1) { 135 151 help(); 136 152 exit(EXIT_FAILURE); 137 153 } 138 config->nsy = config->nsx;139 break;140 case 'i':154 config->nsy = config->nsx; 155 break; 156 case 'i': 141 157 if (sscanf(argv[optind-1], "%d", &config->numIter) != 1) { 142 158 help(); 143 159 exit(EXIT_FAILURE); 144 160 } 145 break;146 case 'r':161 break; 162 case 'r': 147 163 if (sscanf(argv[optind-1], "%f", &config->sigmaRej) != 1) { 148 164 help(); 149 165 exit(EXIT_FAILURE); 150 166 } 151 break;152 case 'p':167 break; 168 case 'p': 153 169 if (sscanf(argv[optind-1], "%f", &config->penalty) != 1) { 154 170 help(); 155 171 exit(EXIT_FAILURE); 156 172 } 157 break;158 case 'S':159 config->stampFile = argv[optind-1];160 config->threshold = -INFINITY;161 break;162 case 'R':163 config->reverse = true;164 break;165 case 'm':173 break; 174 case 'S': 175 config->stampFile = argv[optind-1]; 176 config->threshold = -INFINITY; 177 break; 178 case 'R': 179 config->reverse = true; 180 break; 181 case 'm': 166 182 config->mask = true; 167 183 break; 168 default:169 help();170 }184 default: 185 help(); 186 } 171 187 } 172 188
Note:
See TracChangeset
for help on using the changeset viewer.
