Changeset 13810 for trunk/psModules/src/config/pmConfig.c
- Timestamp:
- Jun 13, 2007, 4:03:29 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfig.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfig.c
r13704 r13810 4 4 * @author EAM (IfA) 5 5 * 6 * @version $Revision: 1.9 5$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-06- 08 00:31:50$6 * @version $Revision: 1.96 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-06-14 02:03:29 $ 8 8 * 9 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 293 293 } 294 294 295 // Read the calibrations for a camera 296 static bool cameraReadCalibrations(psMetadata *camera, // Camera for which to read the formats 297 const char *name // Name of the camera, for error messages 298 ) 299 { 300 assert(camera); 301 assert(name); 302 303 psMetadataItem *darkNorm = psMetadataLookup(camera, "DARK.NORM"); // The dark normalisation calibration 304 if (darkNorm) { 305 if (darkNorm->type == PS_DATA_STRING) { 306 const char *darkNormName = darkNorm->data.str; // The file name 307 psTrace("config", 2, "Reading %s dark normalisation: %s\n", name, darkNormName); 308 psMetadata *new = NULL; // New metadata 309 if (!pmConfigFileRead(&new, darkNormName, "Dark normalisation")) { 310 psError(PM_ERR_CONFIG, false, "Trouble reading reading %s dark normalisation %s --- " 311 "ignored.\n", name, darkNormName); 312 psFree(new); 313 return false; 314 } 315 316 // Muck around under the hood to replace the filename with the metadata; 317 // don't try this at home, kids 318 darkNorm->type = PS_DATA_METADATA; 319 psFree(darkNorm->data.str); 320 darkNorm->data.md = new; 321 } else if (darkNorm->type != PS_DATA_METADATA) { 322 psWarning("DARK.NORM in camera %s is not of type STR or METADATA (%x)", name, darkNorm->type); 323 } 324 } else { 325 // Add a dummy entry 326 psPolynomial1D *poly = psPolynomial1DAlloc(1, PS_POLYNOMIAL_ORD); // Dummy polynomial 327 poly->coeff[0] = 0.0; 328 poly->coeff[1] = 1.0; 329 psMetadata *polyMD = psMetadataAlloc(); // Container for the polynomial 330 (void)psPolynomial1DtoMetadata(polyMD, poly, "_DEFAULT"); // Metadata to insert 331 psFree(poly); 332 psMetadataAddMetadata(camera, PS_LIST_TAIL, "DARK.NORM", 0, "Dark normalisation polynomial", 333 polyMD); 334 psMetadataAddStr(camera, PS_LIST_TAIL, "DARK.NORM.KEY", 0, "Key for dark normalisation", "_DEFAULT"); 335 psFree(polyMD); 336 } 337 338 return true; 339 } 295 340 296 341 pmConfig *pmConfigRead(int *argc, char **argv, const char *defaultRecipe) … … 530 575 } 531 576 577 // Read in any camera-specific calibrations 578 if (!cameraReadCalibrations(config->camera, cameraFile)) { 579 psError(PS_ERR_UNKNOWN, false, 580 "Unable to read calibrations within camera configuration %s.\n", 581 cameraFile); 582 psFree(config); 583 return NULL; 584 } 585 532 586 psMetadataAddMetadata(cameras, PS_LIST_HEAD, cameraFile, PS_META_REPLACE, 533 587 "Camera specified on command line", config->camera);
Note:
See TracChangeset
for help on using the changeset viewer.
