Changeset 42279 for trunk/ppSub/src/ppSubCamera.c
- Timestamp:
- Sep 4, 2022, 2:07:06 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubCamera.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubCamera.c
r42096 r42279 177 177 altconfig->user = psMemIncrRefCounter(config->user); // inherit from primary camera 178 178 altconfig->site = psMemIncrRefCounter(config->site); // inherit from primary camera 179 altconfig->system = psMemIncrRefCounter(config->system); // inherit from primary camera 179 180 psFree (altconfig->system); 181 altconfig->system = psMetadataCopy(NULL, config->system); // container for camera-specific recipe values (to be dropped) 180 182 181 183 psFree (altconfig->files); … … 188 190 altconfig->recipes = psMetadataCopy(NULL, config->recipes); // container for camera-specific recipe values (to be dropped) 189 191 190 # if (0) 191 // XXX ppStack seems to work without removing PSCAMERA 192 // remove PSCAMERA entries from *-SKYCELL cameras 193 // XXX make this optional to force matching cameras if desired? 192 // remove PSCAMERA entries from *-SKYCELL cameras. This allows skycell images from 193 // one camera to match those of another camera. XXX Make this optional to force 194 // matching cameras if desired? 194 195 bool mdok = false; 195 196 psMetadata *cameras = psMetadataLookupMetadata(&mdok, altconfig->system, "CAMERAS"); … … 229 230 psMetadataRemoveKey (rule, "PSCAMERA"); // allow any camera skycell to match 230 231 } 231 # endif 232 psFree (camerasIter); 232 233 233 234 return (altconfig); 235 } 236 237 bool ppSubCopyPSCamera (pmFPAfile *tgt, pmFPAfile *src) { 238 239 bool success; 240 psMetadata *ruleSrc = psMetadataLookupMetadata(&success, src->format, "RULE"); // one true format for skycells 241 psAssert (ruleSrc, "missing RULE in src->format"); 242 243 psString pscameraSrc = psMetadataLookupStr(&success, ruleSrc, "PSCAMERA"); // one true format for skycells 244 psAssert (pscameraSrc, "missing PSCAMERA in src file"); 245 246 psMetadata *ruleTgt = psMetadataLookupMetadata(&success, tgt->format, "RULE"); // one true format for skycells 247 psAssert (ruleTgt, "missing RULE in tgt->format"); 248 249 psMetadataAddStr (ruleTgt, PS_LIST_TAIL, "PSCAMERA", PS_META_REPLACE, "", pscameraSrc); 250 return true; 234 251 } 235 252 … … 271 288 // different camera than the input image. NOTE: there is no check that these two 272 289 // images match in terms of size, pixel scale, etc. That is up to the user. 290 // The temporary config structure has PSCAMERA entries removed from the SKYCELL rules 291 // to allow subtraction between cameras. 273 292 274 293 pmConfig *refconfig = pmConfigMakeTemp(config); 275 294 276 # if (0)277 // EAM TEST: can we bind the ref to the input to force the right skycell format?278 // Reference image279 pmFPAfile *ref = defineInputFile(&success, config, input, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);280 if (!success) {281 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");282 return false;283 }284 # else285 295 // Reference image 286 296 pmFPAfile *ref = defineInputFile(&success, refconfig, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE); 287 297 if (!success) { 288 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF"); 289 return false; 290 } 291 # endif 292 298 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF"); 299 return false; 300 } 301 // Reference mask 293 302 defineInputFile(&success, refconfig, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK); 294 303 if (!success) { … … 296 305 return false; 297 306 } 298 307 // Reference variance 299 308 pmFPAfile *refVar = defineInputFile(&success, refconfig, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE); 300 309 if (!success) { … … 302 311 return false; 303 312 } 313 // copy ref->format(RULE) PSCAMERA from input->format(RULE) 314 ppSubCopyPSCamera (ref, input); 304 315 psFree (refconfig); 305 316 … … 308 319 pmConfig *srcconfig = pmConfigMakeTemp(config); 309 320 310 defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 311 if (!success) { 312 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES"); 313 return false; 314 } 321 // Sources input file (CMF) 322 pmFPAfile *src = defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 323 if (!success) { 324 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES"); 325 return false; 326 } 327 // XXX do we need to copy the PSCAMERA across to src? 328 ppSubCopyPSCamera (src, input); 315 329 psFree (srcconfig); 316 330
Note:
See TracChangeset
for help on using the changeset viewer.
