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
26namespace itk
27{
45template <typename TCoordRep = double, unsigned int VIndexDimension = 2>
46class 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
51public:
55
58 using ValueType = TCoordRep;
59 using CoordRepType = TCoordRep;
60
62 static constexpr unsigned int IndexDimension = VIndexDimension;
63
66
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
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
A templated class holding a point in n-Dimensional image space.
ContinuousIndex(const IndexType &index)
typename BaseArray::Iterator Iterator
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:71