IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 4, 2008, 10:21:35 PM (18 years ago)
Author:
Paul Price
Message:

Provide mask and mask value when writing an HDU. This is required for the case when a large masked region of the image has been set to a constant (or close to a constant). If the mask is not provided in this case, then the standard deviation is under-estimated, leading to a choice of BSCALE,BZERO that adversely affects the dynamic range of the image. Mask value comes from MASK.VALUE using pmConfigMaskGet.

File:
1 edited

Legend:

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

    r15973 r19385  
    99
    1010#include "pmConfig.h"
     11#include "pmConfigMask.h"
    1112#include "pmHDU.h"
    1213#include "pmFPA.h"
     
    164165// Write an HDU to a FITS file
    165166static bool hduWrite(pmHDU *hdu,        // HDU to write
    166                      psArray *images,   // Images to write
     167                     const psArray *images, // Images to write
     168                     const psArray *masks, // Masks to use when writing
     169                     psMaskType maskVal,// Value to mask
    167170                     psFits *fits       // FITS file to which to write
    168171                    )
     
    205208    if (images) {
    206209        psTrace("psModules.camera", 9, "Writing pixels for %s\n", hdu->extname);
    207         if (!psFitsWriteImageCube(fits, hdu->header, images, extname)) {
     210        if (!psFitsWriteImageCubeWithMask(fits, hdu->header, images, masks, maskVal, extname)) {
    208211            psError(PS_ERR_IO, false, "Unable to write image to extension %s\n", hdu->extname);
    209212            return false;
     
    214217
    215218// XXX: Add a region specifier?
    216 bool pmHDUWrite(pmHDU *hdu, psFits *fits)
    217 {
    218     PS_ASSERT_PTR_NON_NULL(hdu, false);
    219     PS_ASSERT_PTR_NON_NULL(fits, false);
    220 
    221     return hduWrite(hdu, hdu->images, fits);
    222 }
    223 
    224 bool pmHDUWriteMask(pmHDU *hdu, psFits *fits)
    225 {
    226     PS_ASSERT_PTR_NON_NULL(hdu, false);
    227     PS_ASSERT_PTR_NON_NULL(fits, false);
    228 
    229     return hduWrite(hdu, hdu->masks, fits);
    230 }
    231 
    232 bool pmHDUWriteWeight(pmHDU *hdu, psFits *fits)
    233 {
    234     PS_ASSERT_PTR_NON_NULL(hdu, false);
    235     PS_ASSERT_PTR_NON_NULL(fits, false);
    236 
    237     return hduWrite(hdu, hdu->weights, fits);
    238 }
     219bool pmHDUWrite(pmHDU *hdu, psFits *fits, const pmConfig *config)
     220{
     221    PS_ASSERT_PTR_NON_NULL(hdu, false);
     222    PS_ASSERT_PTR_NON_NULL(fits, false);
     223
     224    psMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Value to mask
     225    return hduWrite(hdu, hdu->images, hdu->masks, maskVal, fits);
     226}
     227
     228bool pmHDUWriteMask(pmHDU *hdu, psFits *fits, const pmConfig *config)
     229{
     230    PS_ASSERT_PTR_NON_NULL(hdu, false);
     231    PS_ASSERT_PTR_NON_NULL(fits, false);
     232
     233    // We don't supply a mask because we're writing the mask!
     234    return hduWrite(hdu, hdu->masks, NULL, 0, fits);
     235}
     236
     237bool pmHDUWriteWeight(pmHDU *hdu, psFits *fits, const pmConfig *config)
     238{
     239    PS_ASSERT_PTR_NON_NULL(hdu, false);
     240    PS_ASSERT_PTR_NON_NULL(fits, false);
     241
     242    psMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Value to mask
     243    return hduWrite(hdu, hdu->weights, hdu->masks, maskVal, fits);
     244}
Note: See TracChangeset for help on using the changeset viewer.