ITK  5.2.0
Insight Toolkit
itkContinuousIndex.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 itkContinuousIndex_h
19 #define itkContinuousIndex_h
20 
21 #include "itkPoint.h"
22 #include "itkIndex.h"
23 
24 #include <type_traits> // For is_floating_point.
25 
26 namespace itk
27 {
45 template <typename TCoordRep = double, unsigned int VIndexDimension = 2>
46 class ContinuousIndex : public Point<TCoordRep, VIndexDimension>
47 {
48  static_assert(std::is_floating_point<TCoordRep>::value,
49  "The coordinates of a continuous index must be represented by floating point numbers.");
50 
51 public:
55 
58  using ValueType = TCoordRep;
59  using CoordRepType = TCoordRep;
60 
62  static constexpr unsigned int IndexDimension = VIndexDimension;
63 
66 
68  using BaseArray = typename Superclass::BaseArray;
69  using Iterator = typename BaseArray::Iterator;
70  using ConstIterator = typename BaseArray::ConstIterator;
71 
73  ContinuousIndex() = default;
74  ContinuousIndex(const ContinuousIndex &) = default;
75  ContinuousIndex(ContinuousIndex &&) = default;
77  operator=(const ContinuousIndex &) = default;
79  operator=(ContinuousIndex &&) = default;
80  ~ContinuousIndex() = default;
82 
85  : Superclass(r)
86  {}
87 
89  ContinuousIndex(const IndexType & index)
90  {
91  for (unsigned int i = 0; i < VIndexDimension; i++)
92  {
93  (*this)[i] = static_cast<TCoordRep>(index[i]);
94  }
95  }
96 };
97 } // namespace itk
99 
100 #endif
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:66
itk::ContinuousIndex::ContinuousIndex
ContinuousIndex()=default
itk::ContinuousIndex< float, Self::ImageDimension >::ConstIterator
typename BaseArray::ConstIterator ConstIterator
Definition: itkContinuousIndex.h:70
itkPoint.h
itk::ContinuousIndex< float, Self::ImageDimension >::CoordRepType
float CoordRepType
Definition: itkContinuousIndex.h:59
itk::ContinuousIndex< float, Self::ImageDimension >::BaseArray
typename Superclass::BaseArray BaseArray
Definition: itkContinuousIndex.h:68
itk::ContinuousIndex::operator=
ContinuousIndex & operator=(const ContinuousIndex &)=default
itk::ContinuousIndex::IndexDimension
static constexpr unsigned int IndexDimension
Definition: itkContinuousIndex.h:62
itk::Point< TCoordRep, VIndexDimension >::BaseArray
FixedArray< TCoordRep, NPointDimension > BaseArray
Definition: itkPoint.h:72
itk::ContinuousIndex::ContinuousIndex
ContinuousIndex(const IndexType &index)
Definition: itkContinuousIndex.h:89
itkIndex.h
itk::ContinuousIndex::ContinuousIndex
ContinuousIndex(const ValueType r[IndexDimension])
Definition: itkContinuousIndex.h:84
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ContinuousIndex
A templated class holding a point in n-Dimensional image space.
Definition: itkContinuousIndex.h:46
itk::ContinuousIndex< float, Self::ImageDimension >::ValueType
float ValueType
Definition: itkContinuousIndex.h:58
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::ContinuousIndex::~ContinuousIndex
~ContinuousIndex()=default
itk::ContinuousIndex< float, Self::ImageDimension >::Iterator
typename BaseArray::Iterator Iterator
Definition: itkContinuousIndex.h:69