IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29125


Ignore:
Timestamp:
Sep 7, 2010, 9:29:02 AM (16 years ago)
Author:
eugene
Message:

allow user-options to change the simulated camera size : changes all possible formats (since actual format is unknown at this point)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimCreate.c

    r29011 r29125  
    2828    assert (config->camera);
    2929
    30     // int nx = psMetadataLookupS32 (&status, config->arguments, "NX.CELL");
    31     // if (nx) {
    32     //   psMetadata *defaults = psMetadataLookupPtr(&status, config->camera, "DEFAULTS");
    33     //   psMetadataLookupS32 (&status, defaults, "CELL.XSIZE");
    34     //   psAssert (status, "CELL.XSIZE should be in DEFAULTS");
    35     //   psMetadataAddF32(defaults, PS_LIST_TAIL, "CELL.XSIZE", PS_META_REPLACE, "", nx);
    36     // }
    37     // int ny = psMetadataLookupS32 (&status, config->arguments, "NY.CELL");
    38     // if (ny) {
    39     //   psMetadata *defaults = psMetadataLookupPtr(&status, config->camera, "DEFAULTS");
    40     //   psMetadataLookupS32 (&status, defaults, "CELL.YSIZE");
    41     //   psAssert (status, "CELL.YSIZE should be in DEFAULTS");
    42     //   psMetadataAddF32(defaults, PS_LIST_TAIL, "CELL.YSIZE", PS_META_REPLACE, "", ny);
    43     // }
     30    int nx = psMetadataLookupS32 (&status, config->arguments, "NX.CELL");
     31    int ny = psMetadataLookupS32 (&status, config->arguments, "NY.CELL");
     32
     33    if (nx || ny) {
     34      // need to find format(s)
     35      psMetadata *formats = psMetadataLookupPtr(&status, config->camera, "FORMATS");
     36      psAssert (formats, "FORMATS missing from camera config");
     37     
     38      psMetadataIterator *iter = psMetadataIteratorAlloc(formats, PS_LIST_HEAD, NULL); // Iterator
     39      psMetadataItem *format;               // Item from iteration
     40      while ((format = psMetadataGetAndIncrement(iter))) {
     41        psAssert (format->type == PS_DATA_METADATA, "unexpected format block");
     42       
     43        if (nx) {
     44          psMetadata *defaults = psMetadataLookupPtr(&status, format->data.md, "DEFAULTS");
     45          psMetadataLookupS32 (&status, defaults, "CELL.XSIZE");
     46          psAssert (status, "CELL.XSIZE should be in DEFAULTS");
     47          psMetadataAddF32(defaults, PS_LIST_TAIL, "CELL.XSIZE", PS_META_REPLACE, "", nx);
     48        }
     49        if (ny) {
     50          psMetadata *defaults = psMetadataLookupPtr(&status, format->data.md, "DEFAULTS");
     51          psMetadataLookupS32 (&status, defaults, "CELL.YSIZE");
     52          psAssert (status, "CELL.YSIZE should be in DEFAULTS");
     53          psMetadataAddF32(defaults, PS_LIST_TAIL, "CELL.YSIZE", PS_META_REPLACE, "", ny);
     54        }
     55      }
     56      psFree(iter);
     57    }
    4458
    4559    // generate the fpa structure used by the output camera (determined from INPUT or specified)
Note: See TracChangeset for help on using the changeset viewer.