00001 //=========================================================================== 00002 // The Level-Set Segmentation Library (LSSEG) 00003 // 00004 // 00005 // Copyright (C) 2000-2005 SINTEF ICT, Applied Mathematics, Norway. 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation version 2 of the License. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 00019 // 59 Temple Place - Suite 330, 00020 // Boston, MA 02111-1307, USA. 00021 // 00022 // Contact information: e-mail: tor.dokken@sintef.no 00023 // SINTEF ICT, Department of Applied Mathematics, 00024 // P.O. Box 124 Blindern, 00025 // 0314 Oslo, Norway. 00026 // 00027 // 00028 // Other licenses are also available for this software, notably licenses 00029 // for: 00030 // - Building commercial software. 00031 // - Building software whose source code you wish to keep private. 00032 // 00033 //=========================================================================== 00034 //=========================================================================== 00035 // 00036 // File: ConstantForce.h 00037 // 00038 // Created: Fri Mar 3 14:21:01 2006 00039 // 00040 // Author: Odd A. Andersen <Odd.Andersen@sintef.no> 00041 // 00042 // Revision: $Id: ConstantForce.h,v 1.4 2006/09/20 22:55:47 oan Exp $ 00043 // 00044 // Description: 00048 // 00049 //=========================================================================== 00050 00051 #ifndef _CONSTANTFORCE_H 00052 #define _CONSTANTFORCE_H 00053 00054 #include "ForceGenerator.h" 00055 00056 namespace lsseg { 00057 00058 //=========================================================================== 00065 class ConstantForce : public ForceGenerator 00066 //=========================================================================== 00067 { 00068 public: 00074 ConstantForce(double c) : constant_(c) {} 00075 00077 virtual ~ConstantForce() {} 00078 00094 virtual void init(const Image<double>* img, const Mask* mask = 0) {} 00095 virtual void update(const LevelSetFunction& phi) {} 00096 virtual double force2D(int x, int y) const {return constant_;} 00097 virtual double force3D(int x, int y, int z) const {return constant_;} 00098 virtual double force(size_t ix) const {return constant_;} 00099 virtual void force(LevelSetFunction& phi, const Mask* mask) const { phi = constant_;} 00100 00101 private: 00102 00104 double constant_; 00105 00106 }; 00107 00108 }; // end namespace lsseg 00109 00110 #endif // _CONSTANTFORCE_H 00111