ITK  6.0.0
Insight Toolkit
itkFrequencyImageRegionConstIteratorWithIndex.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 itkFrequencyImageRegionConstIteratorWithIndex_h
19#define itkFrequencyImageRegionConstIteratorWithIndex_h
20
22
23namespace itk
24{
77template <typename TImage>
79{
80public:
81
85
87 using typename Superclass::IndexType;
88 using typename Superclass::SizeType;
89 using typename Superclass::OffsetType;
90 using typename Superclass::RegionType;
91 using typename Superclass::ImageType;
92 using typename Superclass::PixelContainer;
94 using typename Superclass::InternalPixelType;
95 using typename Superclass::PixelType;
96 using typename Superclass::AccessorType;
97
98 using FrequencyType = typename ImageType::SpacingType;
99 using FrequencyValueType = typename ImageType::SpacingValueType;
103 {
104 this->Init();
105 }
106
109 FrequencyImageRegionConstIteratorWithIndex(const TImage * ptr, const RegionType & region)
110 : ImageRegionConstIteratorWithIndex<TImage>(ptr, region)
111 {
112 this->Init();
113 }
114
123 {
124 this->Init();
125 }
126
127 /*
128 * The image is in the frequency domain already, return the index.
129 */
132 {
133 return this->GetIndex();
134 }
135
136 /* Similar to TransformIndexToPhysicalPoint on GetIndex(),
137 * but the result is cast to FrequencyType. And direction is not taken into account.
138 */
139 FrequencyType
141 {
142 FrequencyType freq;
143 IndexType freqInd = this->GetFrequencyBin();
144 // FrequencyType freq;
145 for (unsigned int dim = 0; dim < TImage::ImageDimension; ++dim)
146 {
147 freq[dim] = this->m_FrequencyOrigin[dim] + this->m_FrequencySpacing[dim] * freqInd[dim];
148 }
149 return freq;
150 }
151
152 FrequencyValueType
154 {
155 FrequencyValueType w2(0);
156 FrequencyType w(this->GetFrequency());
157
158 for (unsigned int dim = 0; dim < TImage::ImageDimension; ++dim)
159 {
160 w2 += w[dim] * w[dim];
161 }
162 return w2;
163 }
164
166 itkGetConstReferenceMacro(FrequencyOrigin, FrequencyType);
167
170 itkGetConstReferenceMacro(FrequencySpacing, FrequencyType);
171
172private:
175 void
177 {
178 for (unsigned int dim = 0; dim < ImageType::ImageDimension; ++dim)
179 {
180 this->m_FrequencyOrigin[dim] = this->m_Image->GetOrigin()[dim];
181 this->m_FrequencySpacing[dim] = this->m_Image->GetSpacing()[dim];
182 }
183 }
188};
189} // end namespace itk
190#endif
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
FrequencyImageRegionConstIteratorWithIndex(const TImage *ptr, const RegionType &region)
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
typename PixelContainer::Pointer PixelContainerPointer
typename TImage::InternalPixelType InternalPixelType
typename TImage::PixelContainer PixelContainer
A multi-dimensional iterator templated over image type that walks an image region and is specialized ...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....