Changeset 6851 for trunk/psphot/src/psphotSkyReplace.c
- Timestamp:
- Apr 12, 2006, 8:59:15 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotSkyReplace.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotSkyReplace.c
r6727 r6851 5 5 bool psphotSkyReplace (pmConfig *config, pmFPAview *view) { 6 6 7 bool status; 7 // find the currently selected readout 8 pmReadout *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT"); 9 if (readout == NULL) psAbort ("psphot", "input not defined"); 8 10 9 // find the currently selected readout 10 // psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, "PSPHOT"); 11 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); 12 pmReadout *readout = pmFPAviewThisReadout (view, input->fpa); 11 // select background pixels, from output background file, or create 12 pmReadout *background = pmFPAfileThisReadout (config->files, view, "PSPHOT.BACKGND"); 13 if (background == NULL) psAbort ("psphot", "background not defined"); 13 14 14 15 // select the corresponding images 15 psImage *image = readout->image; 16 psImage *mask = readout->mask; 17 18 // select background pixels, from output background file, or create 19 psImage *background = pmFPAfileReadoutImage (config->files, view, "PSPHOT.BACKGND", 0, 0, PS_TYPE_F32); 20 if (background == NULL) { 21 return false; 22 } 16 psF32 **image = readout->image->data.F32; 17 psU8 **mask = readout->mask->data.U8; 18 psF32 **back = background->image->data.F32; 23 19 24 20 // replace the background model 25 for (int j = 0; j < image->numRows; j++) {26 for (int i = 0; i < image->numCols; i++) {27 if (!mask ->data.U8[j][i]) {28 image ->data.F32[j][i] += background->data.F32[j][i];21 for (int j = 0; j < readout->image->numRows; j++) { 22 for (int i = 0; i < readout->image->numCols; i++) { 23 if (!mask[j][i]) { 24 image[j][i] += back[j][i]; 29 25 } 30 26 } 31 27 } 32 33 psFree (background);34 28 return true; 35 29 }
Note:
See TracChangeset
for help on using the changeset viewer.
