#ifndef PS_IMAGE_MAP_FIT_H
#define PS_IMAGE_MAP_FIT_H

#include <psType.h>
#include <psVector.h>
#include <psImageMap.h>


// fit the image map to a set of points
bool psImageMapFit(psImageMap *map,
                   const psVector *mask,
                   psVectorMaskType maskValue, // 
                   const psVector *x,
                   const psVector *y,
                   const psVector *f,
                   const psVector *df
    );

// fit the image map to a set of points
bool psImageMapClipFit(psImageMap *map,
                       psStats *stats,
                       psVector *mask,  // WARNING: Mask is modified!
                       psVectorMaskType maskValue,
                       const psVector *x,
                       const psVector *y,
                       const psVector *f,
                       const psVector *df
    );

bool psImageMapFit1DinY(psImageMap *map,
                        const psVector *mask,
                        psVectorMaskType maskValue,
                        const psVector *x,
                        const psVector *y,
                        const psVector *f,
                        const psVector *df
    );

bool psImageMapFit1DinX(psImageMap *map,
                        const psVector *mask,
                        psVectorMaskType maskValue,
                        const psVector *x,
                        const psVector *y,
                        const psVector *f,
                        const psVector *df
    );

bool psImageMapRepair (psImage *image);

#endif
