#ifndef GTGEN_TOOLBOX_CELL_MOVEMENT_H
#define GTGEN_TOOLBOX_CELL_MOVEMENT_H

#include <i3d/image3d.h>
#include "../settings.h"

/**
 * The function visits every pixel in the input image \e img
 * and multiplies its value with 1D Gaussian probability function
 * of given \e mean and \e sigma. The input to this 1D function
 * is distance of the examined pixel from the image centre.
 *
 * The distance is calculated in microns, thus resolution of \e img
 * is taken into account.
 *
 * \param[in,out] img	image to be modified
 * \param[in] mean	mean of the Gaussian pdf (in microns)
 * \param[in] sigma	sigma of the Gaussian pdf (in microns)
 */
template <class MT>
void MultiplyWithRadialGaussian(i3d::Image3d<MT> &img,
				const float mean,
				const float sigma);

/**
 * The function visits every pixel in the input image \e img
 * and multiplies its value with 1D Gaussian probability function
 * of zero mean and given \e sigma. The input to this 1D function
 * is the angle between vectors the image centre towards the
 * examined pixel and the vector \e V placed at the image centre.
 *
 * Note that the \e V is given in microns. Thus, the resolution
 * of \e img is taken into account.
 *
 * \param[in,out] img	image to be modified
 * \param[in] v		reference vector (in microns)
 * \param[in] sigma	sigma of the Gaussian pdf (in radians)
 */
template <class MT>
void MultiplyWithAngularGaussian(i3d::Image3d<MT> &img,
				 i3d::Vector3d<float> const &v,
				 const float sigma);

/**
 * The functions visits every pixel in the input image \e img
 * and multiplies its value with 1D Gaussian probability funtion
 * of zero mean and given \e sigma. The input to this 1D function
 * is the pixel distance of the examined pixel z-coordinate from
 * central z-slice (z-coordinate of image centre, in fact).
 *
 * Resolution of \e img is ignored in this function.
 *
 * \param[in,out] img	image to be modified
 * \param[in] sigma	sigma of the Gaussian pdf (in pixels)
 */
template <class MT>
void MultiplyWithSliceDrivenGaussian(i3d::Image3d<MT> &img,
				const float sigma);

/**
 * The function tries to randomly select some translation vector \e v
 * based on the suggestions in the preference map \e img. In such image,
 * a centre of it is considered as a no-translation vector, other coordinates
 * within the image are treated relative to the centre encoding translation
 * vectors in this way. The preference of any vector is based on the pixel
 * intensity found at the respective coordinate: the higher the value is, the
 * more likely its trans. vector is returned.
 *
 * \param[out] v	returned translation vector
 * \param[in] img	preference image
 */
template <class MT>
void ReadVectorFromPreferenceMap(i3d::Vector3d<float> &v,
				 i3d::Image3d<MT> const &img);

#endif
