Changeset 26871
- Timestamp:
- Feb 10, 2010, 4:13:46 PM (16 years ago)
- Location:
- branches/eam_branches/20091201/ppbgrestore/src
- Files:
-
- 4 edited
-
ppbgrestoreArguments.c (modified) (2 diffs)
-
ppbgrestoreCleanup.c (modified) (1 diff)
-
ppbgrestoreLoop.c (modified) (5 diffs)
-
ppbgrestoreParseCamera.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/ppbgrestore/src/ppbgrestoreArguments.c
r25973 r26871 8 8 pmConfig *ppbgrestoreArguments(int argc, char *argv[]) 9 9 { 10 int argnum; 10 11 if (argc == 1) { 11 12 usage(); … … 32 33 usage(); 33 34 } 35 36 if ((argnum = psArgumentGet(argc, argv, "-savebg"))) { 37 psArgumentRemove(argnum, &argc, argv); 38 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "SAVE_BACKGROUND", 0, "save background innmage", true); 39 } 40 34 41 if (argc != 2) usage (); 35 42 -
branches/eam_branches/20091201/ppbgrestore/src/ppbgrestoreCleanup.c
r25973 r26871 22 22 // fprintf(stderr, "Found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "ppImage"); 23 23 24 fprintf(stderr, "Found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "ppbgrestore");24 // fprintf(stderr, "Found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "ppbgrestore"); 25 25 26 26 } -
branches/eam_branches/20091201/ppbgrestore/src/ppbgrestoreLoop.c
r25974 r26871 30 30 exit(PS_EXIT_PROG_ERROR); 31 31 } 32 pmFPAfile *background= psMetadataLookupPtr(&status, config->files, "PPBGRESTORE.BACKGROUND"); 33 if (!status) { 34 psErrorStackPrint(stderr, "Can't find output data!\n"); 35 ppbgrestoreCleanup(config, options); 36 exit(PS_EXIT_PROG_ERROR); 37 } 38 bool save_background = psMetadataLookupBool(&status, config->arguments, "SAVE_BACKGROUND"); 32 39 33 40 pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest … … 90 97 } 91 98 output->save = true; 99 background->save = save_background; 92 100 93 101 psImageBinning *binning = psphotBackgroundBinning(image, config); … … 96 104 return false; 97 105 } 98 pmReadout *background = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKGND", image->numCols, image->numRows, PS_TYPE_F32); 106 pmReadout *backgroundRO; 107 #define USE_CELL 108 #ifdef USE_CELL 109 pmCell *backgroundCell = pmFPAviewThisCell(&roView, background->fpa); 110 backgroundRO = pmReadoutAlloc(backgroundCell); 111 #else 112 backgroundRO = pmFPAviewThisReadout(&roView, background->fpa); 113 // backgroundRO = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKGND", image->numCols, image->numRows, PS_TYPE_F32); 114 #endif 115 backgroundRO->image = psImageAlloc(image->numCols, image->numRows, PS_TYPE_F32); 116 backgroundRO->data_exists = true; 117 backgroundRO->parent->data_exists = true; 118 backgroundRO->parent->parent->data_exists = true; 99 119 100 120 // linear interpolation to full-scale 101 if (!psImageUnbin (background ->image, modelRO->image, binning)) {121 if (!psImageUnbin (backgroundRO->image, modelRO->image, binning)) { 102 122 psError (PSPHOT_ERR_PROG, true, "inconsistent sizes for unbinning"); 103 123 psFree(binning); … … 105 125 } 106 126 psFree(binning); 107 psF32 **backData = background ->image->data.F32;127 psF32 **backData = backgroundRO->image->data.F32; 108 128 109 // Do the background subtraction129 // Undo the background subtraction 110 130 int numCols = image->numCols, numRows = image->numRows; // Size of image 111 131 long nancount = 0; 132 long naninputs = 0; 112 133 long finitecount = 0; 113 134 for (int y = 0; y < numRows; y++) { … … 130 151 } else if (isfinite(imageval)) { 131 152 // XXX: TODO:following ppImage we should not modify pixels that are masked. 132 image->data.F32[y][x] += bgvalue; 133 } 153 image->data.F32[y][x] = imageval + bgvalue; 154 } else { 155 naninputs++; 156 } 134 157 } 158 } 159 if (naninputs) { 160 printf("%ld infinite pixels found in input image\n", naninputs); 135 161 } 136 162 if (nancount) { 137 163 psWarning("%ld infinite pixels found in background %ld pixels were finite\n", nancount, finitecount); 138 164 } 139 pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND");165 // pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND"); 140 166 141 167 // Close chip -
branches/eam_branches/20091201/ppbgrestore/src/ppbgrestoreParseCamera.c
r25972 r26871 23 23 pmFPAfile *outImage = pmFPAfileDefineOutput(config, input->fpa, "PPBGRESTORE.OUTPUT"); 24 24 if (!outImage) { 25 psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.OUTPUT")); 25 psError(PS_ERR_IO, false, _("Unable to generate output file from PPBGRESTORE.OUTPUT")); 26 psFree(options); 27 return NULL; 28 } 29 // pmFPAfile *outBG = pmFPAfileDefineOutput(config, NULL, "PPBGRESTORE.BACKGROUND"); 30 pmFPAfile *outBG = pmFPAfileDefineFromFPA(config, input->fpa, 1, 1, "PPBGRESTORE.BACKGROUND"); 31 if (!outBG) { 32 psError(PS_ERR_IO, false, _("Unable to generate bacgkround file from PPBGRESTORE.BACKGROUND")); 26 33 psFree(options); 27 34 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.
