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
26namespace itk
27{
45template <typename TCoordinate = double, unsigned int VIndexDimension = 2>
46class 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
51public:
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
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
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
A templated class holding a point in n-Dimensional image space.
typename BaseArray::Iterator Iterator
ContinuousIndex(const IndexType &index)
ContinuousIndex(const ValueType r[IndexDimension])
typename Superclass::BaseArray BaseArray
ContinuousIndex()=default
typename BaseArray::ConstIterator ConstIterator
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:54
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:69