Changeset 10511 for trunk/psModules/src/concepts/pmConceptsStandard.c
- Timestamp:
- Dec 6, 2006, 2:44:44 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConceptsStandard.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsStandard.c
r10447 r10511 558 558 TYPE_CASE(offset, concept, S16); 559 559 TYPE_CASE(offset, concept, S32); 560 #if 0 561 562 case PS_DATA_STRING: { 563 // Interpret as a region specifier [x0:x1,y0:y1] 564 psRegion region = psRegionFromString(concept->data.V); 565 if (strstr(pattern->name, ".X0")) { 566 offset = region.x0; 567 } else if (strstr(pattern->name, ".Y0")) { 568 offset = region.y0; 569 } else if (strstr(pattern->name, ".X1")) { 570 offset = region.x1; 571 } else if (strstr(pattern->name, ".Y1")) { 572 offset = region.y1; 573 } else { 574 psError(PS_ERR_UNKNOWN, true, 575 "Unable to interpret %s because unable to determine if concept is X or Y.\n", 576 pattern->name); 577 return NULL; 578 } 579 break; 580 } 581 #endif 560 582 default: 561 583 if (concept->type == PS_TYPE_F32 && concept->data.F32 - (int)concept->data.F32 == 0) { … … 630 652 strcasecmp(xKeyword, yKeyword) == 0) { 631 653 psMetadataItem *yBinItem = psMetadataLookup(cell->concepts, "CELL.YBIN"); // Binning factor in y 632 psString binString = psStringCopy("");654 psString binString = NULL; 633 655 psStringAppend(&binString, "%d %d", concept->data.S32, yBinItem->data.S32); 634 656 psMetadataItem *binItem = psMetadataItemAllocStr(concept->name, concept->comment, binString); … … 809 831 } 810 832 833 811 834 psMetadataItem *p_pmConceptFormat_Positions(const psMetadataItem *concept, 812 835 const psMetadata *cameraFormat, … … 822 845 return NULL; 823 846 } 847 848 #if 0 849 // If both the X0 and Y0 positions are specified by the same header keyword, write both together, as part 850 // of the call for the X0 position. 851 // This is a bit of a kludge --- we're going to write it out as [x0:0,y0:0]. This means that we will be 852 // able to read it back in, but we've destroyed the x1 and y1 if it was present. 853 // We *could* attempt to read the header, parse the region, and only update the ones that we're trying 854 // to update. Consider this an upgrade option later. 855 // Alternatively, we could add X1 and Y1 concepts, and write the whole lot out together. 856 // But until we care about X1 and Y1, it doesn't really matter --- if you want X1 and Y1, look at X0 and 857 // Y0 and add NXAIS1 and NAXIS2, respectively.... 858 if (strstr(concept->name, ".X0")) { 859 psString companion = psStringCopy(concept->name); // Companion entry: ".Y" where this one has ".X" 860 psStringSubstitute(&companion, ".Y0", ".X0"); 861 862 // Look both up in the camera format config 863 psMetadata *translation = psMetadataLookupMetadata(NULL, cameraFormat, "TRANSLATION"); 864 bool xFound = true, yFound = true; // Status of MD lookups 865 psString xKeyword = psMetadataLookupStr(&xFound, translation, concept->name); 866 psString yKeyword = psMetadataLookupStr(&yFound, translation, companion); 867 if (xFound && yFound && strlen(xKeyword) > 0 && strlen(yKeyword) > 0 && 868 strcasecmp(xKeyword, yKeyword) == 0) { 869 psMetadataItem *yItem = psMetadataLookup(cell->concepts, companion); // Corresponding y value 870 871 int x = concept->data.S32 + fortranCorr(cameraFormat, concept->name); // x value 872 int y = yItem->data.S32 + fortranCorr(cameraFormat, companion); // y value 873 874 psRegion region = psRegionSet(x, x, y, y); 875 psString string = psRegionToString(region); 876 psMetadataItem *binItem = psMetadataItemAllocStr(concept->name, concept->comment, string); 877 psFree(string); 878 psFree(companion); 879 return binItem; 880 } 881 psFree(companion); 882 } else if (strstr(concept->name, ".Y0")) { 883 psString companion = psStringCopy(concept->name); // Companion entry: ".Y" where this one has ".X" 884 psStringSubstitute(&companion, ".X0", ".Y0"); 885 886 // Look both up in the camera format config 887 psMetadata *translation = psMetadataLookupMetadata(NULL, cameraFormat, "TRANSLATION"); 888 bool xFound = true, yFound = true; // Status of MD lookups 889 psString xKeyword = psMetadataLookupStr(&xFound, translation, concept->name); 890 psString yKeyword = psMetadataLookupStr(&yFound, translation, companion); 891 psFree(companion); 892 if (xFound && yFound && strlen(xKeyword) > 0 && strlen(yKeyword) > 0 && 893 strcasecmp(xKeyword, yKeyword) == 0) { 894 return NULL; // We did it with the X; don't do anything. 895 } 896 } 897 #endif 898 824 899 int offset = concept->data.S32; 825 900 offset += fortranCorr(cameraFormat, concept->name);
Note:
See TracChangeset
for help on using the changeset viewer.
