IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14204


Ignore:
Timestamp:
Jul 13, 2007, 5:18:45 PM (19 years ago)
Author:
magnier
Message:

dropping pmFPA.wrote_phu; adding pmFPAviewFitsWritePHU function

File:
1 edited

Legend:

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

    r12832 r14204  
    2626    PS_ASSERT_PTR_NON_NULL(view, NULL);
    2727
    28     if (//file->camera == config->camera || // Need to mosaic, not copy
    29             !file->format) {                // Working with the same output format as input format
     28    if (!file->format) {                // Working with the same output format as input format
    3029        return psMemIncrRefCounter(file->fpa);
    3130    }
     
    8281    }
    8382    psFree(phuView);
    84 
    85     // preserve this state variable
    86     copy->wrote_phu = file->fpa->wrote_phu;
    8783
    8884    switch (level) {
     
    467463
    468464#endif
     465
     466bool pmFPAviewFitsWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) {
     467
     468    bool status = false;
     469
     470    if (file->mode != PM_FPA_MODE_WRITE) return true;
     471    if (file->wrote_phu) return true;
     472
     473    // select or generate the desired fpa in the correct output format
     474    pmFPA *fpa = pmFPAfileSuitableFPA(file, view, config);
     475
     476    switch (file->fileLevel) {
     477      case PM_FPA_LEVEL_FPA:
     478        status = pmFPAWrite(fpa, file->fits, NULL, true, false);
     479        break;
     480      case PM_FPA_LEVEL_CHIP: {
     481          pmChip *chip = pmFPAviewThisChip(view, fpa);
     482          status = pmChipWrite(chip, file->fits, NULL, true, false);
     483          break;
     484      }
     485      case PM_FPA_LEVEL_CELL: {
     486          pmCell *cell = pmFPAviewThisCell(view, fpa);
     487          status = pmCellWrite(cell, file->fits, NULL, true);
     488          break;
     489      }
     490      default:
     491        psAbort("fileLevel not correctly set");
     492        break;
     493    }
     494
     495    if (!status) {
     496        psError(PS_ERR_UNKNOWN, false, "failed to write PHU for Image %s (%s)\n", file->filename, file->name);
     497        return false;
     498    }
     499
     500    psFree(fpa);
     501    file->wrote_phu = true;
     502    return true;
     503}
Note: See TracChangeset for help on using the changeset viewer.