Changeset 27838 for branches/tap_branches/ppStack/src/ppStackReject.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ppStack/src (modified) (1 prop)
-
ppStack/src/ppStackReject.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/ppStack/src
- Property svn:ignore
-
old new 10 10 stamp-h1 11 11 ppStackVersionDefinitions.h 12 ppStackErrorCodes.c 13 ppStackErrorCodes.h
-
- Property svn:ignore
-
branches/tap_branches/ppStack/src/ppStackReject.c
r25466 r27838 10 10 #include "ppStackLoop.h" 11 11 12 // #define TESTING12 // #define TESTING 13 13 14 14 bool ppStackReject(ppStackOptions *options, pmConfig *config) … … 23 23 24 24 int num = options->num; // Number of inputs 25 options->rejected = psArrayAlloc(num);26 25 27 26 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe … … 32 31 33 32 float threshold = psMetadataLookupF32(NULL, recipe, "THRESHOLD.MASK"); // Threshold for mask deconvolution 34 float poorFrac = psMetadataLookupF32(NULL, recipe, "POOR.FRACTION"); // Fraction for "poor"35 33 float imageRej = psMetadataLookupF32(NULL, recipe, "IMAGE.REJ"); // Maximum fraction of image to reject 36 34 // before rejecting entire image … … 53 51 psThreadJob *job = psThreadJobAlloc("PPSTACK_INSPECT"); // Job to start 54 52 psArrayAdd(job->args, 1, options->inspect); 53 psArrayAdd(job->args, 1, options->rejected); 55 54 PS_ARRAY_ADD_SCALAR(job->args, i, PS_TYPE_S32); 56 55 if (!psThreadJobAddPending(job)) { … … 61 60 } 62 61 if (!psThreadPoolWait(true)) { 63 psError( PS_ERR_UNKNOWN, false, "Unable to concatenate inspection lists.");62 psError(psErrorCodeLast(), false, "Unable to concatenate inspection lists."); 64 63 return false; 65 64 } … … 92 91 #endif 93 92 94 psPixels *reject = pmStackReject(options->inspect->data[i], options->numCols, options->numRows,95 threshold, poorFrac, stride, options->regions->data[i],96 options->kernels->data[i]); // Rejected pixels97 98 93 #ifdef TESTING 99 94 { 100 psImage *mask = psPixelsToMask(NULL, reject,95 psImage *mask = psPixelsToMask(NULL, options->rejected->data[i], 101 96 psRegionSet(0, options->numCols - 1, 0, options->numRows - 1), 102 97 0xff); // Mask image 103 98 psString name = NULL; // Name of image 104 psStringAppend(&name, " reject_%03d.fits", i);99 psStringAppend(&name, "pre_reject_%03d.fits", i); 105 100 pmStackVisualPlotTestImage(mask, name); 106 101 psFits *fits = psFitsOpen(name, "w"); … … 111 106 } 112 107 #endif 108 109 psPixels *reject = pmStackReject(options->inspect->data[i], options->numCols, options->numRows, 110 threshold, stride, options->regions->data[i], 111 options->kernels->data[i]); // Rejected pixels 113 112 114 113 psFree(options->inspect->data[i]); … … 127 126 "exceeds limit (%.3f)", i, frac, imageRej); 128 127 psFree(reject); 129 // reject == NULL means reject image completely130 128 reject = NULL; 131 129 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_BAD; 132 130 numRejected++; 131 } else { 132 // Add to list of pixels already rejected 133 reject = psPixelsConcatenate(reject, options->rejected->data[i]); 134 options->rejected->data[i] = psPixelsDuplicates(options->rejected->data[i], reject); 133 135 } 134 136 } 135 137 136 // Images without a list of rejected pixels (the list may be empty) are rejected completely 137 options->rejected->data[i] = reject; 138 #ifdef TESTING 139 { 140 psImage *mask = psPixelsToMask(NULL, options->rejected->data[i], 141 psRegionSet(0, options->numCols - 1, 0, options->numRows - 1), 142 0xff); // Mask image 143 psString name = NULL; // Name of image 144 psStringAppend(&name, "reject_%03d.fits", i); 145 pmStackVisualPlotTestImage(mask, name); 146 psFits *fits = psFitsOpen(name, "w"); 147 psFree(name); 148 psFitsWriteImage(fits, NULL, mask, 0, NULL); 149 psFree(mask); 150 psFitsClose(fits); 151 } 152 #endif 138 153 139 154 if (options->stats) { … … 143 158 "Number of pixels rejected", reject ? reject->n : 0); 144 159 } 160 161 psFree(reject); 145 162 psLogMsg("ppStack", PS_LOG_INFO, "Time to perform rejection on image %d: %f sec", i, 146 163 psTimerClear("PPSTACK_REJECT")); … … 148 165 149 166 psFree(options->inspect); options->inspect = NULL; 150 psFree(options->kernels); options->kernels = NULL;151 psFree(options->regions); options->regions = NULL;152 167 153 if (numRejected >= num - 1) {154 psError(P S_ERR_UNKNOWN, true, "All inputs completely rejected; unable to proceed.");168 if (numRejected >= num) { 169 psError(PPSTACK_ERR_REJECTED, true, "All inputs completely rejected; unable to proceed."); 155 170 return false; 156 171 }
Note:
See TracChangeset
for help on using the changeset viewer.
