Changeset 21279 for trunk/psModules/src/camera/pmFPAWrite.c
- Timestamp:
- Feb 3, 2009, 4:39:36 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAWrite.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAWrite.c
r19385 r21279 107 107 if (writeBlank || writeImage) { 108 108 109 pmFPAUpdateNames(cell->parent->parent, cell->parent, cell);110 109 pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS | 111 110 PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE; … … 157 156 158 157 if (writeBlank || writeImage) { 159 pmFPAUpdateNames(chip->parent, chip, NULL);160 158 pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS | 161 159 PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE; … … 221 219 222 220 if (writeBlank || writeImage) { 223 pmFPAUpdateNames(fpa, NULL, NULL);224 221 pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS | 225 222 PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE; … … 255 252 256 253 // Update the FPA.OBS, CHIP.NAME and CELL.NAME in the FITS header, if required 257 bool pmFPAUpdateNames(pmFPA *fpa, pmChip *chip, pmCell *cell) 258 { 259 pmHDU *hdu = pmHDUGetHighest(fpa, chip, cell); // Highest HDU, i.e., the PHU 260 if (!hdu) { 254 bool pmFPAUpdateNames(pmFPA *fpa, pmChip *chip, pmCell *cell, psS64 imageId, psS64 sourceId) 255 { 256 pmHDU *hduHigh = pmHDUGetHighest(fpa, chip, cell); // Highest HDU, i.e., the PHU 257 if (!hduHigh) { 258 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find PHU.\n"); 259 return false; 260 } 261 if (!hduHigh->header) { 262 hduHigh->header = psMetadataAlloc(); 263 } 264 if (!pmHDUWriteIdentifiers(hduHigh, imageId, sourceId)) { 265 psError(PS_ERR_UNKNOWN, false, "Unable to write identifiers to header."); 266 return false; 267 } 268 269 pmHDU *hduLow = pmHDUGetLowest(fpa, chip, cell); // Lowest HDU, i.e., the extension 270 if (!hduLow) { 261 271 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find HDU.\n"); 262 272 return false; 263 273 } 264 if (!hdu->header) { 265 hdu->header = psMetadataAlloc(); 266 } 274 if (!hduLow->header) { 275 hduLow->header = psMetadataAlloc(); 276 } 277 if (hduLow != hduHigh && !pmHDUWriteIdentifiers(hduLow, imageId, sourceId)) { 278 psError(PS_ERR_UNKNOWN, false, "Unable to write identifiers to header."); 279 return false; 280 } 281 267 282 bool mdok; // Status of MD lookup 268 psMetadata *fileData = psMetadataLookupMetadata(&mdok, hdu ->format, "FILE"); // File information283 psMetadata *fileData = psMetadataLookupMetadata(&mdok, hduHigh->format, "FILE"); // File information 269 284 if (!mdok || !fileData) { 270 285 psError(PS_ERR_UNKNOWN, true, "Unable to find FILE information in camera format.\n"); … … 275 290 if (mdok && fpaObsHdr && strlen(fpaObsHdr) > 0) { 276 291 const char *fpaObs = psMetadataLookupStr(NULL, fpa->concepts, "FPA.OBS"); 277 psMetadataAddStr(hdu ->header, PS_LIST_TAIL, fpaObsHdr, PS_META_REPLACE,292 psMetadataAddStr(hduHigh->header, PS_LIST_TAIL, fpaObsHdr, PS_META_REPLACE, 278 293 "Observation identifier", fpaObs); 279 294 } … … 298 313 } 299 314 300 psMetadataAddStr(hdu->header, PS_LIST_TAIL, contentKey, PS_META_REPLACE, "Content of file", content); 315 psMetadataAddStr(hduHigh->header, PS_LIST_TAIL, contentKey, PS_META_REPLACE, 316 "Content of file", content); 301 317 psFree(content); // Drop reference 302 318 }
Note:
See TracChangeset
for help on using the changeset viewer.
