IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19873


Ignore:
Timestamp:
Oct 2, 2008, 3:49:49 PM (18 years ago)
Author:
Paul Price
Message:

Copy the header from the (target) skycell into the output. This puts NAXIS[12] into the output.
Fix the CELL.TRIMSEC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpLoop.c

    r18924 r19873  
    288288    psFree(cells);
    289289
     290    psRegion *trimsec = psMetadataLookupPtr(NULL, outCell->concepts, "CELL.TRIMSEC"); // Trim section
     291    trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; // All pixels
     292
    290293    if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) {
    291294        psError(PS_ERR_UNKNOWN, false, "Unable to copy FPA concepts from input to output.");
    292295        psFree(stats);
    293296        psFree(view);
     297        return false;
     298    }
     299
     300    pmHDU *hdu = outFPA->hdu;           // HDU for the output warped image
     301
     302    // Copy header from target
     303    {
     304        pmFPAview *skyView = pmFPAviewAlloc(0); // View into skycell
     305        skyView->chip = skyView->cell = 0;
     306        pmCell *cell = pmFPAfileThisCell(config->files, skyView, "PSWARP.SKYCELL"); // Skycell cell
     307        pmHDU *skyHDU = pmHDUFromCell(cell); // HDU
     308        if (!skyHDU) {
     309            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find skycell HDU.");
     310            psFree(skyView);
     311            psFree(view);
     312            return false;
     313        }
     314        hdu->header = psMetadataCopy(hdu->header, skyHDU->header);
     315    }
     316
     317    if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {
     318        psError(PS_ERR_UNKNOWN, false, "Unable to generate WCS header.");
     319        psFree(stats);
    294320        return false;
    295321    }
     
    345371            psWarning("Unable to perform statistics on warped image.");
    346372        }
    347     }
    348 
    349     pmHDU *hdu = outFPA->hdu;           // HDU for the output warped image
    350     if (!hdu->header) {
    351         hdu->header = psMetadataAlloc();
    352     }
    353 
    354     if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {
    355         psError(PS_ERR_UNKNOWN, false, "Unable to generate WCS header.");
    356         psFree(stats);
    357         return false;
    358373    }
    359374
Note: See TracChangeset for help on using the changeset viewer.