Changeset 15817 for trunk/ppSub/src/ppSubReadout.c
- Timestamp:
- Dec 13, 2007, 12:16:43 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubReadout.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubReadout.c
r15448 r15817 60 60 float optThresh = psMetadataLookupF32(&mdok, config->arguments, "OPTIMUM.TOL"); // Tolerance for search 61 61 int optOrder = psMetadataLookupS32(&mdok, config->arguments, "OPTIMUM.ORDER"); // Order for search 62 bool dual = psMetadataLookupBool(&mdok, config->arguments, "DUAL"); // Dual convolution? 63 64 pmSubtractionMode mode = dual ? PM_SUBTRACTION_MODE_DUAL : PM_SUBTRACTION_MODE_UNSURE; // Subtraction mode 65 pmReadout *conv2 = NULL; // Convolved image, for dual convolution 66 if (dual) { 67 conv2 = pmReadoutAlloc(NULL); 68 } 62 69 63 70 // Generate masks if they don't exist … … 90 97 } 91 98 92 if (!pmSubtractionMatch(outRO, inRO, refRO, footprint, regionSize, spacing, threshold, sources,99 if (!pmSubtractionMatch(outRO, conv2, inRO, refRO, footprint, regionSize, spacing, threshold, sources, 93 100 stampsName, type, size, order, widths, orders, inner, ringsOrder, 94 101 binning, optimum, optWidths, optOrder, optThresh, iter, rej, maskBad, 95 maskBlank, badFrac, PM_SUBTRACTION_MODE_UNSURE)) {102 maskBlank, badFrac, mode)) { 96 103 psError(PS_ERR_UNKNOWN, false, "Unable to match images."); 104 psFree(conv2); 97 105 psFree(outRO); 98 106 return false; … … 106 114 "Subtraction kernel", kernels->description); 107 115 108 109 116 psImage *kernelImage = psMetadataLookupPtr(NULL, outRO->analysis, 110 117 "SUBTRACTION.KERNEL.IMAGE"); // Image of the kernels … … 114 121 115 122 // Do the subtraction 116 if (reverse) { 117 psBinaryOp(outRO->image, outRO->image, "-", inRO->image); 118 } else { 119 psBinaryOp(outRO->image, inRO->image, "-", outRO->image); 120 } 121 psBinaryOp(outRO->mask, outRO->mask, "|", inRO->mask); 122 if (outRO->weight) { 123 psBinaryOp(outRO->weight, outRO->weight, "+", inRO->weight); 123 { 124 // Subtraction is: minuend - subtrahend 125 psImage *minuendImage = outRO->image; 126 psImage *subtrahendImage = (dual ? conv2->image : inRO->image); 127 psImage *minuendWeight = outRO->image; 128 psImage *subtrahendWeight = (dual ? conv2->weight : inRO->weight); 129 psImage *mask2 = (dual ? conv2->mask : inRO->mask); 130 131 if (reverse) { 132 psImage *temp = subtrahendImage; 133 subtrahendImage = minuendImage; 134 minuendImage = temp; 135 136 temp = subtrahendWeight; 137 subtrahendWeight = minuendWeight; 138 minuendWeight = temp; 139 } 140 141 psBinaryOp(outRO->image, minuendImage, "-", subtrahendImage); 142 psBinaryOp(outRO->mask, outRO->mask, "|", mask2); 143 if (minuendWeight && subtrahendWeight) { 144 psBinaryOp(outRO->weight, minuendWeight, "+", subtrahendWeight); 145 } 124 146 } 125 147
Note:
See TracChangeset
for help on using the changeset viewer.
