Changeset 24853 for trunk/magic/remove/src/streaksio.c
- Timestamp:
- Jul 20, 2009, 8:27:16 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/magic/remove/src/streaksio.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/streaksio.c
r24728 r24853 9 9 10 10 static nebServer *ourNebServer = NULL; 11 12 // Assumptions about the file structure of non-raw files 13 // The 'image' for each file (image, mask weight) is contained in the first 14 // extension. 15 11 16 12 17 // open the files required for streaks procesing. … … 285 290 // copy header from fpu 286 291 sfile->header = (psMetadata*) psMemIncrRefCounter(sfile->pmfile->fpa->hdu->header); 292 293 sfile->nHDU = psFitsGetSize(sfile->pmfile->fits); 287 294 288 295 return sfile; … … 1198 1205 *maskMask = ~convPoor; 1199 1206 } 1207 1208 static void 1209 doCopyExtraExtensions(streakFiles *sf, sFile *in, sFile *out) 1210 { 1211 for (int extnum = sf->extnum; extnum < in->nHDU; extnum++) { 1212 moveExt(in, extnum); 1213 readImage(in, extnum, sf->stage, false); 1214 1215 if (SFILE_IS_IMAGE(in)) { 1216 // Turn off compression (code adapted from pmFPAWrite) 1217 #ifdef SAVE_AND_RESTORE_COMPRESSION 1218 int bitpix = out->fits->options ? out->fits->options->bitpix : 0; // Desired bits per pixel 1219 psFitsCompression *compress = psFitsCompressionGet(out->fits); // Current compression options 1220 #endif 1221 if (!psFitsSetCompression(out->fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) { 1222 psError(PM_ERR_UNKNOWN, false, "failed to turn off compression for extension %d\n", extnum); 1223 streaksExit("", PS_EXIT_UNKNOWN_ERROR); 1224 } 1225 #ifdef SAVE_AND_RESTORE_COMPRESSION 1226 if (out->fits->options) { 1227 out->fits->options->bitpix = 0; 1228 } 1229 if (!psFitsWriteImage(out->fits, in->header, in->image, 0, in->extname)) { 1230 psError(PM_ERR_UNKNOWN, false, "failed to write image for extension %d\n", extnum); 1231 streaksExit("", PS_EXIT_UNKNOWN_ERROR); 1232 } 1233 if (out->fits->options) { 1234 out->fits->options->bitpix = bitpix; 1235 } 1236 if (!psFitsCompressionApply(out->fits, compress)) { 1237 psError(PM_ERR_UNKNOWN, false, "failed to rest compression image for extension %d\n", extnum); 1238 streaksExit("", PS_EXIT_UNKNOWN_ERROR); 1239 } 1240 #endif 1241 } else { 1242 copyTable(out, in, extnum); 1243 } 1244 } 1245 } 1246 1247 void 1248 copyExtraExtensions(streakFiles *sf) 1249 { 1250 // XXX: Bad assumption, the begining of the mask and weight files have the same structure as the image 1251 // So we are currently at the image portion 1252 sf->extnum = sf->inImage->nHDU; 1253 1254 if (sf->inWeight && sf->outWeight) { 1255 doCopyExtraExtensions(sf, sf->inWeight, sf->outWeight); 1256 } 1257 if (sf->inMask && sf->outMask) { 1258 doCopyExtraExtensions(sf, sf->inMask, sf->outMask); 1259 } 1260 if (sf->inChMask && sf->outChMask) { 1261 doCopyExtraExtensions(sf, sf->inChMask, sf->outChMask); 1262 } 1263 }
Note:
See TracChangeset
for help on using the changeset viewer.
