IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2007, 3:21:11 PM (19 years ago)
Author:
Paul Price
Message:

Have just changed the meaning of CONTENT in FILE in the camera format.
Also, CHIP.NAME and CELL.NAME are no longer defined in FILE in the
camera format. So needed to update here to ensure the correct CONTENT
is written to the file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAWrite.c

    r13841 r15094  
    5757        }
    5858    }
    59     if (chip) {
    60         const char *chipNameHdr = psMetadataLookupStr(&mdok, fileData, "CHIP.NAME");
    61         if (mdok && chipNameHdr && strlen(chipNameHdr) > 0) {
    62             const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME");
    63             psMetadataAddStr(hdu->header, PS_LIST_TAIL, chipNameHdr, PS_META_REPLACE, "Chip name", chipName);
    64         }
    65     }
    66     if (cell) {
    67         const char *cellNameHdr = psMetadataLookupStr(&mdok, fileData, "CELL.NAME");
    68         if (mdok && cellNameHdr && strlen(cellNameHdr) > 0) {
    69             const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME");
    70             psMetadataAddStr(hdu->header, PS_LIST_TAIL, cellNameHdr, PS_META_REPLACE, "Cell name", cellName);
    71         }
    72     }
     59
     60    if (chip || cell) {
     61        const char *rule = psMetadataLookupStr(NULL, fileData, "CONTENT.RULE"); // How to define the CONTENT
     62        if (!rule) {
     63            psError(PS_ERR_UNKNOWN, false, "Unable to find CONTENT.RULE in FILE in camera format.");
     64            return false;
     65        }
     66
     67        pmFPAview *view = pmFPAViewGenerate(fpa, chip, cell, NULL); // View for fpa, chip, cell
     68        psString *content = pmFPANameFromRule(rule, fpa, view); // Content of this file, specified by the rule
     69        psFree(view);
     70
     71        const char *contentKey = psMetadataLookupStr(NULL, fileData, "CONTENT"); // The CONTENT header keyword
     72        if (!contentKey) {
     73            psError(PS_ERR_UNKNOWN, false, "Unable to find CONTENT in FILE in the camera format.");
     74            psFree(content);
     75            return false;
     76        }
     77
     78        psMetadataAddStr(hdu->header, PS_LIST_END, contentKey, PS_META_REPLACE, "Content of file", content);
     79        psFree(content);                // Drop reference
     80    }
     81
    7382    return true;
    7483}
Note: See TracChangeset for help on using the changeset viewer.