ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkMovingHistogramImageFilterBase.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 itkMovingHistogramImageFilterBase_h
19#define itkMovingHistogramImageFilterBase_h
20
23#include <list>
24#include <map>
25#include <set>
26
27namespace itk
28{
89
90template <typename TInputImage, typename TOutputImage, typename TKernel>
91class ITK_TEMPLATE_EXPORT MovingHistogramImageFilterBase : public KernelImageFilter<TInputImage, TOutputImage, TKernel>
92{
93public:
94 ITK_DISALLOW_COPY_AND_MOVE(MovingHistogramImageFilterBase);
95
101
103 itkNewMacro(Self);
104
106 itkOverrideGetNameOfClassMacro(MovingHistogramImageFilterBase);
107
109 using InputImageType = TInputImage;
110 using OutputImageType = TOutputImage;
111 using RegionType = typename TInputImage::RegionType;
112 using SizeType = typename TInputImage::SizeType;
113 using IndexType = typename TInputImage::IndexType;
114 using PixelType = typename TInputImage::PixelType;
115 using OffsetType = typename TInputImage::OffsetType;
117 using OutputPixelType = typename TOutputImage::PixelType;
118
120 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
121
123 using KernelType = TKernel;
124
126 using KernelIteratorType = typename KernelType::ConstIterator;
127
129 using RadiusType = typename KernelType::SizeType;
130
131 using OffsetListType = typename std::list<OffsetType>;
132
133 using OffsetMapType = typename std::map<OffsetType, OffsetListType, Functor::LexicographicCompare>;
134
136 void
137 SetKernel(const KernelType & kernel) override;
138
139 itkGetConstMacro(PixelsPerTranslation, SizeValueType);
140
141protected:
144
145 void
146 PrintSelf(std::ostream & os, Indent indent) const override;
147
148 void
149 GetDirAndOffset(const IndexType LineStart,
150 const IndexType PrevLineStart,
151 OffsetType & LineOffset,
152 OffsetType & Changes,
153 int & LineDirection);
154
155 // store the added and removed pixel offset in a list
158
159 // store the offset of the kernel to initialize the histogram
161
163
165
166private:
168 {
169 public:
170 DirectionCost(int dimension, int count)
171 : m_Dimension(dimension)
172 , m_Count(count)
173 {}
174
179 inline bool
180 operator<(const DirectionCost & dc) const
181 {
182 if (m_Count > dc.m_Count)
183 {
184 return true;
185 }
186 if (m_Count < dc.m_Count)
187 {
188 return false;
189 }
190 else // if (m_Count == dc.m_Count)
191 {
192 return m_Dimension > dc.m_Dimension;
193 }
194 }
195
198 };
199}; // end of class
200} // end namespace itk
201
202#ifndef ITK_MANUAL_INSTANTIATION
203# include "itkMovingHistogramImageFilterBase.hxx"
204#endif
205
206#endif
Simulate a standard C array with copy semantics.
typename OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition itkIndent.h:50
typename std::map< OffsetType, OffsetListType, Functor::LexicographicCompare > OffsetMapType
typename KernelType::ConstIterator KernelIteratorType
void GetDirAndOffset(const IndexType LineStart, const IndexType PrevLineStart, OffsetType &LineOffset, OffsetType &Changes, int &LineDirection)
~MovingHistogramImageFilterBase() override=default
FixedArray< int, Self::ImageDimension > m_Axes
void SetKernel(const KernelType &kernel) override
KernelImageFilter< TInputImage, TOutputImage, TKernel > Superclass
void PrintSelf(std::ostream &os, Indent indent) const override
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86