ITK  5.4.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  * https://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 ITK_TEMPLATE_EXPORT ContinuousIndex : public Point<TCoordRep, VIndexDimension>
47 {
48  static_assert(std::is_floating_point_v<TCoordRep>,
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 
74  ContinuousIndex() = default;
75 
77  ContinuousIndex(const ValueType r[IndexDimension])
78  : Superclass(r)
79  {}
80 
82  ContinuousIndex(const IndexType & index)
83  {
84  for (unsigned int i = 0; i < VIndexDimension; ++i)
85  {
86  (*this)[i] = static_cast<TCoordRep>(index[i]);
87  }
88  }
89 };
90 } // namespace itk
93 #endif
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:70
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::ContinuousIndex
ContinuousIndex(const IndexType &index)
Definition: itkContinuousIndex.h:82
itk::FixedArray< float, VPointDimension >
itkIndex.h
itk::ContinuousIndex::ContinuousIndex
ContinuousIndex(const ValueType r[IndexDimension])
Definition: itkContinuousIndex.h:77
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< float, Self::ImageDimension >::Iterator
typename BaseArray::Iterator Iterator
Definition: itkContinuousIndex.h:69