Changeset 10081 for trunk/psModules/src/camera/pmHDU.c
- Timestamp:
- Nov 18, 2006, 1:43:28 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmHDU.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmHDU.c
r9983 r10081 85 85 if (!hdu->header) { 86 86 psTrace("psModules.camera", 5, "Reading the header...\n"); 87 hdu->header = psFitsReadHeader( NULL, fits);87 hdu->header = psFitsReadHeader(hdu->header, fits); 88 88 if (! hdu->header) { 89 89 psError(PS_ERR_IO, false, "Unable to read header for extension %s\n", hdu->extname); … … 95 95 } 96 96 97 // Read an HDU from a FITS file 97 98 // XXX: Add a region specifier? 98 bool pmHDURead(pmHDU *hdu, psFits *fits) 99 { 100 PS_ASSERT_PTR_NON_NULL(hdu, false); 101 PS_ASSERT_PTR_NON_NULL(fits, false); 99 bool hduRead(pmHDU *hdu, // HDU to write 100 psArray **images, // Images into which to read 101 psFits *fits // FITS file to read 102 ) 103 { 104 assert(hdu); 105 assert(images); 106 assert(fits); 102 107 103 108 // Read the header; includes the move … … 111 116 } 112 117 113 if ( hdu->images) {118 if (*images) { 114 119 psLogMsg(__func__, PS_LOG_WARN, "HDU %s has already been read --- overwriting.\n", hdu->extname); 115 psFree( hdu->images);// Blow away anything existing120 psFree(*images); // Blow away anything existing 116 121 } 117 122 psTrace("psModules.camera", 5, "Reading the pixels...\n"); 118 hdu->images = psFitsReadImageCube(fits, psRegionSet(0,0,0,0));119 if (! hdu->images) {123 *images = psFitsReadImageCube(fits, psRegionSet(0,0,0,0)); 124 if (!*images) { 120 125 psError(PS_ERR_IO, false, "Unable to read pixels for extension %s\n", hdu->extname); 121 126 return false; … … 124 129 } 125 130 131 bool pmHDURead(pmHDU *hdu, psFits *fits) 132 { 133 PS_ASSERT_PTR_NON_NULL(hdu, false); 134 PS_ASSERT_PTR_NON_NULL(fits, false); 135 136 return hduRead(hdu, &hdu->images, fits); 137 } 138 139 bool pmHDUReadMask(pmHDU *hdu, psFits *fits) 140 { 141 PS_ASSERT_PTR_NON_NULL(hdu, false); 142 PS_ASSERT_PTR_NON_NULL(fits, false); 143 144 return hduRead(hdu, &hdu->masks, fits); 145 } 146 147 bool pmHDUReadWeight(pmHDU *hdu, psFits *fits) 148 { 149 PS_ASSERT_PTR_NON_NULL(hdu, false); 150 PS_ASSERT_PTR_NON_NULL(fits, false); 151 152 return hduRead(hdu, &hdu->weights, fits); 153 } 154 126 155 // Write an HDU to a FITS file 127 bool hduWrite(pmHDU *hdu,// HDU to write128 psArray *images,// Images to write129 psFits *fits// FITS file to which to write130 )156 static bool hduWrite(pmHDU *hdu, // HDU to write 157 psArray *images, // Images to write 158 psFits *fits // FITS file to which to write 159 ) 131 160 { 132 161 assert(hdu); … … 182 211 } 183 212 213 bool pmHDUWriteWeight(pmHDU *hdu, psFits *fits) 214 { 215 PS_ASSERT_PTR_NON_NULL(hdu, false); 216 PS_ASSERT_PTR_NON_NULL(fits, false); 217 218 return hduWrite(hdu, hdu->weights, fits); 219 }
Note:
See TracChangeset
for help on using the changeset viewer.
