Changeset 18179
- Timestamp:
- Jun 18, 2008, 2:39:33 PM (18 years ago)
- Location:
- trunk/pswarp/src
- Files:
-
- 3 edited
-
pswarp.h (modified) (1 diff)
-
pswarpLoop.c (modified) (1 diff)
-
pswarpTransformReadout_Opt.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarp.h
r17955 r18179 14 14 #define PSWARP_RECIPE "PSWARP" // Name of the recipe to use 15 15 #define PSASTRO_RECIPE "PSASTRO" // Name of the recipe to use 16 17 #define PSWARP_ANALYSIS_VARFACTOR "PSWARP.VARFACTOR" // Name for variance factor in analysis metadata 18 #define PSWARP_ANALYSIS_GOODPIX "PSWARP.GOODPIX" // Name for number of good pixels in analysis metadata 16 19 17 20 // a single pswarpMap converts coordinates from one image to a second image -
trunk/pswarp/src/pswarpLoop.c
r18068 r18179 253 253 } 254 254 255 // Set variance factor 256 { 257 float varFactor = psMetadataLookupF32(NULL, output->analysis, PSWARP_ANALYSIS_VARFACTOR); 258 psAssert(isfinite(varFactor), "Should be something here."); 259 long goodPix = psMetadataLookupS64(NULL, output->analysis, PSWARP_ANALYSIS_GOODPIX); 260 psAssert(goodPix > 0, "Should be something here."); 261 varFactor /= goodPix; 262 263 psMetadataItem *vfItem = psMetadataLookup(outCell->concepts, "CELL.VARFACTOR"); // Item to update 264 psAssert(vfItem && vfItem->type == PS_TYPE_F64, "Concept should be as specified."); 265 if (!isfinite(vfItem->data.F64)) { 266 vfItem->data.F64 = varFactor; 267 } else { 268 vfItem->data.F64 *= varFactor; 269 } 270 } 271 255 272 if (!pmConceptsAverageCells(outCell, cells, NULL, NULL, false)) { 256 273 psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts."); -
trunk/pswarp/src/pswarpTransformReadout_Opt.c
r17780 r18179 86 86 87 87 // Iterate over the output image pixels (parent frame) 88 bool goodPixels = false; // Any input pixels landing on the output image?88 long goodPixels = 0; // Number of input pixels landing on the output image 89 89 for (int y = minY; y < maxY; y++) { 90 90 if (y >= nextGridY) { … … 117 117 if (inPix->y - inRow0 >= inImage->numRows) continue; 118 118 119 goodPixels = true;119 goodPixels++; 120 120 121 121 // XXX include mask … … 146 146 psFree(grid); 147 147 148 // Store the variance factor and number of good pixels 149 if (goodPixels > 0) { 150 float varFactor = psImageInterpolateVarianceFactor(output->image->numCols, output->image->numRows, 151 interp); // Variance factor: large --> small scale 152 psMetadataItem *vfItem = psMetadataLookup(output->analysis, PSWARP_ANALYSIS_VARFACTOR); 153 if (vfItem) { 154 psMetadataItem *goodpixItem = psMetadataLookup(output->analysis, PSWARP_ANALYSIS_GOODPIX); 155 psAssert(goodpixItem, "It should be where we left it!"); 156 psAssert(vfItem->type == PS_TYPE_F32 && goodpixItem->type == PS_TYPE_S64, 157 "Should be the type we said."); 158 159 vfItem->data.F32 += varFactor * goodPixels; 160 goodpixItem->data.S64 += goodPixels; 161 } else { 162 psMetadataAddF32(output->analysis, PS_LIST_TAIL, PSWARP_ANALYSIS_VARFACTOR, 0, 163 "Variance factor weighted by the good pixels", varFactor * goodPixels); 164 psMetadataAddS64(output->analysis, PS_LIST_TAIL, PSWARP_ANALYSIS_GOODPIX, 0, 165 "Number of good pixels", goodPixels); 166 } 167 } 168 148 169 // Transform sources 149 170 psArray *inSources = psMetadataLookupPtr(&mdok, input->analysis, "PSPHOT.SOURCES"); // Sources in source 150 if (goodPixels && mdok && inSources) {171 if (goodPixels > 0 && mdok && inSources) { 151 172 pswarpMapGrid *sourceGrid = pswarpMapGridFromImage(output, input, nGridX, nGridY); // Grid for sources 152 173
Note:
See TracChangeset
for help on using the changeset viewer.
