IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 11, 2007, 5:18:11 PM (19 years ago)
Author:
Paul Price
Message:

Attempt to set TRIMSEC and BIASSEC from the camera format if they are specified by value.

File:
1 edited

Legend:

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

    r15229 r15299  
    329329}
    330330
     331
     332psList *p_pmConceptParseRegions(const char *region)
     333{
     334    assert(region && strlen(region) > 0);
     335
     336    psList *list = psListAlloc(NULL);   // List of regions
     337
     338    // a single BIASSEC is of the form [AAAA]
     339    // we may have multiple BIASSEC entries separated by space, commas, or semicolons
     340    int xParity = 0, yParity = 0;       // Parity of region
     341    char *p = strchr (region, '[');
     342    while (p) {
     343        char *q = strchr (p, ']');
     344        if (!q) {
     345            break;
     346        }
     347        char *regionString = psStringAlloc(q - p + 2);
     348        strncpy (regionString, p, q - p + 1);
     349        regionString[q - p + 1] = 0;
     350
     351        psRegion *region = psAlloc(sizeof(psRegion)); // The region
     352        *region = psRegionAndParityFromString(&xParity, &yParity, regionString);
     353        psListAdd(list, PS_LIST_TAIL, region);
     354        psFree(region);           // Drop reference
     355        psFree(regionString);     // Drop reference
     356
     357        p = strchr (q, '[');
     358    }
     359
     360    return list;
     361}
     362
    331363psMetadataItem *p_pmConceptParse_CELL_BIASSEC(const psMetadataItem *concept,
    332364                                              const psMetadataItem *pattern,
     
    341373    assert(pattern);
    342374
    343     psList *biassecs = psListAlloc(NULL); // List of bias sections
     375    psList *biassecs; // List of bias sections
    344376
    345377    switch (concept->type) {
    346378      case PS_DATA_STRING: {
    347           // a single BIASSEC is of the form [AAAA]
    348           // we may have multiple BIASSEC entries separated by space, commas, or semicolons
    349           int xParity = 0;
    350           int yParity = 0;
    351           char *p = strchr (concept->data.V, '[');
    352           while (p != NULL) {
    353               char *q = strchr (p, ']');
    354               if (q == NULL) break;
    355               char *regionString = psAlloc (q - p + 2);
    356               strncpy (regionString, p, q - p + 1);
    357               regionString[q - p + 1] = 0;
    358 
    359               psRegion *region = psAlloc(sizeof(psRegion)); // The region
    360               *region = psRegionAndParityFromString(&xParity, &yParity, regionString);
    361               psListAdd(biassecs, PS_LIST_TAIL, region);
    362               psFree(region);           // Drop reference
    363               psFree(regionString);     // Drop reference
    364 
    365               p = strchr (q, '[');
    366           }
     379          biassecs = p_pmConceptParseRegions(concept->data.V);
    367380          break;
    368381      }
    369382      case PS_DATA_LIST: {
     383          biassecs = psListAlloc(NULL);
    370384          psList *regions = concept->data.V; // The list of regions
    371385          psListIterator *regionsIter = psListIteratorAlloc(regions, PS_LIST_HEAD, false); // Iterator
Note: See TracChangeset for help on using the changeset viewer.