Changeset 28296
- Timestamp:
- Jun 10, 2010, 1:12:33 PM (16 years ago)
- Location:
- trunk/ppBackground/src
- Files:
-
- 3 edited
-
ppBackground.h (modified) (1 diff)
-
ppBackgroundLoop.c (modified) (1 diff)
-
ppBackgroundRestore.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppBackground/src/ppBackground.h
r28280 r28296 39 39 /// Restore the background to an image 40 40 bool ppBackgroundRestore( 41 pmChip *chip, // Input chip 41 pmChip *out, // Output chip 42 const pmChip *chip, // Input chip 42 43 const pmChip *background, // Chip with background model 43 44 const pmChip *pattern, // Chip with pattern -
trunk/ppBackground/src/ppBackgroundLoop.c
r28293 r28296 125 125 } 126 126 pmFPAfileActivate(config->files, true, NULL); 127 pmFPAfileActivate(config->files, false, "PPBACKGROUND.PATTERN");127 // pmFPAfileActivate(config->files, false, "PPBACKGROUND.PATTERN"); 128 128 } 129 129 130 pmChip *outChip = pmFPAfileThisChip(config->files, view, "PPBACKGROUND.OUTPUT"); // Chip for output 130 131 pmChip *patternChip = patternFile ? pmFPAviewThisChip(view, patternMosaic) : NULL; // Chip with pattern 131 132 pmChip *bgChip = bgFile ? pmFPAviewThisChip(view, bgFile->fpa) : NULL; // Chip with background model 132 if (!ppBackgroundRestore( chip, bgChip, patternChip, view, config)) {133 if (!ppBackgroundRestore(outChip, chip, bgChip, patternChip, view, config)) { 133 134 psError(psErrorCodeLast(), false, "Unable to replace background"); 134 135 return false; -
trunk/ppBackground/src/ppBackgroundRestore.c
r28293 r28296 6 6 #include "ppBackground.h" 7 7 8 bool ppBackgroundRestore(pmChip * chip, const pmChip *background, const pmChip *pattern,8 bool ppBackgroundRestore(pmChip *out, const pmChip *chip, const pmChip *background, const pmChip *pattern, 9 9 const pmFPAview *oldView, pmConfig *config) 10 10 { 11 PS_ASSERT_PTR_NON_NULL(out, false); 11 12 PS_ASSERT_PTR_NON_NULL(chip, false); 12 13 PS_ASSERT_PTR_NON_NULL(oldView, false); … … 17 18 view->readout = 0; 18 19 19 pmReadout * ro= pmFPAviewThisReadout(view, chip->parent);20 if (! ro || !ro->data_exists) {20 pmReadout *inRO = pmFPAviewThisReadout(view, chip->parent); 21 if (!inRO || !inRO->data_exists) { 21 22 psError(PPBACKGROUND_ERR_CONFIG, true, "Readout has no data"); 22 23 return false; 23 24 } 24 psImage *image = ro->image, *mask = ro->mask; // Image to correct 25 int numCols = image->numCols, numRows = image->numRows; // Size of image 25 const psImage *inImage = inRO->image, *inMask = inRO->mask; // Input image 26 int numCols = inImage->numCols, numRows = inImage->numRows; // Size of image 27 28 pmReadout *outRO = pmFPAviewThisReadout(view, out->parent); 29 if (!outRO) { 30 pmCell *outCell = pmFPAviewThisCell(view, out->parent); 31 outRO = pmReadoutAlloc(outCell); 32 psFree(outRO); // Drop reference 33 } 34 outRO->image = psImageCopy(outRO->image, inImage, PS_TYPE_F32); 35 outRO->mask = psImageCopy(outRO->mask, inMask, PS_TYPE_IMAGE_MASK); 36 psImage *outImage = outRO->image, *outMask = outRO->mask; // Output image 26 37 27 38 if (background) { 28 39 pmReadout *bgRO = pmFPAviewThisReadout(view, background->parent); // Readout with background 29 psImageBinning *binning = psphotBackgroundBinning( image, config);40 psImageBinning *binning = psphotBackgroundBinning(outImage, config); 30 41 if (!binning) { 31 42 psError(psErrorCodeLast(), false, "Unable to find background binning"); … … 49 60 for (int y = 0; y < numRows; y++) { 50 61 for (int x = 0; x < numCols; x++) { 51 image->data.F32[y][x] += bgImage->data.F32[y][x];62 outImage->data.F32[y][x] += bgImage->data.F32[y][x]; 52 63 } 53 64 } … … 61 72 for (int y = 0; y < numRows; y++) { 62 73 for (int x = 0; x < numCols; x++) { 63 image->data.F32[y][x] += patternImage->data.F32[y][x];64 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= patternMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x];74 outImage->data.F32[y][x] = patternImage->data.F32[y][x]; 75 outMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= patternMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x]; 65 76 } 66 77 } 67 78 } 68 79 69 ro->data_exists = true;70 ro->parent->data_exists = true;71 ro->parent->parent->data_exists = true;80 outRO->data_exists = true; 81 outRO->parent->data_exists = true; 82 outRO->parent->parent->data_exists = true; 72 83 73 84 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
