Changeset 21022
- Timestamp:
- Dec 16, 2008, 4:37:03 PM (17 years ago)
- Location:
- branches/pap_branch_20081216/psModules/src/camera
- Files:
-
- 8 edited
-
pmFPARead.h (modified) (2 diffs)
-
pmFPAWrite.c (modified) (6 diffs)
-
pmFPAWrite.h (modified) (2 diffs)
-
pmFPAfile.c (modified) (1 diff)
-
pmFPAfile.h (modified) (2 diffs)
-
pmFPAfileFitsIO.c (modified) (1 diff)
-
pmHDU.c (modified) (1 diff)
-
pmHDU.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_20081216/psModules/src/camera/pmFPARead.h
r18163 r21022 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $7 * @date $Date: 2008- 06-17 22:16:38$6 * @version $Revision: 1.15.36.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-12-17 02:37:03 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 245 245 const char *name ///< Specifies the extension name, and target in the analysis metadata 246 246 ); 247 247 248 /// @} 248 249 #endif -
branches/pap_branch_20081216/psModules/src/camera/pmFPAWrite.c
r19385 r21022 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, psU64 imageId, psU64 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 } -
branches/pap_branch_20081216/psModules/src/camera/pmFPAWrite.h
r18163 r21022 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $7 * @date $Date: 2008- 06-17 22:16:38$6 * @version $Revision: 1.11.36.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-12-17 02:37:03 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 165 165 ); 166 166 167 // XXX better name, please 168 bool pmFPAUpdateNames(pmFPA *fpa, pmChip *chip, pmCell *cell); 167 // Update the header before writing to be consistent 168 // 169 // XXX Would like a better name 170 bool pmFPAUpdateNames(pmFPA *fpa, ///< FPA 171 pmChip *chip, ///< Chip, or NULL 172 pmCell *cell, ///< Cell, or NULL 173 psU64 imageId, ///< Image identifier 174 psU64 sourceId ///< Source identifier 175 ); 169 176 170 177 /// @} -
branches/pap_branch_20081216/psModules/src/camera/pmFPAfile.c
r19307 r21022 98 98 99 99 file->save = false; 100 101 file->imageId = 0; 102 file->sourceId = 0; 100 103 101 104 return file; -
branches/pap_branch_20081216/psModules/src/camera/pmFPAfile.h
r19307 r21022 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $7 * @date $Date: 2008- 09-02 19:06:16$6 * @version $Revision: 1.33.14.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-12-17 02:37:03 $ 8 8 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 9 9 */ … … 106 106 psMetadata *format; // Camera format 107 107 psString formatName; // name of the camera format 108 109 psU64 imageId, sourceId; // Image and source identifiers 108 110 } pmFPAfile; 109 111 -
branches/pap_branch_20081216/psModules/src/camera/pmFPAfileFitsIO.c
r18601 r21022 178 178 pmChip *chip = pmFPAviewThisChip(view, fpa); // Chip of interest, or NULL 179 179 pmCell *cell = pmFPAviewThisCell(view, fpa); // Cell of interest, or NULL 180 if (!pmFPAUpdateNames(fpa, chip, cell )) {180 if (!pmFPAUpdateNames(fpa, chip, cell, file->imageId, file->sourceId)) { 181 181 psError(PS_ERR_UNKNOWN, false, "Unable to update names in header."); 182 182 return false; -
branches/pap_branch_20081216/psModules/src/camera/pmHDU.c
r19385 r21022 243 243 return hduWrite(hdu, hdu->weights, hdu->masks, maskVal, fits); 244 244 } 245 246 247 bool pmHDUWriteIdentifiers(pmHDU *hdu, psU64 imageId, psU64 sourceId) 248 { 249 PS_ASSERT_PTR_NON_NULL(hdu, false); 250 251 // XXX Get header keyword name from camera configuration 252 253 psMetadataAddU64(hdu->header, PS_LIST_TAIL, "IMAGEID", PS_META_REPLACE, "Image identifier", imageId); 254 psMetadataAddU64(hdu->header, PS_LIST_TAIL, "SOURCEID", PS_META_REPLACE, "Source identifier", sourceId); 255 return true; 256 } 257 258 bool pmHDUReadIdentifiers(psU64 *imageId, psU64 *sourceId, const pmHDU *hdu) 259 { 260 PS_ASSERT_PTR_NON_NULL(hdu, false); 261 262 // XXX Get header keyword name from camera configuration 263 264 bool imageOK, sourceOK; // Status of MD lookups 265 *imageId = psMetadataLookupU64(&imageOK, hdu->header, "IMAGEID"); 266 *sourceId = psMetadataLookupU64(&sourceOK, hdu->header, "SOURCEID"); 267 268 return imageOK && sourceOK; 269 } -
branches/pap_branch_20081216/psModules/src/camera/pmHDU.h
r19385 r21022 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $7 * @date $Date: 2008- 09-05 08:21:35$6 * @version $Revision: 1.9.14.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-12-17 02:37:03 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 31 31 psArray *weights; ///< The pixel data 32 32 psArray *masks; ///< The pixel data 33 } 34 pmHDU; 33 } pmHDU; 35 34 36 35 … … 85 84 ); 86 85 86 87 88 /// Read identifiers from FITS header 89 bool pmHDUReadIdentifiers(psU64 *imageId, ///< Image identifer, returned 90 psU64 *sourceId, ///< Source identifier, returned 91 const pmHDU *hdu ///< HDU from which to read 92 ); 93 94 /// Write identifiers to FITS header 95 bool pmHDUWriteIdentifiers(pmHDU *hdu, ///< HDU to which to write 96 psU64 imageId, ///< Image identifer 97 psU64 sourceId ///< Source identifier 98 ); 99 100 87 101 /// @} 88 102 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
