IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2007, 12:42:02 PM (19 years ago)
Author:
Paul Price
Message:

Reworking image interpolation to work on mask and variance image
simultaneously with the proper image. Working in the idea of having
"good", "bad" and "poor" output mask pixels (taken from Andy Becker),
where "poor" pixels have at least one bad input pixel contributing to
the flux, but the contribution is small (where 'small' is defined by a
user option). To handle all the options, created a
psImageInterpolateOptions structure, which contains all the things
which are constant while looping over an image (including the input
image, variance and mask). Changed function name, and split code out
of psImage.[ch] into its own file. Function returns boolean error
status; output values for image, variance and mask come from pointers
to double. Added interpolation types (GAUSS, LANCZOS2, LANCZOS3,
LANCZOS4). Using a fairly general framework so that additional
interpolation methods might be easily added. Updated tests and other
dependent code. Tests pass (but only test BILINEAR and BICUBE), and
pswarp works (but currently only uses BILINEAR).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImagePixelExtract.c

    r12431 r12741  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2007-03-14 00:39:50 $
     10 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2007-04-04 22:42:02 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psMemory.h"
    2424#include "psVector.h"
     25#include "psError.h"
     26#include "psImage.h"
     27#include "psImageInterpolate.h"
    2528#include "psImagePixelExtract.h"
    26 #include "psError.h"
    27 
    28 
    2929
    3030#define VECTOR_STORE_ROW_CASE(TYPE) \
     
    679679    float dY = (endRow - startRow) / (float)(nSamples-1);
    680680
     681    psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(mode, input, NULL, mask, maskVal,
     682                                                                       0, 0, 0, 0, 0);
     683
    681684    #define LINEAR_CUT_CASE(TYPE) \
    682685case PS_TYPE_##TYPE: { \
     
    692695                cutRowsData[i] = y; \
    693696            } \
    694             outData[i] = psImagePixelInterpolate(input,x,y,mask,maskVal,0,mode); \
     697            double value; \
     698            if (!psImageInterpolate(&value, NULL, NULL, x, y, interp)) { \
     699                psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image."); \
     700                psFree(interp); \
     701                psFree(out); \
     702                return NULL; \
     703            } \
     704            outData[i] = value; \
    695705        } \
    696706    } \
     
    709719        LINEAR_CUT_CASE(F32);
    710720        LINEAR_CUT_CASE(F64);
    711 
    712     default: {
    713             char* typeStr;
    714             PS_TYPE_NAME(typeStr,input->type.type);
    715             psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    716                     _("Specified psImage type, %s, is not supported."),
    717                     typeStr);
    718             psFree(out);
    719             out = NULL;
    720         }
    721     }
     721      default: {
     722          char* typeStr;
     723          PS_TYPE_NAME(typeStr,input->type.type);
     724          psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     725                  _("Specified psImage type, %s, is not supported."),
     726                  typeStr);
     727          psFree(interp);
     728          psFree(out);
     729          out = NULL;
     730      }
     731    }
     732
     733    psFree(interp);
    722734
    723735    return out;
Note: See TracChangeset for help on using the changeset viewer.