- Timestamp:
- Feb 11, 2011, 4:29:48 PM (15 years ago)
- Location:
- branches/czw_branch/20101203
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
magic/remove/src/streaksremove.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20101203
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/magic/remove/src/streaksremove.c
r29806 r30586 93 93 // Raw files have a phu and multiple extensions, one per chip 94 94 // Since this is a raw file, copy it's PHU to output files 95 copyPHU(sfiles, true );95 copyPHU(sfiles, true, true); 96 96 97 97 // advance to the first image extension … … 275 275 psLogMsg("streaksremove", PS_LOG_INFO, "time to run streaksremove: %f\n", total_time); 276 276 277 if (sfiles->statsFile) { 278 const char *statsMDC = psMetadataConfigFormat(sfiles->stats); 279 if (!statsMDC || strlen(statsMDC) == 0) { 280 psError(PS_ERR_IO, false, "Unable to get statistics MDC file.\n"); 281 } else { 282 fprintf(sfiles->statsFile, "%s", statsMDC); 283 psFree(statsMDC); 284 fclose(sfiles->statsFile); 285 sfiles->statsFile = NULL; 286 psFree(sfiles->stats); 287 sfiles->stats = NULL; 288 } 289 } 277 psString statsFileName= psMetadataLookupStr(&status, config->arguments, "STATS"); 278 279 if (statsFileName) { 280 // Write out 281 psString resolved = pmConfigConvertFilename(statsFileName, config, true, true); // Resolved filename 282 if (!resolved) { 283 psError(psErrorCodeLast(), false, "Unable to resolve statistics file name"); 284 return false; 285 } 286 if (!psMetadataConfigWrite(sfiles->stats, resolved, NULL)) { 287 psError(psErrorCodeLast(), false, "Unable to serialize stats metadata.\n"); 288 psFree(resolved); 289 return false; 290 } 291 psFree(resolved); 292 } 293 290 294 // all done. Clean up to look for memory leaks. 291 295 … … 613 617 addRecoveryKeyword(sf->recImage->header); 614 618 } 615 addDestreakKeyword(sf->outImage->header );619 addDestreakKeyword(sf->outImage->header, true); 616 620 617 621 if (!SFILE_IS_IMAGE(sf->inImage)) { … … 639 643 addRecoveryKeyword(sf->recMask->header); 640 644 } 641 addDestreakKeyword(sf->outMask->header );645 addDestreakKeyword(sf->outMask->header, true); 642 646 // Note: we don't excise the mask pixels even if exciseAll is true. 643 647 setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, false); … … 671 675 addRecoveryKeyword(sf->recWeight->header); 672 676 } 673 addDestreakKeyword(sf->outWeight->header );677 addDestreakKeyword(sf->outWeight->header, true); 674 678 setupImageRefs(sf->outWeight, sf->recWeight, sf->inWeight, sf->extnum, exciseAll); 675 679 … … 767 771 } 768 772 } 769 } else {773 } else if (sfiles->inImage->image->type.type == PS_TYPE_F32) { 770 774 float imageValue = sfiles->inImage->image->data.F32[y][x]; 771 775 if (sfiles->recImage && !isExciseValue(imageValue, sfiles->inImage->exciseValue) ) { … … 783 787 } 784 788 } 789 } else { 790 // We could handle F64 but I don't think we ever get them. 791 // Should catch this earlier 792 psError(PS_ERR_IO, true, "unexpected image type %x found", sfiles->inImage->image->type.type ); 793 streaksExit("", PS_EXIT_PROG_ERROR); 785 794 } 786 795 787 796 if (sfiles->outWeight) { 788 if (sfiles->recWeight) {789 sfiles->recWeight->image->data.F32[y][x] = sfiles->inWeight->image->data.F32[y][x];790 }791 797 // Assume that weight images are always a floating point type 792 sfiles->outWeight->image->data.F32[y][x] = NAN; 798 if (sfiles->inWeight->image->type.type == PS_TYPE_F32) { 799 if (sfiles->recWeight) { 800 sfiles->recWeight->image->data.F32[y][x] = sfiles->inWeight->image->data.F32[y][x]; 801 } 802 sfiles->outWeight->image->data.F32[y][x] = NAN; 803 } else if (sfiles->inWeight->image->type.type == PS_TYPE_F64) { 804 if (sfiles->recWeight) { 805 sfiles->recWeight->image->data.F64[y][x] = sfiles->inWeight->image->data.F64[y][x]; 806 } 807 sfiles->outWeight->image->data.F64[y][x] = NAN; 808 } else { 809 // Should catch this earlier 810 psError(PS_ERR_IO, true, "unexpected weight image type %x found", sfiles->inWeight->image->type.type ); 811 streaksExit("", PS_EXIT_PROG_ERROR); 812 } 793 813 } 794 814 if (sfiles->outMask) { … … 912 932 streaksExit("", PS_EXIT_DATA_ERROR); 913 933 } 914 addDestreakKeyword(header );934 addDestreakKeyword(header, true); 915 935 916 936 if (!psFitsWriteBlank(out->fits, header, extname)) { … … 973 993 psArrayRealloc(outTable, j); 974 994 975 addDestreakKeyword(header );995 addDestreakKeyword(header, true); 976 996 if (psArrayLength(outTable) > 0) { 977 997 printf("Censored %d sources\n", numCensored);
Note:
See TracChangeset
for help on using the changeset viewer.
