latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*-------------------------------------------------------------------- 00025 * project ....: LTI-Lib: Image Processing and Computer Vision Library 00026 * file .......: ltiInterpolator.h 00027 * authors ....: Peter Doerfler, Pablo Alvarado 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 3.5.2003 00030 * revisions ..: $Id: ltiInterpolator.h,v 1.11 2006/02/08 12:27:41 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_INTERPOLATOR_H_ 00034 #define _LTI_INTERPOLATOR_H_ 00035 00036 #include "ltiFunctor.h" 00037 #include "ltiBoundaryType.h" 00038 00039 namespace lti { 00040 /** 00041 * This abstract class parents all interpolation functors. 00042 * 00043 * In interpolation a set of point, a tabulated function, is 00044 * given. These points are often called samples. The goal is to find 00045 * function values between the given data. 00046 * 00047 * There are many different interpolation schemes depending on the 00048 * application. The samples can be equally or variably spaced. The 00049 * former occurs mainly in images but can be useful for other data 00050 * as well (see equallySpacedSamplesInterpolator). The latter is 00051 * most often met in the interpolation of graphs (1D functions in an 00052 * n-dimensional space). See also 00053 * variablySpacedSamplesInterpolation. 00054 */ 00055 class interpolator : public functor { 00056 public: 00057 /** 00058 * the parameters for the class interpolator 00059 */ 00060 class parameters : public functor::parameters { 00061 public: 00062 /** 00063 * default constructor 00064 */ 00065 parameters(); 00066 00067 /** 00068 * create parameters with the given boundary type 00069 */ 00070 parameters(const eBoundaryType btype); 00071 00072 /** 00073 * copy constructor 00074 * @param other the parameters object to be copied 00075 */ 00076 parameters(const parameters& other); 00077 00078 /** 00079 * destructor 00080 */ 00081 ~parameters(); 00082 00083 /** 00084 * returns name of this type 00085 */ 00086 const char* getTypeName() const; 00087 00088 /** 00089 * copy the contents of a parameters object 00090 * @param other the parameters object to be copied 00091 * @return a reference to this parameters object 00092 */ 00093 parameters& copy(const parameters& other); 00094 00095 /** 00096 * copy the contents of a parameters object 00097 * @param other the parameters object to be copied 00098 * @return a reference to this parameters object 00099 */ 00100 parameters& operator=(const parameters& other); 00101 00102 00103 /** 00104 * returns a pointer to a clone of the parameters 00105 */ 00106 virtual functor::parameters* clone() const=0; 00107 00108 /** 00109 * write the parameters in the given ioHandler 00110 * @param handler the ioHandler to be used 00111 * @param complete if true (the default) the enclosing begin/end will 00112 * be also written, otherwise only the data block will be written. 00113 * @return true if write was successful 00114 */ 00115 virtual bool write(ioHandler& handler,const bool complete=true) const; 00116 00117 /** 00118 * read the parameters from the given ioHandler 00119 * @param handler the ioHandler to be used 00120 * @param complete if true (the default) the enclosing begin/end will 00121 * be also written, otherwise only the data block will be written. 00122 * @return true if write was successful 00123 */ 00124 virtual bool read(ioHandler& handler,const bool complete=true); 00125 00126 # ifdef _LTI_MSC_6 00127 /** 00128 * this function is required by MSVC only, as a workaround for a 00129 * very awful bug, which exists since MSVC V.4.0, and still by 00130 * V.6.0 with all bugfixes (so called "service packs") remains 00131 * there... This method is also public due to another bug, so please 00132 * NEVER EVER call this method directly: use read() instead 00133 */ 00134 bool readMS(ioHandler& handler,const bool complete=true); 00135 00136 /** 00137 * this function is required by MSVC only, as a workaround for a 00138 * very awful bug, which exists since MSVC V.4.0, and still by 00139 * V.6.0 with all bugfixes (so called "service packs") remains 00140 * there... This method is also public due to another bug, so please 00141 * NEVER EVER call this method directly: use write() instead 00142 */ 00143 bool writeMS(ioHandler& handler,const bool complete=true) const; 00144 # endif 00145 00146 // ------------------------------------------------ 00147 // the parameters 00148 // ------------------------------------------------ 00149 00150 /** 00151 * Specify how the boundaries will be used. 00152 * 00153 * See the documentation for lti::eBoundaryType for more information 00154 */ 00155 eBoundaryType boundaryType; 00156 00157 }; 00158 00159 /** 00160 * default constructor 00161 */ 00162 interpolator(); 00163 00164 /** 00165 * copy constructor 00166 * @param other the object to be copied 00167 */ 00168 interpolator(const interpolator& other); 00169 00170 /** 00171 * destructor 00172 */ 00173 virtual ~interpolator(); 00174 00175 /** 00176 * returns the name of this type ("interpolator") 00177 */ 00178 virtual const char* getTypeName() const; 00179 00180 /** 00181 * copy data of "other" functor. 00182 * @param other the functor to be copied 00183 * @return a reference to this functor object 00184 */ 00185 interpolator& copy(const interpolator& other); 00186 00187 /** 00188 * alias for copy member 00189 * @param other the functor to be copied 00190 * @return a reference to this functor object 00191 */ 00192 interpolator& operator=(const interpolator& other); 00193 00194 /** 00195 * returns a pointer to a clone of this functor. 00196 */ 00197 virtual functor* clone() const = 0; 00198 00199 /** 00200 * returns used parameters 00201 */ 00202 const parameters& getParameters() const; 00203 00204 /** 00205 * Shortcut to set the boundaryType parameter at once 00206 * 00207 * @return true, if the boundary could be set, or false if no 00208 * parameters have been set yet. 00209 */ 00210 bool setBoundaryType(const eBoundaryType& boundType); 00211 }; 00212 } 00213 00214 #endif