/*************************************************************************
* 
* deformation.h
* 
* This file is part of CytoPacq
* 
* Copyright (C) 2007-2016 -- Centre for Biomedical Image Analysis (CBIA)
* 
* CytoPacq is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* CytoPacq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with CytoPacq. If not, see <http://www.gnu.org/licenses/>.
* 
* Author: Martin Maska, David Svoboda
* 
* Description: The topology-preserving deformation of binary objects 
* using a fast level set-like algorithm.
*
*****************************************************************************/

#ifndef _DEFORMATION_H_
#define _DEFORMATION_H_

#include <i3d/image3d.h>

/** 
 * \ingroup toolbox
 *
 * The topology-preserving deformation of binary objects using a fast level set-like algorithm. The boundary of objects 
  * in the mask image is taken as the initial interface that is deformed under a force field given by the speed image. 
  * The last parameter determines the level of deformation, i.e. how much the initial interface is deformed. The second
  * parameter defines the computational domain, i.e. the area in which the interface can be evolved. It is recommended
  * to set this parameter to NULL if a full image deformation is required. Deformed objects are saved back to the mask 
  * image. Note that if a domain is specified then only those points belonging to the domain are saved back, the remaining
  * ones are left without any change. */
void Deformation(i3d::Image3d<bool> &mask, 
					  const i3d::Image3d<bool> *domain, 
					  const i3d::Image3d<float> &speedImg, 
					  float deformation_level);

/** 
 * \ingroup toolbox
 *
 * Generate a speed image, a image map that controls the development of level set methods. */
void GenerateSpeedImage(i3d::Image3d<float> &speedImg, 
								double blob_size, 
								double smoothness = 8, 
								float min_value = 0.0f, 
								float max_value = 1.0f, 
								float skewness = 1.0f);

#endif // _DEFORMATION_
