ITK  6.0.0
Insight Toolkit
itkHilbertPath.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 itkHilbertPath_h
19#define itkHilbertPath_h
20
21#include "itkPath.h"
22
23#include "itkNumericTraits.h"
24
25namespace itk
26{
53template <typename TIndexValue = unsigned int, unsigned int VDimension = 3>
54class ITK_TEMPLATE_EXPORT HilbertPath : public Path<TIndexValue, Index<VDimension>, VDimension>
55{
56public:
57 ITK_DISALLOW_COPY_AND_MOVE(HilbertPath);
58
64
66 itkOverrideGetNameOfClassMacro(HilbertPath);
67
69 itkNewMacro(Self);
70
72 static constexpr unsigned int Dimension = VDimension;
73
75 using typename Superclass::OutputType;
76 using typename Superclass::InputType;
77
81 using HilbertOrderType = unsigned int;
82 using HilbertPathType = std::vector<IndexType>;
83 using HilbertPathSizeType = typename HilbertPathType::size_type;
84 using typename Superclass::OffsetType;
85
86 // Functions inherited from Path
87
90 Evaluate(const PathIndexType & input) const override
91 {
92 return this->m_HilbertPath[input];
93 }
94
95 OutputType
96 EvaluateToIndex(const PathIndexType & input) const override
97 {
98 return this->m_HilbertPath[input];
99 }
100
102 virtual InputType
104 {
105 return this->TransformMultiDimensionalIndexToPathIndex(input);
106 }
107
109 InputType
110 EndOfInput() const override
111 {
112 return static_cast<InputType>(this->NumberOfSteps()); // 0 is before the first step, 1 is after it
113 }
114
118 OffsetType
119 IncrementInput(InputType & itkNotUsed(input)) const override
120 {
121 itkExceptionMacro("Not implemented.");
122 }
123
125 virtual inline void
127 {
128 this->m_HilbertPath.clear();
129 this->Modified();
130 }
134 virtual inline HilbertPathSizeType
136 {
137 return m_HilbertPath.size();
138 }
139
141 void
142 Initialize() override
143 {
144 this->Clear();
145 this->ConstructHilbertPath();
146 }
152 itkSetClampMacro(HilbertOrder, HilbertOrderType, 1, NumericTraits<HilbertOrderType>::max());
153 itkGetConstMacro(HilbertOrder, HilbertOrderType);
159
163
164protected:
166 ~HilbertPath() override = default;
167 void
168 PrintSelf(std::ostream & os, Indent indent) const override;
169
170private:
171 void
173
176
179
182
185
188
191
194
197
200
203
206
207 HilbertOrderType m_HilbertOrder{ 1 };
208 HilbertPathType m_HilbertPath{};
209};
210} // end namespace itk
211
212#ifndef ITK_MANUAL_INSTANTIATION
213# include "itkHilbertPath.hxx"
214#endif
215
216#endif
Base class for all data objects in ITK.
Represent an n-dimensional Hilbert path for a given order.
virtual void Clear()
virtual HilbertPathSizeType NumberOfSteps() const
OutputType Evaluate(const PathIndexType &input) const override
PathIndexType SetBit(const PathIndexType, const PathIndexType, const PathIndexType, const PathIndexType)
PathIndexType GetLeftBitRotation(PathIndexType, PathIndexType, const PathIndexType)
std::vector< IndexType > HilbertPathType
typename HilbertPathType::size_type HilbertPathSizeType
PathIndexType GetGrayCode(const PathIndexType)
PathIndexType GetEntry(const PathIndexType)
void PrintSelf(std::ostream &os, Indent indent) const override
void Initialize() override
PathIndexType GetRightBitRotation(PathIndexType, PathIndexType, const PathIndexType)
PathIndexType GetInverseGrayCode(const PathIndexType)
PathIndexType GetTransform(const PathIndexType, const PathIndexType, const PathIndexType, const PathIndexType)
OutputType EvaluateToIndex(const PathIndexType &input) const override
OffsetType IncrementInput(InputType &) const override
virtual InputType EvaluateInverse(const IndexType &input)
PathIndexType GetDirection(const PathIndexType, const PathIndexType)
PathIndexType GetTrailingSetBits(const PathIndexType, const PathIndexType)
InputType PathIndexType
InputType EndOfInput() const override
IndexType TransformPathIndexToMultiDimensionalIndex(const PathIndexType id)
void ConstructHilbertPath()
PathIndexType GetBitRange(const PathIndexType, const PathIndexType, const PathIndexType, const PathIndexType)
PathIndexType TransformMultiDimensionalIndexToPathIndex(const IndexType &index)
unsigned int HilbertOrderType
~HilbertPath() override=default
PathIndexType GetInverseTransform(const PathIndexType, const PathIndexType, const PathIndexType, const PathIndexType)
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Define additional traits for native types such as int or float.
Base class for most ITK classes.
Definition: itkObject.h:62
Represent a path through ND Space.
Definition: itkPath.h:55
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