IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 15, 2005, 10:09:03 AM (20 years ago)
Author:
gusciora
Message:

SubtractBias was recoded. Significant mods to removeBadPixels.
Additional mods to other files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imsubtract/pmSubtractSky.c

    r5294 r5516  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-10-12 21:02:04 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-11-15 20:09:03 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include<math.h>
    1919#include "pslib.h"
    20 #include "psConstants.h"
    2120#include "pmSubtractSky.h"
     21
     22// XXX: Get rid of the.  Create pmUtils.h
     23psImage *p_psDetermineTrimmedImage(
     24    pmReadout *in
     25);
    2226
    2327/******************************************************************************
     
    152156 
    153157XXX: Use your brain and figure out the analytical expression.
     158 
     159XXX: Why isn't it simply (xOrder+1) * (yOrder+1)?
    154160 *****************************************************************************/
    155161static psS32 CalculatePolyTerms(psS32 xOrder, psS32 yOrder)
     
    170176        }
    171177    }
    172 
    173178    psTrace("SubtractSky.CalculatePolyTerms", 4,
    174179            "Exiting CalculatePolyTerms(%d, %d) -> %d\n", xOrder, yOrder, localPolyTerms);
    175180    return(localPolyTerms);
     181
     182    //    return((xOrder+1) * (yOrder+1));
    176183}
    177184
     
    283290XXX: Different trace message facilities in use here.
    284291 *****************************************************************************/
    285 static psPolynomial2D *ImageFitPolynomial(psPolynomial2D *myPoly,
    286         psImage *dataImage,
    287         psImage *maskImage)
     292static psPolynomial2D *ImageFitPolynomial(
     293    psPolynomial2D *myPoly,
     294    psImage *dataImage,
     295    psImage *maskImage)
    288296{
    289297    psTrace("SubtractSky.ImageFitPolynomial", 4,
     
    471479    PS_ASSERT_READOUT_NON_EMPTY(in, NULL);
    472480    PS_ASSERT_READOUT_TYPE(in, PS_TYPE_F32, NULL);
     481    PS_WARN_PTR_NON_NULL(in->parent);
     482    if (in->parent != NULL) {
     483        PS_WARN_PTR_NON_NULL(in->parent->concepts);
     484    }
    473485    psTrace(".psModule.pmSubtractSky", 4,
    474486            "---- pmSubtractSky() begin ----\n");
     
    492504        return(in);
    493505    }
    494     psImage *origImage = in->image;
     506
     507    //
     508    // Determine trimmed image from metadata.
     509    //
     510
     511    psImage *trimmedImg = p_psDetermineTrimmedImage(in);
    495512    psImage *binnedImage = NULL;
    496513    psPolynomial2D *myPoly = NULL;
     
    539556        // No binning is required here.  Simply create a copy of the image
    540557        // and a mask.
    541         binnedImage = psImageCopy(binnedImage, origImage, PS_TYPE_F32);
     558        binnedImage = psImageCopy(binnedImage, trimmedImg, PS_TYPE_F32);
    542559        if (binnedImage == NULL) {
    543560            psError(PS_ERR_UNKNOWN, false, "psImageCopy() returned NULL.  Returning in image.\n");
     
    559576        }
    560577    } else {
    561         binnedImage = psImageRebin(NULL, origImage, in->mask, 0, binFactor, stats);
     578        binnedImage = psImageRebin(NULL, trimmedImg, in->mask, 0, binFactor, stats);
    562579        if (binnedImage == NULL) {
    563580            psError(PS_ERR_UNKNOWN, false, "psImageRebin() returned NULL.  Returning in image.\n");
     
    677694    if (binFactor <= 1) {
    678695        // The binned image is the same size as the original image.
    679         for (psS32 row = 0; row < origImage->numRows ; row++) {
    680             for (psS32 col = 0; col < origImage->numCols ; col++) {
    681                 origImage->data.F32[row][col]-= binnedImage->data.F32[row][col];
     696        for (psS32 row = 0; row < trimmedImg->numRows ; row++) {
     697            for (psS32 col = 0; col < trimmedImg->numCols ; col++) {
     698                trimmedImg->data.F32[row][col]-= binnedImage->data.F32[row][col];
    682699            }
    683700        }
    684701    } else {
    685         for (psS32 row = 0; row < origImage->numRows ; row++) {
    686             for (psS32 col = 0; col < origImage->numCols ; col++) {
     702        for (psS32 row = 0; row < trimmedImg->numRows ; row++) {
     703            for (psS32 col = 0; col < trimmedImg->numCols ; col++) {
    687704                // We calculate the F32 value of the pixel coordinates in the
    688705                // binned image and then use a pixel interpolation routine to
     
    700717                                     binnedImage, binColF64, binRowF64,
    701718                                     NULL, 0, 0.0, PS_INTERPOLATE_BILINEAR);
    702                 origImage->data.F32[row][col]-= binPixel;
     719                trimmedImg->data.F32[row][col]-= binPixel;
    703720
    704721                psTrace(".psModule.pmSubtractSky", 8,
Note: See TracChangeset for help on using the changeset viewer.