IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 9, 2010, 6:16:39 PM (16 years ago)
Author:
Paul Price
Message:

Coding more or less done. Need to add ppStats call. Compiles.

Location:
trunk/ppBackground
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppBackground

    • Property svn:ignore set to
      configure
      Makefile.in
      ignore
      config.log
      depcomp
      config.status
      config.guess
      ltmain.sh
      config.sub
      autom4te.cache
      libtool
      missing
      Makefile
      aclocal.m4
      install-sh
  • trunk/ppBackground/src

    • Property svn:ignore set to
      ppBackground
      Makefile.in
      config.h
      ppBackgroundVersionDefinitions.h
      .deps
      Makefile
      ppBackgroundErrorCodes.c
      ppBackgroundErrorCodes.h
      stamp-h1
      config.h.in
  • trunk/ppBackground/src/ppBackgroundLoop.c

    r28276 r28280  
    1313{
    1414    pmConfig *config = data->config;                                        // Configuration data
    15     pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.BACKGROUND", 0);
     15    pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.IMAGE", 0);
    1616    pmFPAfile *patternFile = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.PATTERN", 0); // File with data
     17    pmFPAfile *bgFile = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.BACKGROUND", 0);   // File with bg
    1718    pmFPA *patternMosaic = pmFPAConstruct(file->camera, file->cameraName); // Mosaicked FPA for pattern
    1819
     
    3435        }
    3536
    36         if (chip->cell->n > 1) {
     37        if (chip->cells->n > 1) {
    3738            psError(PPBACKGROUND_ERR_CONFIG, true,
    3839                    "Input image and background model should be chip-mosaicked");
     
    4445            pmFPAfileActivate(config->files, true, "PPBACKGROUND.PATTERN");
    4546
    46             pmCell *cell;               // Cell with pattern data
     47            pmCell *patternCell;               // Cell with pattern data
    4748            while ((patternCell = pmFPAviewNextCell(view, patternFile->fpa, 1))) {
    48                 if (!cell->process || !cell->file_exists) {
     49                if (!patternCell->process || !patternCell->file_exists) {
    4950                    continue;
    5051                }
     
    6869                    // Get size of image from concepts
    6970                    if (numCols == 0 || numRows == 0) {
    70                         numCols = psMetadataLookupS32(NULL, cell->concepts, "CELL.XSIZE");
    71                         numRows = psMetadataLookupS32(NULL, cell->concepts, "CELL.YSIZE");
     71                        numCols = psMetadataLookupS32(NULL, patternCell->concepts, "CELL.XSIZE");
     72                        numRows = psMetadataLookupS32(NULL, patternCell->concepts, "CELL.YSIZE");
    7273                    }
    7374                    // Get size of image from TRIMSEC
    7475                    if (numCols == 0 || numRows == 0) {
    75                         psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC");
     76                        psRegion *trimsec = psMetadataLookupPtr(NULL, patternCell->concepts, "CELL.TRIMSEC");
    7677                        numCols = trimsec->x1 - trimsec->x0;
    7778                        numRows = trimsec->y1 - trimsec->y0;
     
    9192
    9293                    // Remove bias sections to avoid warnings
    93                     psMetadataItem *biassec = psMetadataLookup(patternRO->parent->concepts, "CELL.BIASSEC");
     94                    psMetadataItem *biassec = psMetadataLookup(patternCell->concepts, "CELL.BIASSEC");
    9495                    if (psListLength(biassec->data.V)) {
    9596                        psFree(biassec->data.V);
     
    123124        }
    124125
     126        pmChip *patternChip = patternFile ? pmFPAviewThisChip(view, patternMosaic) : NULL; // Chip with pattern
     127        pmChip *bgChip = bgFile ? pmFPAviewThisChip(view, bgFile->fpa) : NULL; // Chip with background model
     128        if (!ppBackgroundRestore(chip, bgChip, patternChip, view, config)) {
     129            psError(psErrorCodeLast(), false, "Unable to replace background");
     130            return false;
     131        }
     132        pmChipFreeData(patternChip);
    125133
    126 
    127 
    128 
    129 
    130 
    131                 pmHDU *hdu = pmHDUGetLowest(file->fpa, chip, cell); // HDU for readout
    132                 if (!hdu) {
    133                     psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find HDU for data.");
    134                     return false;
    135                 }
    136                 if (!hdu->header) {
    137                     hdu->header = psMetadataAlloc();
    138                 }
    139                 ppBackgroundVersionHeader(hdu->header);
    140 
    141 
    142 
    143 
    144 
    145 
    146 
     134        pmHDU *hdu = pmHDUGetLowest(file->fpa, chip, NULL); // HDU for chip
     135        if (!hdu) {
     136            psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find HDU for data.");
     137            return false;
     138        }
     139        if (!hdu->header) {
     140            hdu->header = psMetadataAlloc();
     141        }
     142        ppBackgroundVersionHeader(hdu->header);
    147143
    148144        // Chip
     
    158154    }
    159155
     156    psFree(view);
     157    psFree(patternMosaic);
     158
    160159    return true;
    161160}
Note: See TracChangeset for help on using the changeset viewer.