ITK  5.2.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  * http://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 IndexType = typename Superclass::IndexType;
88  using SizeType = typename Superclass::SizeType;
91  using ImageType = typename Superclass::ImageType;
95  using PixelType = typename Superclass::PixelType;
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  */
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 
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  }
182 
185 };
186 } // end namespace itk
187 #endif
itk::ImageRegionConstIteratorWithIndex::PixelType
typename Superclass::PixelType PixelType
Definition: itkImageRegionConstIteratorWithIndex.h:151
itk::ImageConstIteratorWithIndex::SizeType
typename TImage::SizeType SizeType
Definition: itkImageConstIteratorWithIndex.h:109
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::ImageConstIteratorWithIndex::m_Image
TImage::ConstWeakPointer m_Image
Definition: itkImageConstIteratorWithIndex.h:296
itk::ImageRegionConstIteratorWithIndex::PixelContainerPointer
typename Superclass::PixelContainerPointer PixelContainerPointer
Definition: itkImageRegionConstIteratorWithIndex.h:149
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::ImageRegionConstIteratorWithIndex::ImageType
typename Superclass::ImageType ImageType
Definition: itkImageRegionConstIteratorWithIndex.h:147
itk::ImageConstIteratorWithIndex::GetIndex
const IndexType & GetIndex() const
Definition: itkImageConstIteratorWithIndex.h:227
itk::ImageConstIteratorWithIndex::PixelType
typename TImage::PixelType PixelType
Definition: itkImageConstIteratorWithIndex.h:128
itk::ImageRegionConstIteratorWithIndex::OffsetType
typename Superclass::OffsetType OffsetType
Definition: itkImageRegionConstIteratorWithIndex.h:145
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::FrequencyImageRegionConstIteratorWithIndex::FrequencyImageRegionConstIteratorWithIndex
FrequencyImageRegionConstIteratorWithIndex(const Superclass &it)
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:121
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyType
typename ImageType::SpacingType FrequencyType
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:98
itk::FrequencyImageRegionConstIteratorWithIndex::IndexType
typename Superclass::IndexType IndexType
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:87
itk::ImageRegionConstIteratorWithIndex::RegionType
typename Superclass::RegionType RegionType
Definition: itkImageRegionConstIteratorWithIndex.h:146
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::ImageRegionConstIteratorWithIndex::IndexType
typename Superclass::IndexType IndexType
Definition: itkImageRegionConstIteratorWithIndex.h:143
itk::ImageConstIteratorWithIndex
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
Definition: itkImageConstIteratorWithIndex.h:92
itk::ImageRegionConstIteratorWithIndex::AccessorType
typename Superclass::AccessorType AccessorType
Definition: itkImageRegionConstIteratorWithIndex.h:152
itk::ImageRegionConstIteratorWithIndex::InternalPixelType
typename Superclass::InternalPixelType InternalPixelType
Definition: itkImageRegionConstIteratorWithIndex.h:150
itk::ImageRegionConstIteratorWithIndex::SizeType
typename Superclass::SizeType SizeType
Definition: itkImageRegionConstIteratorWithIndex.h:144
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::ImageRegionConstIteratorWithIndex::PixelContainer
typename Superclass::PixelContainer PixelContainer
Definition: itkImageRegionConstIteratorWithIndex.h:148
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