IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 14, 2006, 2:40:02 PM (20 years ago)
Author:
Paul Price
Message:

Adding functions to write masks. For this to work, had to add mask handling to pmHDUGenerate, and figured I may as well add weights as well.

File:
1 edited

Legend:

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

    r9609 r9983  
    124124}
    125125
    126 // XXX: Add a region specifier?
    127 bool pmHDUWrite(pmHDU *hdu, psFits *fits)
     126// Write an HDU to a FITS file
     127bool hduWrite(pmHDU *hdu,               // HDU to write
     128              psArray *images,          // Images to write
     129              psFits *fits              // FITS file to which to write
     130             )
    128131{
    129     PS_ASSERT_PTR_NON_NULL(hdu, false);
    130     PS_ASSERT_PTR_NON_NULL(fits, false);
     132    assert(hdu);
     133    assert(fits);
    131134
    132135    psTrace("psModules.camera", 7, "Writing HDU %s\n", hdu->extname);
    133136
    134     if (hdu->images && !hdu->header) {
    135         psError(PS_ERR_IO, true, "Both image and table data provided in HDU, but no header --- "
    136                 "don't know which to write!\n");
    137         return false;
    138     }
    139 
    140     if (!hdu->images && !hdu->header) {
     137    if (!images && !hdu->header) {
    141138        psLogMsg(__func__, PS_LOG_WARN, "Nothing to write for HDU %s\n", hdu->extname);
    142139        return false;
     
    154151
    155152    // Only a header
    156     if (!hdu->images && !psFitsWriteBlank(fits, hdu->header, extname)) {
     153    if (!images && !psFitsWriteBlank(fits, hdu->header, extname)) {
    157154        psError(PS_ERR_IO, false, "Unable to write header for extension %s\n", extname);
    158155    }
    159156
    160     if (hdu->images) {
     157    if (images) {
    161158        psTrace("psModules.camera", 9, "Writing pixels for %s\n", hdu->extname);
    162         if (!psFitsWriteImageCube(fits, hdu->header, hdu->images, extname)) {
     159        if (!psFitsWriteImageCube(fits, hdu->header, images, extname)) {
    163160            psError(PS_ERR_IO, false, "Unable to write image to extension %s\n", hdu->extname);
    164161            return false;
     
    168165}
    169166
     167// XXX: Add a region specifier?
     168bool pmHDUWrite(pmHDU *hdu, psFits *fits)
     169{
     170    PS_ASSERT_PTR_NON_NULL(hdu, false);
     171    PS_ASSERT_PTR_NON_NULL(fits, false);
     172
     173    return hduWrite(hdu, hdu->images, fits);
     174}
     175
     176bool pmHDUWriteMask(pmHDU *hdu, psFits *fits)
     177{
     178    PS_ASSERT_PTR_NON_NULL(hdu, false);
     179    PS_ASSERT_PTR_NON_NULL(fits, false);
     180
     181    return hduWrite(hdu, hdu->masks, fits);
     182}
     183
Note: See TracChangeset for help on using the changeset viewer.