Changeset 24853
- Timestamp:
- Jul 20, 2009, 8:27:16 AM (17 years ago)
- Location:
- trunk/magic/remove/src
- Files:
-
- 4 edited
-
streaksio.c (modified) (3 diffs)
-
streaksio.h (modified) (1 diff)
-
streaksrelease.c (modified) (1 diff)
-
streaksremove.c (modified) (1 diff)
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 } -
trunk/magic/remove/src/streaksio.h
r24556 r24853 17 17 void setupImageRefs(sFile *out, sFile *recoveryOut, sFile *in, int extnum, bool exciseAll); 18 18 void strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask); 19 void copyExtraExtensions(streakFiles *sfiles); 19 20 20 21 void writeImage(sFile *sfile, psString extname, int extnum); -
trunk/magic/remove/src/streaksrelease.c
r24381 r24853 67 67 printf("time to process component %d: %f\n", sfiles->extnum, psTimerClear("PROCESS_COMPONENT")); 68 68 } while (streakFilesNextExtension(sfiles)); 69 70 // check the weight and mask files for extra extensions that might be in files 71 // (covariance matrix for example) 72 copyExtraExtensions(sfiles); 73 74 69 75 70 76 psTimerStart("CLOSE_IMAGES"); -
trunk/magic/remove/src/streaksremove.c
r24716 r24853 198 198 } while (streakFilesNextExtension(sfiles)); 199 199 200 200 201 psFree(streaks); 201 202 202 203 psLogMsg("streaksremove", PS_LOG_INFO, "pixels: %ld streak pixels: %ld %4.2f%%\n", totalPixels, totalStreakPixels, 100. * totalStreakPixels / totalPixels); 204 205 // check the weight and mask files for extra extensions that might be in files 206 // (covariance matrix for example) 207 copyExtraExtensions(sfiles); 203 208 204 209 // all done close the files. This is where the files are written so it can take a long time.
Note:
See TracChangeset
for help on using the changeset viewer.
