ITK  6.0.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 TCoordinate = double, unsigned int VIndexDimension = 2>
46 class ITK_TEMPLATE_EXPORT ContinuousIndex : public Point<TCoordinate, VIndexDimension>
47 {
48  static_assert(std::is_floating_point_v<TCoordinate>,
49  "The coordinates of a continuous index must be represented by floating point numbers.");
50 
51 public:
55 
58  using ValueType = TCoordinate;
59  using CoordinateType = TCoordinate;
60 #ifndef ITK_FUTURE_LEGACY_REMOVE
61  using CoordRepType ITK_FUTURE_DEPRECATED(
62  "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
63 #endif
64 
66  static constexpr unsigned int IndexDimension = VIndexDimension;
67 
70 
72  using BaseArray = typename Superclass::BaseArray;
73  using Iterator = typename BaseArray::Iterator;
74  using ConstIterator = typename BaseArray::ConstIterator;
75 
78  ContinuousIndex() = default;
79 
81  ContinuousIndex(const ValueType r[IndexDimension])
82  : Superclass(r)
83  {}
84 
86  ContinuousIndex(const IndexType & index)
87  {
88  for (unsigned int i = 0; i < VIndexDimension; ++i)
89  {
90  (*this)[i] = static_cast<TCoordinate>(index[i]);
91  }
92  }
93 };
94 } // namespace itk
97 #endif
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:68
itkPoint.h
itk::ContinuousIndex< float, Self::ImageDimension >::BaseArray
typename Superclass::BaseArray BaseArray
Definition: itkContinuousIndex.h:72
itk::ContinuousIndex< float, Self::ImageDimension >::ValueType
float ValueType
Definition: itkContinuousIndex.h:58
itk::ContinuousIndex< float, Self::ImageDimension >::CoordinateType
float CoordinateType
Definition: itkContinuousIndex.h:59
itk::FixedArray< float, VPointDimension >
itk::ContinuousIndex< float, Self::ImageDimension >::Iterator
typename BaseArray::Iterator Iterator
Definition: itkContinuousIndex.h:73
itkIndex.h
itk::ContinuousIndex< float, Self::ImageDimension >::ConstIterator
typename BaseArray::ConstIterator ConstIterator
Definition: itkContinuousIndex.h:74
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ContinuousIndex
A templated class holding a point in n-Dimensional image space.
Definition: itkContinuousIndex.h:46
itk::ContinuousIndex::ContinuousIndex
ContinuousIndex(const IndexType &index)
Definition: itkContinuousIndex.h:86
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::ContinuousIndex::ContinuousIndex
ContinuousIndex(const ValueType r[IndexDimension])
Definition: itkContinuousIndex.h:81