Changeset 5858 for trunk/ppImage/src/ppImageDetrendPedestal.c
- Timestamp:
- Dec 30, 2005, 7:05:28 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageDetrendPedestal.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageDetrendPedestal.c
r5857 r5858 1 1 # include "ppImage.h" 2 2 3 psImage *ppDetrendPedestal (pmCell *input, psImage *bias, psImage *dark, ppRecipe *options) { 3 // XXX check on image overlaps, as well as image sizes 4 // XXX what constraints do we put on the detrend images? 5 // XXX this function is much easier if we can assume all detrend images 6 // should have the same size and represent the same pixels... 4 7 5 psImage *pedestal = NULL; // Pedestal image (bias + scaled dark) 8 pmReadout *ppDetrendPedestal (pmReadout *pedestal, pmCell *input, pmReadout *bias, pmReadout *dark, float darkTime, ppOptions *options) { 6 9 7 10 #ifdef PRODUCTION 11 static float lastExptime = 0.0; 12 bool reusePedestal = true; 13 8 14 if (options->doDark) { 9 15 // Dark time for input image … … 14 20 exit(EXIT_FAILURE); 15 21 } 16 pedestal = (psImage*)psBinaryOp(NULL, dark, "*", psScalarAlloc(inputTime * darkTime, PS_TYPE_F32)); 22 23 if (inputTime != lastExptime) { 24 // this will create a new pedestal if the input one is NULL 25 // XXX EAM : this function had darkTime * inputTime, which is wrong, yes? 26 if (pedestal == NULL) { 27 pedestal = pmReadoutAlloc (NULL); 28 } 29 pedestal->col0 = dark->col0; 30 pedestal->row0 = dark->row0; 31 pedestal->colBins = dark->colBins; 32 pedestal->rowBins = dark->rowBins; 33 34 pedestal->image = (psImage *) psBinaryOp(pedestal->image, dark->image, "*", psScalarAlloc(inputTime / darkTime, PS_TYPE_F32)); 35 reusePedestal = false; 36 lastExptime = inputTime 37 } 17 38 } 18 if (options->doBias) { 19 if (pedestal) { 20 if (bias->numRows != dark->numRows || 21 bias->numCols != dark->numCols) { 22 psError(PS_ERR_IO, true, "Bias and dark images have different dimensions: " 23 "%dx%d vs %dx%d\n", bias->numCols, bias->numRows, 24 dark->numCols, dark->numRows); 25 exit(EXIT_FAILURE); 26 } 27 (void)psBinaryOp(pedestal, pedestal, "+", bias); 28 } else { 39 40 // no bias image, return dark pedestal or NULL 41 if (!options->doBias) { 42 return pedestal; 43 } 44 45 // no dark image, return bias pedestal, or reuse 46 if (!options->doDark) { 47 if (!pedestal) { 29 48 pedestal = psMemIncrRefCounter(bias); 30 49 } 50 return pedestal; 31 51 } 52 53 if (reusePedestal) { 54 return pedestal; 55 } 56 57 if (bias->image->numRows != dark->image->numRows || 58 bias->image->numCols != dark->image->numCols) { 59 psError(PS_ERR_IO, true, "Bias and dark images have different dimensions: %dx%d vs %dx%d\n", 60 bias->image->numCols, bias->image->numRows, 61 dark->image->numCols, dark->image->numRows); 62 exit(EXIT_FAILURE); 63 } 64 65 psBinaryOp(pedestal->image, pedestal->image, "+", bias->image); 66 return pedestal; 67 #else 68 return NULL; 32 69 #endif 33 34 return pedestal;35 70 } 36 71 72 // creates a new pedestal image for this readout 73 // if the current exptime is the same as the last exptime, 74 // reuses the supplied pedestal
Note:
See TracChangeset
for help on using the changeset viewer.
