Orfeo Toolbox  4.0
itkCacheableScalarFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkCacheableScalarFunction_h
19 #define __itkCacheableScalarFunction_h
20 
21 #include "itkArray.h"
22 #include "itkIntTypes.h"
23 
24 namespace itk
25 {
59 {
60 public:
63 
66 
68  typedef double MeasureType;
70 
74 
77 
80 
83 
88  { return x; }
89 
91  double GetInterval()
92  { return m_TableInc; }
93 
100  {
101  if ( x > m_CacheUpperBound || x < m_CacheLowerBound )
102  {
103  throw ExceptionObject(__FILE__, __LINE__);
104  }
105  // access table
106  int index = (int)( ( x - m_CacheLowerBound ) / m_TableInc );
107  return m_CacheTable[index];
108  }
109 
110 protected:
113  void CreateCache(double lowerBound, double upperBound, SizeValueType sampleSize);
114 
115 private:
119 
122 
125 
128 
130  double m_TableInc;
131 
134 }; // end of class
135 } // end of namespace itk
136 #endif

Generated at Sat Mar 8 2014 14:25:17 for Orfeo Toolbox with doxygen 1.8.3.1