Changeset 31086
- Timestamp:
- Mar 30, 2011, 9:39:01 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/ppImage/src
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ppImageDetrendPattern.c (modified) (6 diffs)
-
ppImageOptions.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ppImage/src
- Property svn:mergeinfo changed
/trunk/ppImage/src merged: 30831,30835,30860,30878,31066
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110213/ppImage/src/ppImageDetrendPattern.c
r26922 r31086 23 23 assert(inputView->readout == -1); 24 24 25 // PATTERN.ROW is selected by the recipe. If it is selected, we search for the table 26 // PATTERN.ROW.SUBSET. If this is found in our format file, we use that version; 27 // otherwise, we use the table provided in the recipe file "ppImage.config". Within that 28 // table, we select the entry that matches our CHIP.NAME. This will be either a boolean or 29 // a string of bits. If it is a boolean, it specified whether or not to correct the entire 30 // chip; if it is a string, the bits specify which cells to correct (sequence is order of 31 // CELLS in the format:CHIPS metadata table) 32 33 // We also check the chip header for the boolean 'PTRN_ROW' : if this is true, we have 34 // already applied this correct to this data, so we simply skip the correction for this 35 // chip. 36 25 37 if (options->doPatternRow) { 26 38 bool status; 27 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT"); 28 pmFPAview *view = pmFPAviewAlloc(0); // View for local processing 29 *view = *inputView; 30 while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) { 39 pmHDU *hdu = pmHDUFromChip(chip); 40 if (psMetadataLookupBool(NULL,hdu->header,"PTRN_ROW")) { 41 psLogMsg("ppImage", PS_LOG_INFO, "Not performing row pattern correction as it has already been done."); 42 goto pattern_cell; 43 } 44 45 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT"); 46 pmFPAview *view = pmFPAviewAlloc(0); // View for local processing 47 *view = *inputView; 48 while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) { 31 49 if (!cell->process || !cell->file_exists) { 32 continue;50 continue; 33 51 } 34 52 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 35 ESCAPE(false, "load failure for Cell");53 ESCAPE(false, "load failure for Cell"); 36 54 } 37 55 38 56 if (!cell->data_exists) { 39 57 continue; … … 51 69 if (!doPattern) continue; 52 70 71 // A very detailed log message. 53 72 const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 54 73 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); 55 psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n", 56 chipName, cellName); 74 psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n", chipName, cellName); 57 75 58 76 // process each of the readouts … … 74 92 } 75 93 } 76 } 77 psFree(view); 94 95 } 96 psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_ROW",PS_META_REPLACE,"PATTERN.ROW correction applied",true); 97 psFree(view); 78 98 } 99 100 pattern_cell: 101 102 // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL 79 103 80 104 if (options->doPatternCell) { … … 83 107 pmFPAview *view = pmFPAviewAlloc(0); // View for local processing 84 108 *view = *inputView; 85 for (int i = 0; i < chip->cells->n; i++) { 109 110 pmHDU *hdu = pmHDUFromChip(chip); 111 if (psMetadataLookupBool(NULL,hdu->header,"PTRN_CEL")) { 112 psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell pattern correction as it has already been done."); 113 goto pattern_done; 114 } 115 116 for (int i = 0; i < chip->cells->n; i++) { 86 117 view->cell = i; 87 118 88 119 pmCell *cell = chip->cells->data[i]; // Cell of interest 120 89 121 if (cell->readouts->n > 1) { 90 122 psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell pattern correction on video cell."); … … 99 131 tweak->data.U8[i] = 0xFF; 100 132 } 101 }102 133 103 // Tweak the cells 104 if (!pmPatternCell(chip, tweak, options->patternCellBG, options->patternCellMean, 105 options->maskValue, options->darkMask)) { 106 psFree(tweak); 107 psFree(view); 108 return false; 109 } 110 psFree(tweak); 111 psFree(view); 134 } 135 136 // Tweak the cells 137 if (!pmPatternCell(chip, tweak, options->patternCellBG, options->patternCellMean, 138 options->maskValue, options->darkMask)) { 139 psFree(tweak); 140 psFree(view); 141 return false; 142 } 143 psFree(tweak); 144 psFree(view); 145 146 psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_CEL",PS_META_REPLACE,"PATTERN.CELL correction applied",true); 112 147 } 113 148 149 pattern_done: 114 150 return(true); 115 151 } … … 119 155 *doit = false; 120 156 121 psMetadataItem *doPattern = pmConfigRecipeValueByView(config, recipeName, recipeValue, chip->parent, view); 157 psMetadataItem *doPattern; 158 159 doPattern = pmConfigRecipeValueByView(config, recipeName, recipeValue, chip->parent, view); 160 122 161 if (!doPattern) { 123 162 psError(PS_ERR_UNKNOWN, false, "Unable to determine whether row pattern matching should be applied."); -
branches/eam_branches/ipp-20110213/ppImage/src/ppImageOptions.c
r30680 r31086 126 126 exit(EXIT_FAILURE); 127 127 } 128 128 psMetadata *format = config->format; 129 129 130 // Non-linearity recipe options 130 131 if (psMetadataLookupBool(NULL, recipe, "NONLIN")) { … … 237 238 options->doFringe = psMetadataLookupBool(NULL, recipe, "FRINGE"); 238 239 options->doShutter = psMetadataLookupBool(NULL, recipe, "SHUTTER"); 240 241 // PATTERN.ROW is selected by the recipe. If it is selected, we search for the table 242 // PATTERN.ROW.SUBSET. If this is found in our format file, we use that version; 243 // otherwise, we use the table provided in the recipe file "ppImage.config". Within that 244 // table, we select the entry that matches our CHIP.NAME. This will be either a boolean or 245 // a string of bits. If it is a boolean, it specified whether or not to correct the entire 246 // chip; if it is a string, the bits specify which cells to correct (sequence is order of 247 // CELLS in the format:CHIPS metadata table) 248 249 // We also check the chip header for the boolean 'PTRN_ROW' : if this is true, we have 250 // already applied this correct to this data, so we simply skip the correction for this 251 // chip. 252 239 253 options->doPatternRow = psMetadataLookupBool(NULL, recipe, "PATTERN.ROW"); 240 254 options->doPatternCell = psMetadataLookupBool(NULL, recipe, "PATTERN.CELL"); 255 241 256 options->doMaskStats = psMetadataLookupBool(NULL, recipe, "MASK.STATS"); 242 257 options->addNoise = psMetadataLookupBool(NULL, recipe, "ADDNOISE"); … … 344 359 345 360 // Pattern correction 346 options->patternRowOrder = psMetadataLookupS32(NULL, recipe, "PATTERN.ROW.ORDER"); 347 options->patternRowIter = psMetadataLookupS32(NULL, recipe, "PATTERN.ROW.ITER"); 348 options->patternRowRej = psMetadataLookupF32(NULL, recipe, "PATTERN.ROW.REJ"); 349 options->patternRowThresh = psMetadataLookupF32(NULL, recipe, "PATTERN.ROW.THRESH"); 350 options->patternRowMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.ROW.MEAN")); 351 options->patternRowStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.ROW.STDEV")); 352 options->patternCellBG = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.CELL.BG")); 353 options->patternCellMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.CELL.MEAN")); 361 if (psMetadataLookup(format, "PATTERN.ROW.ORDER")) { 362 options->patternRowOrder = psMetadataLookupS32(NULL, format, "PATTERN.ROW.ORDER"); 363 } 364 else { 365 options->patternRowOrder = psMetadataLookupS32(NULL, recipe, "PATTERN.ROW.ORDER"); 366 } 367 if (psMetadataLookup(format, "PATTERN.ROW.ITER")) { 368 options->patternRowIter = psMetadataLookupS32(NULL, format, "PATTERN.ROW.ITER"); 369 } 370 else { 371 options->patternRowIter = psMetadataLookupS32(NULL, recipe, "PATTERN.ROW.ITER"); 372 } 373 if (psMetadataLookup(format, "PATTERN.ROW.REJ")) { 374 options->patternRowRej = psMetadataLookupF32(NULL, format, "PATTERN.ROW.REJ"); 375 } 376 else { 377 options->patternRowRej = psMetadataLookupF32(NULL, recipe, "PATTERN.ROW.REJ"); 378 } 379 if (psMetadataLookup(format, "PATTERN.ROW.THRESH")) { 380 options->patternRowThresh = psMetadataLookupF32(NULL, format, "PATTERN.ROW.THRESH"); 381 } 382 else { 383 options->patternRowThresh = psMetadataLookupF32(NULL, recipe, "PATTERN.ROW.THRESH"); 384 } 385 if (psMetadataLookup(format, "PATTERN.ROW.MEAN")) { 386 options->patternRowMean = psStatsOptionFromString(psMetadataLookupStr(NULL, format, "PATTERN.ROW.MEAN")); 387 } 388 else { 389 options->patternRowMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.ROW.MEAN")); 390 } 391 if (psMetadataLookup(format, "PATTERN.ROW.STDEV")) { 392 options->patternRowStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, format, "PATTERN.ROW.STDEV")); 393 } 394 else { 395 options->patternRowStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.ROW.STDEV")); 396 } 397 if (psMetadataLookup(format, "PATTERN.CELL.BG")) { 398 options->patternCellBG = psStatsOptionFromString(psMetadataLookupStr(NULL, format, "PATTERN.CELL.BG")); 399 } 400 else { 401 options->patternCellBG = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.CELL.BG")); 402 } 403 if (psMetadataLookup(format, "PATTERN.CELL.MEAN")) { 404 options->patternCellMean = psStatsOptionFromString(psMetadataLookupStr(NULL, format, "PATTERN.CELL.MEAN")); 405 } 406 else { 407 options->patternCellMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.CELL.MEAN")); 408 } 409 354 410 355 411 // Remnance options
Note:
See TracChangeset
for help on using the changeset viewer.
