IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 11, 2012, 2:04:31 PM (13 years ago)
Author:
watersc1
Message:

Merge from my branch including background restoration and stack stage projection cell binned images.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ppBackground/src/ppBackgroundRestore.c

    r34298 r34800  
    55
    66#include "ppBackground.h"
     7
     8psImageBinning *ppBackgroundBinningByRecipe(const psImage *image, // Image for which to generate a bg model
     9                                            const pmConfig *config, // Configuration
     10                                            psString recipe_name,
     11                                            psString Xbin_name,
     12                                            psString Ybin_name
     13                                            )
     14{
     15  bool status = true;
     16
     17  psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, recipe_name);
     18  assert (recipe);
     19
     20  // I have the fine image size, I know the binning factor, determine the ruff image size
     21  psImageBinning *binning = psImageBinningAlloc();
     22  binning->nXfine = image->numCols;
     23  binning->nYfine = image->numRows;
     24  binning->nXbin  = psMetadataLookupS32(&status, recipe, Xbin_name);
     25  binning->nYbin  = psMetadataLookupS32(&status, recipe, Ybin_name);
     26
     27  psImageBinningSetRuffSize(binning, PS_IMAGE_BINNING_CENTER);
     28  psImageBinningSetSkip(binning, image);
     29
     30  return binning;
     31}
     32
     33 
     34
    735
    836bool ppBackgroundRestore(pmChip *chip, const pmChip *background, const pmChip *pattern,
     
    2755    if (background) {
    2856        pmReadout *bgRO = pmFPAviewThisReadout(view, background->parent); // Readout with background
    29         psImageBinning *binning = psphotBackgroundBinning(image, config);
     57
     58        psImageBinning *binning;
     59        psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPBACKGROUND_RECIPE); // Recipe
     60        if (!recipe) {
     61          binning = psphotBackgroundBinning(image, config);
     62        }
     63        else {
     64          binning = ppBackgroundBinningByRecipe(image,config,
     65                                                psMetadataLookupStr(NULL,recipe,"BINNING_RECIPE"),
     66                                                psMetadataLookupStr(NULL,recipe,"BINNING_XNAME"),
     67                                                psMetadataLookupStr(NULL,recipe,"BINNING_YNAME"));
     68        }
     69                                               
     70        fprintf(stderr,"%d %d %d %d\n",binning->nXfine,binning->nYfine,binning->nXbin,binning->nYbin);
    3071        if (!binning) {
    3172            psError(psErrorCodeLast(), false, "Unable to find background binning");
     
    4990        for (int y = 0; y < numRows; y++) {
    5091            for (int x = 0; x < numCols; x++) {
     92              if ((y % 250 == 0)&&(x % 250 == 0)) {
     93                printf("%d %d %g\n",x,y,bgImage->data.F32[y][x]);
     94              }
    5195                image->data.F32[y][x] += bgImage->data.F32[y][x];
     96               
    5297            }
    5398        }
Note: See TracChangeset for help on using the changeset viewer.