/** @file  pmReadoutCombine.h
 *
 *  This file will contain a module which will combine multiple readout images.
 *
 *  @author GLG, MHPCC
 *
 *  @version $Revision: 1.3.4.1 $ $Name: not supported by cvs2svn $
 *  @date $Date: 2006-02-17 17:13:41 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 *
 */

#if !defined(PM_READOUT_COMBINE_H)
#define PM_READOUT_COMBINE_H

#if HAVE_CONFIG_H
#include <config.h>
#endif

#include<stdio.h>
#include<math.h>
#include "pslib.h"
#include "psConstants.h"
#include "pmFPA.h"

typedef struct
{
    psStats *stats;
    unsigned int maskVal;
    float fracHigh;
    float fracLow;
    int nKeep;
}
pmCombineParams;

pmCombineParams *pmCombineParamsAlloc (psStatsOptions statsOptions);

psImage *pmReadoutCombine(psImage *output,
                          const psArray *inputs,
                          const psVector *zero,
                          const psVector *scale,
                          pmCombineParams *params,
                          bool applyZeroScale,
                          float gain,
                          float readnoise);

/**
 *
 * This function measures the robust median at each of the minimum and maximum
 * coordinates and determines the difference and mean of the two values. The size
 * of the box used to make the measurement at each point is specified by the
 * configuration variable FRINGE_SQUARE_RADIUS. From the collection of
 * differences, the robust median is calculated, and returned as part of the
 * fringe statistics. For each fringe point, the values of delta and midValue are
 * also assigned and available to the user on return.
 *
 */
psStats *pmFringeStats(
    psArray *fringePoints,
    psImage *image,
    psMetadata *config
);

typedef struct
{
    psF64 xMin;
    psF64 yMin;
    psF64 xMax;
    psF64 yMax;
    psF64 delta;
    psF64 midValue;
}
pmFringePoint;

#endif
