/** @file  pmReadoutCombine.h
 *
 *  This file will contain a module which will combine multiple readout images.
 *
 *  @author GLG, MHPCC
 *
 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
 *  @date $Date: 2005-11-15 20:09:03 $
 *
 *  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 "pmAstrometry.h"

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

psImage *pmReadoutCombine(psImage *output,
                          const psList *inputs,
                          psCombineParams *params,
                          const psVector *zero,
                          const psVector *scale,
                          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
