ITK  5.4.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 
23 namespace itk
24 {
77 template <typename TImage>
79 {
80 public:
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;
93  using typename Superclass::PixelContainerPointer;
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  */
130  IndexType
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
140  GetFrequency() const
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 
172 private:
175  void
177  {
178  this->m_FrequencyOrigin = this->m_Image->GetOrigin();
179  this->m_FrequencySpacing = this->m_Image->GetSpacing();
180  }
185 };
186 } // end namespace itk
187 #endif
itkImageRegionConstIteratorWithIndex.h
itk::ImageRegionConstIteratorWithIndex
A multi-dimensional iterator templated over image type that walks an image region and is specialized ...
Definition: itkImageRegionConstIteratorWithIndex.h:130
itk::FrequencyImageRegionConstIteratorWithIndex
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:78
itk::FrequencyImageRegionConstIteratorWithIndex::Init
void Init()
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:176
itk::FrequencyImageRegionConstIteratorWithIndex::m_FrequencyOrigin
FrequencyType m_FrequencyOrigin
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:183
itk::ImageConstIteratorWithIndex::PixelContainerPointer
typename PixelContainer::Pointer PixelContainerPointer
Definition: itkImageConstIteratorWithIndex.h:122
itk::FrequencyImageRegionConstIteratorWithIndex::GetFrequencyBin
IndexType GetFrequencyBin() const
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:131
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::ImageConstIteratorWithIndex::PixelType
typename TImage::PixelType PixelType
Definition: itkImageConstIteratorWithIndex.h:128
itk::ImageConstIteratorWithIndex::IndexType
typename TImage::IndexType IndexType
Definition: itkImageConstIteratorWithIndex.h:105
itk::ImageConstIteratorWithIndex::InternalPixelType
typename TImage::InternalPixelType InternalPixelType
Definition: itkImageConstIteratorWithIndex.h:125
itk::FrequencyImageRegionConstIteratorWithIndex::GetFrequency
FrequencyType GetFrequency() const
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:140
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyImageRegionConstIteratorWithIndex
FrequencyImageRegionConstIteratorWithIndex(const Superclass &it)
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:121
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyType
typename ImageType::SpacingType FrequencyType
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:98
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyValueType
typename ImageType::SpacingValueType FrequencyValueType
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:99
itk::FrequencyImageRegionConstIteratorWithIndex::GetFrequencyModuloSquare
FrequencyValueType GetFrequencyModuloSquare() const
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:153
itk::ImageConstIteratorWithIndex::AccessorType
typename TImage::AccessorType AccessorType
Definition: itkImageConstIteratorWithIndex.h:132
itk::FrequencyImageRegionConstIteratorWithIndex::m_FrequencySpacing
FrequencyType m_FrequencySpacing
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:184
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyImageRegionConstIteratorWithIndex
FrequencyImageRegionConstIteratorWithIndex()
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:101
itk::ImageConstIteratorWithIndex
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
Definition: itkImageConstIteratorWithIndex.h:92
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageConstIteratorWithIndex::RegionType
typename TImage::RegionType RegionType
Definition: itkImageConstIteratorWithIndex.h:113
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyImageRegionConstIteratorWithIndex
FrequencyImageRegionConstIteratorWithIndex(const TImage *ptr, const RegionType &region)
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:109
itk::ImageConstIteratorWithIndex::ImageType
TImage ImageType
Definition: itkImageConstIteratorWithIndex.h:116
itk::ImageConstIteratorWithIndex::PixelContainer
typename TImage::PixelContainer PixelContainer
Definition: itkImageConstIteratorWithIndex.h:121
itk::ImageConstIteratorWithIndex::OffsetType
typename TImage::OffsetType OffsetType
Definition: itkImageConstIteratorWithIndex.h:136