Changeset 41528 for trunk/ppSub/src/ppSubCamera.c
- Timestamp:
- Apr 3, 2021, 11:37:46 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubCamera.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubCamera.c
r38709 r41528 171 171 } 172 172 173 pmConfig *pmConfigMakeTemp (pmConfig *config) { 174 pmConfig *altconfig = pmConfigAlloc(); 175 176 // these are NULL on pmConfigAlloc 177 altconfig->user = psMemIncrRefCounter(config->user); // inherit from primary camera 178 altconfig->site = psMemIncrRefCounter(config->site); // inherit from primary camera 179 altconfig->system = psMemIncrRefCounter(config->system); // inherit from primary camera 180 181 psFree (altconfig->files); 182 altconfig->files = psMemIncrRefCounter(config->files); // inherit from primary camera 183 184 psFree (altconfig->arguments); 185 altconfig->arguments = psMemIncrRefCounter(config->arguments); // inherit from primary camera 186 187 psFree (altconfig->recipes); 188 altconfig->recipes = psMetadataCopy(NULL, config->recipes); // container for camera-specific recipe values (to be dropped) 189 190 return (altconfig); 191 } 173 192 174 193 bool ppSubCamera(ppSubData *data) … … 205 224 } 206 225 226 // Use a temporary config for the reference image, keeping the main user, site, 227 // system, files, arguments entries. This allows the reference image to be from a 228 // different camera than the input image. NOTE: there is no check that these two 229 // images match in terms of size, pixel scale, etc. That is up to the user. 230 231 pmConfig *refconfig = pmConfigMakeTemp(config); 232 207 233 // Reference image 208 pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);234 pmFPAfile *ref = defineInputFile(&success, refconfig, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE); 209 235 if (!success) { 210 236 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF"); … … 212 238 } 213 239 214 defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);240 defineInputFile(&success, refconfig, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK); 215 241 if (!success) { 216 242 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.MASK"); … … 218 244 } 219 245 220 pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);246 pmFPAfile *refVar = defineInputFile(&success, refconfig, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE); 221 247 if (!success) { 222 248 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.VARIANCE"); 223 249 return false; 224 250 } 225 226 defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 251 psFree (refconfig); 252 253 // The reference sources may not be from the same origin as the reference image, so 254 // use another temporary camera. 255 pmConfig *srcconfig = pmConfigMakeTemp(config); 256 257 defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 227 258 if (!success) { 228 259 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES"); 229 260 return false; 230 261 } 231 262 psFree (srcconfig); 263 232 264 // Now that the camera has been determined, we can read the recipe 233 265 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 266 234 267 if (!recipe) { 235 268 psError(PPSUB_ERR_CONFIG, false, "Unable to find recipe %s", PPSUB_RECIPE); … … 498 531 } 499 532 500 533 // Test function if needed: 534 bool pmConfigDumpSub (pmConfig *config, char *filename) { 535 536 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 537 psAssert (recipe, "oops"); 538 539 psMetadataConfigWrite (recipe, filename, NULL); 540 541 return true; 542 } 543
Note:
See TracChangeset
for help on using the changeset viewer.
