IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 19, 2007, 1:52:39 PM (19 years ago)
Author:
Paul Price
Message:

Adding psFitsFloat.[ch] for quantising (and unquantising) floating-point images and setting BSCALE and BZERO. It isn't in a usable state yet, but checking in to the tree for safety. It's not activate in the build.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFitsImage.c

    r15179 r15335  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-10-03 21:27:21 $
     9 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-10-19 23:52:39 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    185185}
    186186
     187
     188bool psFitsImageSize(int *numCols, int *numRows, psElemType *type, const psFits *fits, psRegion region)
     189{
     190    PS_ASSERT_FITS_NON_NULL(fits, NULL);
     191
     192    if (psFitsCheckSingleCompressedImagePHU(fits, NULL)) {
     193        // This is really what we want, not the empty PHU
     194        psTrace("psLib.fits", 1,
     195                "This PHU should really be a compressed image --- reading that image instead.");
     196    }
     197
     198    p_psFitsReadInfo *info = p_psFitsReadInfoAlloc(fits, region, 0); // How big the region to read is
     199
     200    if (numCols) {
     201        *numCols = info->lastPixel[0] - info->firstPixel[0] + 1;
     202    }
     203    if (numRows) {
     204        *numRows = info->lastPixel[1] - info->firstPixel[1] + 1;
     205    }
     206    if (type) {
     207        *type = info->psDatatype;
     208    }
     209
     210    psFree(info);
     211
     212    return true;
     213}
     214
     215
    187216// Read into an extant image of just the right size
    188217static bool fitsReadImage(psImage *output,   // Output image
     
    287316{
    288317    PS_ASSERT_FITS_NON_NULL(fits, false);
     318    PS_ASSERT_FITS_WRITABLE(fits, false);
    289319    PS_ASSERT_IMAGE_NON_NULL(input, false);
    290320    // this is equivalent to insert after the last HDU
     
    302332{
    303333    PS_ASSERT_FITS_NON_NULL(fits, false);
     334    PS_ASSERT_FITS_WRITABLE(fits, false);
    304335    PS_ASSERT_IMAGE_NON_NULL(input, false);
    305336
     
    402433{
    403434    PS_ASSERT_FITS_NON_NULL(fits, false);
     435    PS_ASSERT_FITS_WRITABLE(fits, false);
    404436    PS_ASSERT_IMAGE_NON_NULL(input, false);
    405437
     
    556588{
    557589    PS_ASSERT_FITS_NON_NULL(fits, false);
     590    PS_ASSERT_FITS_WRITABLE(fits, false);
    558591    PS_ASSERT_ARRAY_NON_NULL(input, false);
    559592
     
    622655{
    623656    PS_ASSERT_FITS_NON_NULL(fits, false);
     657    PS_ASSERT_FITS_WRITABLE(fits, false);
    624658    PS_ASSERT_ARRAY_NON_NULL(input, false);
    625659
Note: See TracChangeset for help on using the changeset viewer.