Changeset 18724
- Timestamp:
- Jul 24, 2008, 3:58:31 PM (18 years ago)
- Location:
- trunk/ppImage/src
- Files:
-
- 3 edited
-
ppImage.h (modified) (1 diff)
-
ppImageLoop.c (modified) (2 diffs)
-
ppImageRebinReadout.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImage.h
r18556 r18724 123 123 pmReadout* ppImageDetrendSelectFirst(pmCell *cell, char *name, bool doThis); 124 124 125 bool ppImageRebinChip (pmConfig *config, pmFPAview *view, char *outName);126 bool ppImageRebinReadout (pmReadout *output, pmReadout *input, pmFPAfile *outFile );125 bool ppImageRebinChip (pmConfig *config, pmFPAview *view, ppImageOptions *options, char *outName); 126 bool ppImageRebinReadout (pmReadout *output, pmReadout *input, pmFPAfile *outFile, ppImageOptions *options); 127 127 128 128 bool ppImagePhotom (pmConfig *config, pmFPAview *view); -
trunk/ppImage/src/ppImageLoop.c
r18556 r18724 87 87 ESCAPE ("Unable to mosaic chip"); 88 88 89 if (!ppImageRebinChip(config, view, "PPIMAGE.BIN1"))90 ESCAPE ("Unable to bin chip (level 1).");91 92 if (!ppImageRebinChip(config, view, "PPIMAGE.BIN2"))93 ESCAPE ("Unable to bin chip (level 2).");94 95 89 // we perform photometry on the readouts of this chip in the output 96 90 if (options->doPhotom) { … … 103 97 ESCAPE ("Unable to replace masked pixels with background level"); 104 98 } 99 100 // binning (used for display) must take place after the background is replaced, if desired 101 if (!ppImageRebinChip(config, view, options, "PPIMAGE.BIN1")) 102 ESCAPE ("Unable to bin chip (level 1)."); 103 104 if (!ppImageRebinChip(config, view, options, "PPIMAGE.BIN2")) 105 ESCAPE ("Unable to bin chip (level 2)."); 105 106 106 107 // Close cells (XXX shouldn't pmFPAfileClose iterate down as needed?) -
trunk/ppImage/src/ppImageRebinReadout.c
r18216 r18724 5 5 #include "ppImage.h" 6 6 7 bool ppImageRebinChip (pmConfig *config, pmFPAview *view, char *outName) {7 bool ppImageRebinChip (pmConfig *config, pmFPAview *view, ppImageOptions *options, char *outName) { 8 8 9 9 pmCell *cell; … … 33 33 34 34 // run the rebin code 35 ppImageRebinReadout (outReadout, inReadout, outFile );35 ppImageRebinReadout (outReadout, inReadout, outFile, options); 36 36 } 37 37 … … 61 61 62 62 // XXX this should be made consistent with psImageBinning 63 bool ppImageRebinReadout (pmReadout *output, pmReadout *input, pmFPAfile *outFile )63 bool ppImageRebinReadout (pmReadout *output, pmReadout *input, pmFPAfile *outFile, ppImageOptions *options) 64 64 { 65 65 PS_ASSERT_PTR_NON_NULL(output, false); … … 80 80 int nY = input->image->numRows; 81 81 82 // we should *either* skip masked pixels or replace masked pixels with the specified value 83 84 82 85 // do the rebinning by hand, mean only for test 83 86 for (int yOut = 0; yOut < output->image->numRows; yOut++) { 84 87 for (int xOut = 0; xOut < output->image->numCols; xOut++) { 88 float maskedValue = 0.0; 85 89 float value = 0; 86 90 int nPix = 0; 87 91 for (int yIn = yOut * dY; (yIn < yOut * dY + dY) && (yIn < nY); yIn ++) { 88 92 for (int xIn = xOut * dX; (xIn < xOut * dX + dX) && (xIn < nX); xIn ++) { 89 if (input->mask && input->mask->data.U8[yIn][xIn]) continue; 93 if (input->mask && input->mask->data.U8[yIn][xIn]) { 94 maskedValue = input->image->data.F32[yIn][xIn]; 95 continue; 96 } 90 97 value += input->image->data.F32[yIn][xIn]; 91 98 nPix ++; 92 99 } 93 100 } 94 output->image->data.F32[yOut][xOut] = value / nPix; 101 if (nPix > 0) { 102 output->image->data.F32[yOut][xOut] = value / nPix; 103 } else { 104 if (options->replaceMasked) { 105 output->image->data.F32[yOut][xOut] = maskedValue; 106 } else { 107 output->image->data.F32[yOut][xOut] = 0.0; 108 } 109 } 95 110 } 96 111 }
Note:
See TracChangeset
for help on using the changeset viewer.
