IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 26, 2007, 4:44:42 PM (19 years ago)
Author:
magnier
Message:

converted binning operations to use the common pmImageBinning methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsUpdate.c

    r11749 r12589  
    2525        // Check for cell concepts updates
    2626
     27        bool xStatus, yStatus; // Status of MD lookups
     28        psImageBinning *binning = psImageBinningAlloc();
     29        binning->nXbin = psMetadataLookupS32(&xStatus, cell->concepts, "CELL.XBIN");
     30        binning->nYbin = psMetadataLookupS32(&yStatus, cell->concepts, "CELL.YBIN");
     31        if (!xStatus || !yStatus) {
     32            // XXX should this be an error condition?
     33            psFree (binning);
     34            return true;
     35        }
     36        if (!binning->nXbin || !binning->nXbin) {
     37            // XXX should this be an error condition?
     38            psFree (binning);
     39            return true;
     40        }
     41
    2742        // CELL.TRIMSEC needs to be updated for the binning
    2843        if (psMetadataLookup(cell->concepts, "CELL.TRIMSEC.UPDATE")) {
    29             bool xStatus, yStatus; // Status of MD lookups
    30             int xBin = psMetadataLookupS32(&xStatus, cell->concepts, "CELL.XBIN");
    31             int yBin = psMetadataLookupS32(&yStatus, cell->concepts, "CELL.YBIN");
    32             if (xStatus && yStatus && xBin != 0 && yBin != 0) {
    33                 psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC"); // Trim section
    34                 trimsec->x0 /= xBin;
    35                 trimsec->x1 /= xBin;
    36                 trimsec->y0 /= yBin;
    37                 trimsec->y1 /= yBin;
    38 
    39                 psMetadataRemoveKey(cell->concepts, "CELL.TRIMSEC.UPDATE");
    40             }
     44            psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC"); // Trim section
     45            *trimsec = psImageBinningSetRuffRegion (binning, *trimsec);
     46            psMetadataRemoveKey(cell->concepts, "CELL.TRIMSEC.UPDATE");
    4147        }
    4248
    4349        // CELL.BIASSEC needs to be updated for the binning
    4450        if (psMetadataLookup(cell->concepts, "CELL.BIASSEC.UPDATE")) {
    45             bool xStatus, yStatus; // Status of MD lookups
    46             int xBin = psMetadataLookupS32(&xStatus, cell->concepts, "CELL.XBIN");
    47             int yBin = psMetadataLookupS32(&yStatus, cell->concepts, "CELL.YBIN");
    48             if (xStatus && yStatus && xBin != 0 && yBin != 0) {
    49                 psList *biassecs = psMetadataLookupPtr(NULL, cell->concepts, "CELL.BIASSEC"); // Bias sections
    50                 psListIterator *biassecsIter = psListIteratorAlloc(biassecs, PS_LIST_HEAD, true); // Iterator
    51                 psRegion *bias; // Bias region, from iteration
    52                 while ((bias = psListGetAndIncrement(biassecsIter))) {
    53                     bias->x0 /= xBin;
    54                     bias->x1 /= xBin;
    55                     bias->y0 /= yBin;
    56                     bias->y1 /= yBin;
    57                 }
    58                 psFree(biassecsIter);
    59 
    60                 psMetadataRemoveKey(cell->concepts, "CELL.BIASSEC.UPDATE");
    61             }
     51            psList *biassecs = psMetadataLookupPtr(NULL, cell->concepts, "CELL.BIASSEC"); // Bias sections
     52            psListIterator *biassecsIter = psListIteratorAlloc(biassecs, PS_LIST_HEAD, true); // Iterator
     53            psRegion *biassec; // Bias region, from iteration
     54            while ((biassec = psListGetAndIncrement(biassecsIter))) {
     55                *biassec = psImageBinningSetRuffRegion (binning, *biassec);
     56            }
     57            psFree(biassecsIter);
     58            psMetadataRemoveKey(cell->concepts, "CELL.BIASSEC.UPDATE");
    6259        }
    63 
     60        psFree (binning);
    6461    }
    6562
Note: See TracChangeset for help on using the changeset viewer.