~ubuntu-branches/ubuntu/precise/insighttoolkit/precise

« back to all changes in this revision

Viewing changes to Code/Common/itkOffset.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-12-19 20:16:49 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081219201649-drt97guwl2ryt0cn

* New upstream version.
  - patches/nifti-versioning.patch: Remove.  Applied upstream.
  - control:
  - rules: Update version numbers, package names.

* control: Build-depend on uuid-dev (gdcm uses it).

* copyright: Update download URL.

* rules: Adhere to parallel=N in DEB_BUILD_OPTIONS by setting MAKEFLAGS.

* compat: Set to 7.
* control: Update build-dep on debhelper to version >= 7.

* CMakeCache.txt.debian: Set CMAKE_BUILD_TYPE to "RELEASE" so that we
  build with -O3 (not -O2), necessary to optimize the templated code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Program:   Insight Segmentation & Registration Toolkit
4
4
  Module:    $RCSfile: itkOffset.h,v $
5
5
  Language:  C++
6
 
  Date:      $Date: 2008-03-27 18:05:58 $
7
 
  Version:   $Revision: 1.16 $
 
6
  Date:      $Date: 2008-08-05 18:41:06 $
 
7
  Version:   $Revision: 1.18 $
8
8
 
9
9
  Copyright (c) Insight Software Consortium. All rights reserved.
10
10
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
24
24
 
25
25
#include "itkExceptionObject.h"
26
26
 
 
27
#if defined(_MSC_VER)
 
28
 
 
29
// local variable may be used without having been initialized
 
30
#pragma warning ( disable : 4701 )
 
31
#endif
27
32
namespace itk
28
33
{
29
34
 
 
35
namespace Functor
 
36
{
 
37
template<unsigned int VOffsetDimension> class OffsetLexicographicCompare;
 
38
}
 
39
 
 
40
 
30
41
/** 
31
42
 * \class Offset
32
43
 * \brief Represent the offset between two n-dimensional indexes
57
68
  typedef   Offset<VOffsetDimension>  OffsetType;
58
69
  typedef   long OffsetValueType;
59
70
    
 
71
  /** Lexicographic ordering functor type.  */
 
72
  typedef Functor::OffsetLexicographicCompare<VOffsetDimension> LexicographicCompare;
 
73
 
60
74
  /** Add an offset to an offset. */
61
75
  const Self
62
76
  operator+(const Self &offset) const
193
207
};
194
208
 
195
209
 
 
210
namespace Functor
 
211
{
 
212
/** \class OffsetLexicographicCompare
 
213
 * \brief Order Offset instances lexicographically.
 
214
 *
 
215
 * This is a comparison functor suitable for storing Offset instances
 
216
 * in an STL container.  The ordering is total and unique but has
 
217
 * little geometric meaning.
 
218
 */
 
219
template<unsigned int VOffsetDimension>
 
220
class OffsetLexicographicCompare
 
221
{
 
222
public:
 
223
  bool operator()(Offset<VOffsetDimension> const& l,
 
224
                  Offset<VOffsetDimension> const& r) const
 
225
    {
 
226
    for(unsigned int i=0; i < VOffsetDimension; ++i)
 
227
      {
 
228
      if(l.m_Offset[i] < r.m_Offset[i])
 
229
        {
 
230
        return true;
 
231
        }
 
232
      else if(l.m_Offset[i] > r.m_Offset[i])
 
233
        {
 
234
        return false;
 
235
        }
 
236
      }
 
237
    return false;
 
238
    }
 
239
};
 
240
}
 
241
 
196
242
template<unsigned int VOffsetDimension>
197
243
Offset<VOffsetDimension> 
198
244
Offset<VOffsetDimension>