Orfeo Toolbox  3.16
itkCacheableScalarFunction.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkCacheableScalarFunction.cxx,v $
5  Language: C++
6  Date: $Date: 2007-03-22 14:29:13 $
7  Version: $Revision: 1.7 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
18 
19 namespace itk {
22 {
23  m_CacheAvailable = false;
24 }
25 
26 void
28 ::CreateCache(double lowerBound, double upperBound, long sampleSize)
29 {
30  m_NumberOfSamples = sampleSize;
31  m_CacheLowerBound = lowerBound;
32  m_CacheUpperBound = upperBound;
33 
34  long i;
35  MeasureType d;
36 
37  m_CacheTable = MeasureArrayType(m_NumberOfSamples);
38 
39  m_TableInc =
40  static_cast<MeasureType>( (m_CacheUpperBound - m_CacheLowerBound) /
41  double(m_NumberOfSamples - 1) );
42 
43  d = static_cast<MeasureType>( m_CacheLowerBound );
44  for (i = 0; i < m_NumberOfSamples; i++)
45  {
46  m_CacheTable[i] = Evaluate(d);
47  d += m_TableInc;
48  }
49 
50  m_CacheAvailable = true;
51 }
52 
53 } // end of namespace itk

Generated at Sat Feb 2 2013 23:31:07 for Orfeo Toolbox with doxygen 1.8.1.1