Changeset 12589 for trunk/psModules/src/concepts/pmConceptsUpdate.c
- Timestamp:
- Mar 26, 2007, 4:44:42 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConceptsUpdate.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsUpdate.c
r11749 r12589 25 25 // Check for cell concepts updates 26 26 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 27 42 // CELL.TRIMSEC needs to be updated for the binning 28 43 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"); 41 47 } 42 48 43 49 // CELL.BIASSEC needs to be updated for the binning 44 50 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"); 62 59 } 63 60 psFree (binning); 64 61 } 65 62
Note:
See TracChangeset
for help on using the changeset viewer.
