Changeset 18724 for trunk/ppImage/src/ppImageRebinReadout.c
- Timestamp:
- Jul 24, 2008, 3:58:31 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageRebinReadout.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
