IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 10, 2008, 3:27:05 PM (18 years ago)
Author:
Paul Price
Message:

Adding new function, pmFPAAddSourceFromFormat, to populate an FPA with HDUs appropriate for an output.

File:
1 edited

Legend:

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

    r15940 r16912  
    415415    psArray *cellNames = NULL;      // Cell names
    416416    psArray *cellTypes = NULL;      // Cell types
    417    
     417
    418418    int nParsed = 0;
    419419
    420420    switch (chipContents->type) {
    421421      case PS_DATA_STRING: {
    422           nParsed = parseContent(&cellNames, &cellTypes, NULL, chipContents->data.str);
    423           break;
     422          nParsed = parseContent(&cellNames, &cellTypes, NULL, chipContents->data.str);
     423          break;
    424424      }
    425425      case PS_DATA_METADATA: {
    426           psMetadataIterator *iter = psMetadataIteratorAlloc(chipContents->data.md, PS_LIST_HEAD, NULL); // Iterator
    427           psMetadataItem *item;           // Item from iteration
    428           while ((item = psMetadataGetAndIncrement(iter))) {
    429               if (item->type != PS_DATA_STRING) {
    430                   psWarning ("Item %s in camera format chip table is not of type STR.", item->name);
    431                   continue;
    432               }
    433               nParsed += parseContent(&cellNames, &cellTypes, NULL, item->data.str);
    434           }
    435           psFree (iter);
    436           break;
     426          psMetadataIterator *iter = psMetadataIteratorAlloc(chipContents->data.md, PS_LIST_HEAD, NULL); // Iterator
     427          psMetadataItem *item;           // Item from iteration
     428          while ((item = psMetadataGetAndIncrement(iter))) {
     429              if (item->type != PS_DATA_STRING) {
     430                  psWarning ("Item %s in camera format chip table is not of type STR.", item->name);
     431                  continue;
     432              }
     433              nParsed += parseContent(&cellNames, &cellTypes, NULL, item->data.str);
     434          }
     435          psFree (iter);
     436          break;
    437437      }
    438438      default:
    439         psWarning ("Item %s in camera format chip table is not of type STR.", chipContents->name);
    440         break;
     439        psWarning ("Item %s in camera format chip table is not of type STR.", chipContents->name);
     440        break;
    441441    }
    442442
    443443    if (nParsed == 0) {
    444         psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    445                 "Unable to parse chip contents (within %s in camera format) as cellName:cellType",
    446                 CHIP_TYPES);
    447         psFree(cellNames);
    448         psFree(cellTypes);
    449         return false;
     444        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     445                "Unable to parse chip contents (within %s in camera format) as cellName:cellType",
     446                CHIP_TYPES);
     447        psFree(cellNames);
     448        psFree(cellTypes);
     449        return false;
    450450    }
    451451
     
    13491349}
    13501350
     1351bool pmFPAAddSourceFromFormat(pmFPA *fpa, const char *fpaname, const psMetadata *format)
     1352{
     1353    PS_ASSERT_PTR_NON_NULL(fpa, false);
     1354    PS_ASSERT_METADATA_NON_NULL(format, false);
     1355
     1356    // Generate the correct structure
     1357    pmFPALevel phuLevel = pmFPAPHULevel(format); // Level at which PHU goes
     1358    pmFPAview *view = pmFPAviewAlloc(0);// View for current level
     1359    if (phuLevel == PM_FPA_LEVEL_FPA) {
     1360        if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) {
     1361            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
     1362            psFree(view);
     1363            return false;
     1364        }
     1365    } else {
     1366        pmChip *chip;                       // Chip from FPA
     1367        while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
     1368            if (phuLevel == PM_FPA_LEVEL_CHIP) {
     1369                if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) {
     1370                    psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
     1371                    psFree(view);
     1372                    return false;
     1373                }
     1374            } else {
     1375                pmCell *cell;                   // Cell from chip
     1376                while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
     1377                    if (phuLevel == PM_FPA_LEVEL_CELL) {
     1378                        if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) {
     1379                            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
     1380                            psFree(view);
     1381                            return false;
     1382                        }
     1383                    }
     1384                }
     1385            }
     1386        }
     1387    }
     1388    psFree(view);
     1389
     1390    return true;
     1391}
     1392
    13511393bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaname, const pmFPAview *phuView,
    13521394                            const psMetadata *format)
Note: See TracChangeset for help on using the changeset viewer.