IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8821


Ignore:
Timestamp:
Sep 18, 2006, 9:23:40 AM (20 years ago)
Author:
Paul Price
Message:

Building in header inheritance --- if the header keyword isn't in the
lowest level, check the higher level (PHU) as well.

File:
1 edited

Legend:

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

    r8815 r8821  
    265265    PS_ASSERT_PTR_NON_NULL(target, false);
    266266
    267     pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
    268     if (!hdu) {
     267    pmHDU *hduLow = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
     268    if (!hduLow) {
    269269        psError(PS_ERR_UNKNOWN, true, "Can't find HDU at lowest level");
    270270        return false;
    271271    }
    272     psMetadata *cameraFormat = hdu->format; // The camera format
     272    pmHDU *hduHigh = pmHDUGetHighest(fpa, chip, cell); // The HDU at the highest level
     273    if (!hduHigh) {
     274        psError(PS_ERR_UNKNOWN, true, "Can't find HDU at the highest level");
     275        return false;
     276    }
     277    assert(hduLow->format == hduHigh->format); // Just in case....
     278    psMetadata *cameraFormat = hduLow->format; // The camera format
    273279    bool mdok = true;                   // Status of MD lookup
    274280    psMetadata *transSpec = psMetadataLookupMD(&mdok, cameraFormat, "TRANSLATION"); // The TRANSLATION spec
     
    295301                psFree(nameSource);
    296302                if (mdok && strlen(source) && strcasecmp(source, "HEADER") == 0) {
    297                     headerItem = psMemIncrRefCounter(psMetadataLookup(hdu->header, conceptItem->data.V));
     303                    headerItem = psMetadataLookup(hduLow->header, conceptItem->data.V);
     304                    if (!headerItem && hduHigh != hduLow) {
     305                        headerItem = psMetadataLookup(hduHigh->header, conceptItem->data.V);
     306                    }
     307                    psMemIncrRefCounter(headerItem);
    298308                }
    299309                // Leave the error handling to pmConceptsFromCamera, which should already have been called
     
    307317                if (keys->n == 1) {
    308318                    // Only one key --- proceed as usual
    309                     headerItem = psMemIncrRefCounter(psMetadataLookup(hdu->header, keywords));
     319                    headerItem = psMetadataLookup(hduLow->header, keywords);
     320                    if (!headerItem && hduHigh != hduLow) {
     321                        headerItem = psMetadataLookup(hduHigh->header, keywords);
     322                    }
     323                    psMemIncrRefCounter(headerItem);
    310324                } else {
    311325                    psListIterator *keysIter = psListIteratorAlloc(keys, PS_LIST_HEAD, false); // Iterator
     
    313327                    psList *values = psListAlloc(NULL); // List containing the values
    314328                    while ((key = psListGetAndIncrement(keysIter))) {
    315                         psMetadataItem *value = psMetadataLookup(hdu->header, key);
     329                        psMetadataItem *value = psMetadataLookup(hduLow->header, key);
     330                        if (!value && hduHigh != hduLow) {
     331                            value = psMetadataLookup(hduHigh->header, key);
     332                        }
     333                        if (!value) {
     334                            psWarning("Unable to find header %s --- assuming value is NULL", key);
     335                        }
    316336                        psListAdd(values, PS_LIST_TAIL, value);
    317337                    }
Note: See TracChangeset for help on using the changeset viewer.