ITK  6.0.0
Insight Toolkit
itkMirrorPadImageFilter.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 itkMirrorPadImageFilter_h
19#define itkMirrorPadImageFilter_h
20
21#include "itkPadImageFilter.h"
22#include "itkNumericTraits.h"
23#include <vector>
24
25namespace itk
26{
27
58template <typename TInputImage, typename TOutputImage>
59class ITK_TEMPLATE_EXPORT MirrorPadImageFilter : public PadImageFilter<TInputImage, TOutputImage>
60{
61public:
62 ITK_DISALLOW_COPY_AND_MOVE(MirrorPadImageFilter);
63
69
71 itkNewMacro(Self);
72
74 itkOverrideGetNameOfClassMacro(MirrorPadImageFilter);
75
76 using InputImageType = TInputImage;
77 using OutputImageType = TOutputImage;
78
80 using typename Superclass::OutputImageRegionType;
81 using typename Superclass::InputImageRegionType;
82
84 using typename Superclass::OutputImagePixelType;
85 using typename Superclass::InputImagePixelType;
86
88 using typename Superclass::OutputImageIndexType;
89 using typename Superclass::InputImageIndexType;
90 using typename Superclass::OutputImageSizeType;
91 using typename Superclass::InputImageSizeType;
92
94 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
95
97 itkGetMacro(DecayBase, double);
98 itkSetClampMacro(DecayBase, double, NumericTraits<double>::min(), 1.0);
101#ifdef ITK_USE_CONCEPT_CHECKING
102 // Begin concept checking
104 // End concept checking
105#endif
106
107protected:
109 ~MirrorPadImageFilter() override = default;
110
111
114 void
116 InputImageIndexType & inputIndex,
117 OutputImageRegionType & outputRegion,
118 InputImageRegionType & inputRegion,
119 int * oddRegionArray,
120 IndexValueType & distanceFromEdge);
121
122 void
124 InputImageIndexType & inputIndex,
125 OutputImageRegionType & outputRegion,
126 InputImageRegionType & inputRegion,
127 const int * oddRegionArray,
128 double & outDecayFactor);
129
132 int
133 RegionIsOdd(long base, long test, long size);
134
145 void
146 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
147
148
152 int
153 GenerateNextInputRegion(long * regIndices,
154 const long * regLimit,
155 std::vector<long> * indices,
156 std::vector<long> * sizes,
157 InputImageRegionType & inputRegion);
158
162 int
163 GenerateNextOutputRegion(long * regIndices,
164 const long * regLimit,
165 std::vector<long> * indices,
166 std::vector<long> * sizes,
167 OutputImageRegionType & outputRegion);
168
173 int
174 FindRegionsInArea(long start, long end, long size, long offset);
175
182 int
183 BuildInterRegions(std::vector<long> & inputRegionStart,
184 std::vector<long> & outputRegionStart,
185 std::vector<long> & inputRegionSizes,
186 std::vector<long> & outputRegionSizes,
187 long inputIndex,
188 long outputIndex,
189 long inputSize,
190 long outputSize,
191 int numRegs,
192 int & regCtr);
193
202 int
203 BuildPreRegions(std::vector<long> & inputRegionStart,
204 std::vector<long> & outputRegionStart,
205 std::vector<long> & inputRegionSizes,
206 std::vector<long> & outputRegionSizes,
207 long inputIndex,
208 long outputIndex,
209 long inputSize,
210 long outputSize,
211 int numRegs,
212 int & regCtr);
213
222 int
223 BuildPostRegions(std::vector<long> & inputRegionStart,
224 std::vector<long> & outputRegionStart,
225 std::vector<long> & inputRegionSizes,
226 std::vector<long> & outputRegionSizes,
227 long inputIndex,
228 long outputIndex,
229 long inputSize,
230 long outputSize,
231 int numRegs,
232 int & regCtr);
233
241 void
243
244private:
245 double m_DecayBase = 1.0;
246};
247} // end namespace itk
248
249#ifndef ITK_MANUAL_INSTANTIATION
250# include "itkMirrorPadImageFilter.hxx"
251#endif
252
253#endif
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename InputImageType::RegionType InputImageRegionType
Increase the image size by padding with replicants of the input image value.
void ConvertOutputIndexToInputIndex(OutputImageIndexType &outputIndex, InputImageIndexType &inputIndex, OutputImageRegionType &outputRegion, InputImageRegionType &inputRegion, int *oddRegionArray, IndexValueType &distanceFromEdge)
int BuildInterRegions(std::vector< long > &inputRegionStart, std::vector< long > &outputRegionStart, std::vector< long > &inputRegionSizes, std::vector< long > &outputRegionSizes, long inputIndex, long outputIndex, long inputSize, long outputSize, int numRegs, int &regCtr)
int RegionIsOdd(long base, long test, long size)
int BuildPostRegions(std::vector< long > &inputRegionStart, std::vector< long > &outputRegionStart, std::vector< long > &inputRegionSizes, std::vector< long > &outputRegionSizes, long inputIndex, long outputIndex, long inputSize, long outputSize, int numRegs, int &regCtr)
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void ConvertOutputIndexToInputIndex(OutputImageIndexType &outputIndex, InputImageIndexType &inputIndex, OutputImageRegionType &outputRegion, InputImageRegionType &inputRegion, const int *oddRegionArray, double &outDecayFactor)
int GenerateNextInputRegion(long *regIndices, const long *regLimit, std::vector< long > *indices, std::vector< long > *sizes, InputImageRegionType &inputRegion)
void GenerateInputRequestedRegion() override
int FindRegionsInArea(long start, long end, long size, long offset)
~MirrorPadImageFilter() override=default
int GenerateNextOutputRegion(long *regIndices, const long *regLimit, std::vector< long > *indices, std::vector< long > *sizes, OutputImageRegionType &outputRegion)
int BuildPreRegions(std::vector< long > &inputRegionStart, std::vector< long > &outputRegionStart, std::vector< long > &inputRegionSizes, std::vector< long > &outputRegionSizes, long inputIndex, long outputIndex, long inputSize, long outputSize, int numRegs, int &regCtr)
Define additional traits for native types such as int or float.
Increase the image size by padding. Superclass for filters that fill in extra pixels.
typename TOutputImage::IndexType OutputImageIndexType
typename TInputImage::IndexType InputImageIndexType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
#define itkConceptMacro(name, concept)
int test(char *inputFileName, char *outputFileName, bool isBinary)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
long IndexValueType
Definition: itkIntTypes.h:93