IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2010, 12:49:05 PM (16 years ago)
Author:
eugene
Message:

merging changes from trunk into branches/pap

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/psModules/src/camera/pmFPAConstruct.c

    r22699 r28003  
    100100
    101101    return num;
    102 }
    103 
    104 // Get the name of a PHU chip or cell from the header
    105 static psString phuNameFromHeader(const char *name, // The name to lookup: "CELL.NAME" or "CHIP.NAME"
    106                                   const psMetadata *fileInfo, // FILE within the camera format description
    107                                   const psMetadata *header // Primary header
    108                                  )
    109 {
    110     assert(name && strlen(name) > 0);
    111     assert(fileInfo);
    112     assert(header);
    113 
    114     bool mdok = true;                   // Result of MD lookup
    115     psString keyword = psMetadataLookupStr(&mdok, fileInfo, name);
    116     if (!mdok || strlen(keyword) == 0) {
    117         return false;
    118     }
    119     psMetadataItem *resultItem = psMetadataLookup(header, keyword);
    120     if (!resultItem) {
    121         psError(PS_ERR_IO, true, "Unable to find %s in primary header to identify %s.\n", keyword, name);
    122         return NULL;
    123     }
    124     return psMetadataItemParseString(resultItem);
    125102}
    126103
     
    11021079// It returns a view corresponding to the PHU
    11031080static pmFPAview *addSource(pmFPA *fpa,       // The FPA
    1104                             const char *fpaObs, // The desired FPA observation name
    11051081                            const pmFPAview *phuView, // The view corresponding to the PHU, or NULL
    11061082                            const psMetadata *header, // The PHU header, or NULL
     
    11141090
    11151091    bool mdok;                          // Status of MD lookup
    1116 
    1117     // If FPA.OBS is already defined, new name must match it; otherwise, warn the user that something
    1118     // potentially bad is happening.
    1119     if (fpaObs && install) {
    1120         const char *currentName = psMetadataLookupStr(&mdok, fpa->concepts, "FPA.OBS"); // Current name
    1121         if (mdok && currentName && strlen(currentName) > 0 && strcmp(currentName, fpaObs) != 0) {
    1122             psWarning("FPA.OBS for new source (%s) doesn't match FPA.OBS for current fpa (%s).",
    1123                       fpaObs, currentName);
    1124         }
    1125         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.OBS", PS_META_REPLACE, "Observation identifier",
    1126                          fpaObs);
    1127     } else if (!psMetadataLookup(fpa->concepts, "FPA.OBS")) {
    1128         // Make sure there is an FPA.OBS
    1129         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.OBS", 0, "Observation identifier", "UNKNOWN");
    1130     }
    11311092
    11321093    psMetadata *fileInfo = psMetadataLookupMetadata(&mdok, format, "FILE"); // The file information
     
    13501311}
    13511312
    1352 bool pmFPAAddSourceFromFormat(pmFPA *fpa, const char *fpaObs, const psMetadata *format)
     1313bool pmFPAAddSourceFromFormat(pmFPA *fpa, const psMetadata *format)
    13531314{
    13541315    PS_ASSERT_PTR_NON_NULL(fpa, false);
     
    13591320    pmFPAview *view = pmFPAviewAlloc(0);// View for current level
    13601321    if (phuLevel == PM_FPA_LEVEL_FPA) {
    1361         if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1322        if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13621323            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13631324            psFree(view);
     
    13681329        while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
    13691330            if (phuLevel == PM_FPA_LEVEL_CHIP) {
    1370                 if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1331                if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13711332                    psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13721333                    psFree(view);
     
    13771338                while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    13781339                    if (phuLevel == PM_FPA_LEVEL_CELL) {
    1379                         if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1340                        if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13801341                            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13811342                            psFree(view);
     
    13921353}
    13931354
    1394 bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaObs, const pmFPAview *phuView,
     1355bool pmFPAAddSourceFromView(pmFPA *fpa, const pmFPAview *phuView,
    13951356                            const psMetadata *format)
    13961357{
     
    13991360    PS_ASSERT_PTR_NON_NULL(format, false);
    14001361
    1401     pmFPAview *view = addSource(fpa, fpaObs, phuView, NULL, format, true);
     1362    pmFPAview *view = addSource(fpa, phuView, NULL, format, true);
    14021363    bool status = (view != NULL);
    14031364    psFree(view);
     
    14181379    }
    14191380
    1420     // Check the name of the FPA
    1421     psString fpaObs = phuNameFromHeader("FPA.OBS", fileInfo, phu); // New observation name for the FPA
    1422     if (!fpaObs || strlen(fpaObs) == 0) {
    1423         psWarning("Unable to determine FPA.OBS: check for FPA.OBS in FILE in camera format");
    1424     }
    1425 
    1426     pmFPAview *view = addSource(fpa, fpaObs, NULL, phu, format, true); // View of PHU, to return
    1427     psFree(fpaObs);
     1381    pmFPAview *view = addSource(fpa, NULL, phu, format, true); // View of PHU, to return
    14281382
    14291383    return view;
     
    14371391    PS_ASSERT_PTR_NON_NULL(format, NULL);
    14381392
    1439     return addSource(fpa, NULL, NULL, phu, format, false);
     1393    return addSource(fpa, NULL, phu, format, false);
    14401394}
    14411395
Note: See TracChangeset for help on using the changeset viewer.