Changeset 15229
- Timestamp:
- Oct 5, 2007, 2:03:35 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConceptsStandard.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsStandard.c
r15219 r15229 837 837 // Return a metadata item containing a list of metadata items of region strings 838 838 psList *biassecs = concept->data.V; // The biassecs region list 839 psListIterator *biassecsIter = psListIteratorAlloc(biassecs, PS_LIST_HEAD, false); // Iterator840 psRegion *region = NULL; // Region from iteration841 839 psList *new = psListAlloc(NULL); // New list containing metadatas 842 while ((region = psListGetAndIncrement(biassecsIter))) { 843 844 // Correct bias section for binning if it's specified explicitly (i.e., immutably) in the CELLS. 845 if (source == PM_CONCEPT_SOURCE_CELLS) { 846 bool xStatus, yStatus; // Status of MD lookups 847 int xBin = psMetadataLookupS32(&xStatus, cell->concepts, "CELL.XBIN"); 848 int yBin = psMetadataLookupS32(&yStatus, cell->concepts, "CELL.YBIN"); 849 if (!xStatus || !yStatus || xBin == 0 || yBin == 0) { 850 psWarning("Unable to find CELL.XBIN and CELL.YBIN to correct CELL.BIASSEC.\n"); 840 if (biassecs) { 841 psListIterator *biassecsIter = psListIteratorAlloc(biassecs, PS_LIST_HEAD, false); // Iterator 842 psRegion *region = NULL; // Region from iteration 843 while ((region = psListGetAndIncrement(biassecsIter))) { 844 // Correct bias section for binning if it's specified explicitly (i.e., immutably) in the CELLS. 845 if (source == PM_CONCEPT_SOURCE_CELLS) { 846 bool xStatus, yStatus; // Status of MD lookups 847 int xBin = psMetadataLookupS32(&xStatus, cell->concepts, "CELL.XBIN"); 848 int yBin = psMetadataLookupS32(&yStatus, cell->concepts, "CELL.YBIN"); 849 if (!xStatus || !yStatus || xBin == 0 || yBin == 0) { 850 psWarning("Unable to find CELL.XBIN and CELL.YBIN to correct CELL.BIASSEC.\n"); 851 } else { 852 psRegion *newTrimsec = psRegionAlloc(region->x0 * xBin, region->x1 * xBin, 853 region->y0 * yBin, region->y1 * yBin); 854 region = newTrimsec; 855 } 851 856 } else { 852 psRegion *newTrimsec = psRegionAlloc(region->x0 * xBin, region->x1 * xBin, 853 region->y0 * yBin, region->y1 * yBin); 854 region = newTrimsec; 857 psMemIncrRefCounter(region); 855 858 } 856 } else { 857 psMemIncrRefCounter(region); 858 } 859 860 psString regionString = psRegionToString(*region); // The string region "[x0:x1,y0:y1]" 861 psFree(region); 862 psMetadataItem *item = psMetadataItemAllocStr(concept->name, concept->comment, regionString); 863 psFree(regionString); // Drop reference 864 psListAdd(new, PS_LIST_TAIL, item); 865 psFree(item); // Drop reference 866 } 867 psFree(biassecsIter); 859 860 psString regionString = psRegionToString(*region); // The string region "[x0:x1,y0:y1]" 861 psFree(region); 862 psMetadataItem *item = psMetadataItemAllocStr(concept->name, concept->comment, regionString); 863 psFree(regionString); // Drop reference 864 psListAdd(new, PS_LIST_TAIL, item); 865 psFree(item); // Drop reference 866 } 867 psFree(biassecsIter); 868 } 869 868 870 psMetadataItem *formatted = psMetadataItemAllocPtr(concept->name, PS_DATA_LIST, concept->comment, new); 869 871 psFree(new); // Drop reference
Note:
See TracChangeset
for help on using the changeset viewer.
