/**
* @file ICETools.h
* @brief simple ICE GUI tools
* @author Erik Rodner
* @date 03/13/2008

*/
#ifndef ICETOOLSINCLUDE
#define ICETOOLSINCLUDE

#include "core/image/ImageT.h"
#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"

#include <vector>


namespace OBJREC {

/** @brief simple ICE tools */
class ICETools
{

  protected:

  public:

    /** simple constructor */
    ICETools();

    /** simple destructor */
    virtual ~ICETools();

    /** select a set of rectangles (selection of top-left and bottom-right
        @param panel image which is displayed
        @param overlay overlay image which will be used to mark points
        @param x returned list of rectangles (top-left-x,top-left-y,width,height)
        @param color color which is used to mark points
    */
    static void selectRectangles ( const NICE::Image & panel, NICE::Image & overlay,
                                   std::vector<NICE::Vector> & x, int color );

    /** select a set of points
        @param panel image which is displayed
        @param overlay overlay image which will be used to mark points
        @param x returned list of image points
        @param color color which is used to mark points
    */
    static void selectPoints ( const NICE::Image & panel, NICE::Image & overlay,
                               std::vector<NICE::Vector> & x, int color );

    /** convert a double image to a pseudocolor rgb image (DEPRECATED)
        @param m input double image
        @param img resulting pseudocolor rgb image
    */
    static void convertToRGB ( const NICE::FloatImage & m, NICE::ColorImage & img );

    /** convert a matrix to a pseudocolor rgb image (DEPRECATED)
        @param m input double image
        @param img resulting pseudocolor rgb image
    */
    static void convertToRGB ( const NICE::Matrix & m, NICE::ColorImage & img );

    /** convert a single double value to a pseudocolor (DEPRECATED)
        @param x input double value
        @param r resulting red value
        @param g resulting green value
        @param b resulting blue value
    */
    static void toColor ( double x, double & r, double & g, double & b );

    /** calc grayscale image from a rgb image
        @param img color image
        @param imgg resulting grayscale image
    */
    static void calcGrayImage ( const NICE::ColorImage & img, NICE::Image & imgg );

    /** convert a c buffer to a matrix
        @param M resulting matrix
        @param raw input c buffer
    */
    static void convertM2ICE ( NICE::Matrix & M, double *raw );

    /** convert a matrix to a c buffer
        @param M input matrix
        @return resulting c buffer
    */
    static double *convertICE2M ( const NICE::Matrix & M );

    /** show a collection of images
        @param imagelist collection of images
        @return ...
    */
    static int showImages ( std::vector<NICE::Image> & imagelist );

#ifndef NOVISUAL
    static int markImage ( const NICE::Image & img, NICE::Image & mark, int marksize, int maxColor );
#endif

};


} // namespace

#endif
