ITK  5.1.0
Insight Toolkit
itkFrequencyImageRegionConstIteratorWithIndex.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
76 template <typename TImage>
78 {
79 public:
83 
85  using IndexType = typename Superclass::IndexType;
86  using SizeType = typename Superclass::SizeType;
89  using ImageType = typename Superclass::ImageType;
93  using PixelType = typename Superclass::PixelType;
95 
96  using FrequencyType = typename ImageType::SpacingType;
97  using FrequencyValueType = typename ImageType::SpacingValueType;
101  {
102  this->Init();
103  }
104 
107  FrequencyImageRegionConstIteratorWithIndex(const TImage * ptr, const RegionType & region)
108  : ImageRegionConstIteratorWithIndex<TImage>(ptr, region)
109  {
110  this->Init();
111  }
112 
121  {
122  this->Init();
123  }
124 
125  /*
126  * The image is in the frequency domain already, return the index.
127  */
128  IndexType
130  {
131  return this->GetIndex();
132  }
133 
134  /* Similar to TransformIndexToPhysicalPoint on GetIndex(),
135  * but the result is cast to FrequencyType. And direction is not taken into account.
136  */
138  GetFrequency() const
139  {
140  FrequencyType freq;
141  IndexType freqInd = this->GetFrequencyBin();
142  // FrequencyType freq;
143  for (unsigned int dim = 0; dim < TImage::ImageDimension; dim++)
144  {
145  freq[dim] = this->m_FrequencyOrigin[dim] + this->m_FrequencySpacing[dim] * freqInd[dim];
146  }
147  return freq;
148  }
149 
152  {
153  FrequencyValueType w2(0);
154  FrequencyType w(this->GetFrequency());
155 
156  for (unsigned int dim = 0; dim < TImage::ImageDimension; dim++)
157  {
158  w2 += w[dim] * w[dim];
159  }
160  return w2;
161  }
162 
164  itkGetConstReferenceMacro(FrequencyOrigin, FrequencyType);
165 
168  itkGetConstReferenceMacro(FrequencySpacing, FrequencyType);
169 
170 private:
173  void
175  {
176  this->m_FrequencyOrigin = this->m_Image->GetOrigin();
177  this->m_FrequencySpacing = this->m_Image->GetSpacing();
178  }
180 
183 };
184 } // end namespace itk
185 #endif
itk::ImageRegionConstIteratorWithIndex::PixelType
typename Superclass::PixelType PixelType
Definition: itkImageRegionConstIteratorWithIndex.h:149
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:128
itk::FrequencyImageRegionConstIteratorWithIndex
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:77
itk::ImageConstIteratorWithIndex::m_Image
TImage::ConstWeakPointer m_Image
Definition: itkImageConstIteratorWithIndex.h:296
itk::ImageRegionConstIteratorWithIndex::PixelContainerPointer
typename Superclass::PixelContainerPointer PixelContainerPointer
Definition: itkImageRegionConstIteratorWithIndex.h:147
itk::FrequencyImageRegionConstIteratorWithIndex::Init
void Init()
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:174
itk::FrequencyImageRegionConstIteratorWithIndex::m_FrequencyOrigin
FrequencyType m_FrequencyOrigin
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:181
itk::ImageConstIteratorWithIndex::PixelContainerPointer
typename PixelContainer::Pointer PixelContainerPointer
Definition: itkImageConstIteratorWithIndex.h:122
itk::FrequencyImageRegionConstIteratorWithIndex::GetFrequencyBin
IndexType GetFrequencyBin() const
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:129
itk::ImageRegionConstIteratorWithIndex::ImageType
typename Superclass::ImageType ImageType
Definition: itkImageRegionConstIteratorWithIndex.h:145
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:143
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:138
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyImageRegionConstIteratorWithIndex
FrequencyImageRegionConstIteratorWithIndex(const Superclass &it)
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:119
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyType
typename ImageType::SpacingType FrequencyType
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:96
itk::FrequencyImageRegionConstIteratorWithIndex::IndexType
typename Superclass::IndexType IndexType
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:85
itk::ImageRegionConstIteratorWithIndex::RegionType
typename Superclass::RegionType RegionType
Definition: itkImageRegionConstIteratorWithIndex.h:144
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyValueType
typename ImageType::SpacingValueType FrequencyValueType
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:97
itk::FrequencyImageRegionConstIteratorWithIndex::GetFrequencyModuloSquare
FrequencyValueType GetFrequencyModuloSquare() const
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:151
itk::ImageConstIteratorWithIndex::AccessorType
typename TImage::AccessorType AccessorType
Definition: itkImageConstIteratorWithIndex.h:132
itk::FrequencyImageRegionConstIteratorWithIndex::m_FrequencySpacing
FrequencyType m_FrequencySpacing
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:182
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyImageRegionConstIteratorWithIndex
FrequencyImageRegionConstIteratorWithIndex()
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:99
itk::ImageRegionConstIteratorWithIndex::IndexType
typename Superclass::IndexType IndexType
Definition: itkImageRegionConstIteratorWithIndex.h:141
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:150
itk::ImageRegionConstIteratorWithIndex::InternalPixelType
typename Superclass::InternalPixelType InternalPixelType
Definition: itkImageRegionConstIteratorWithIndex.h:148
itk::ImageRegionConstIteratorWithIndex::SizeType
typename Superclass::SizeType SizeType
Definition: itkImageRegionConstIteratorWithIndex.h:142
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::ImageConstIteratorWithIndex::RegionType
typename TImage::RegionType RegionType
Definition: itkImageConstIteratorWithIndex.h:113
itk::ImageRegionConstIteratorWithIndex::PixelContainer
typename Superclass::PixelContainer PixelContainer
Definition: itkImageRegionConstIteratorWithIndex.h:146
itk::FrequencyImageRegionConstIteratorWithIndex::FrequencyImageRegionConstIteratorWithIndex
FrequencyImageRegionConstIteratorWithIndex(const TImage *ptr, const RegionType &region)
Definition: itkFrequencyImageRegionConstIteratorWithIndex.h:107
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