ITK  5.4.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 
25 namespace itk
26 {
27 
58 template <typename TInputImage, typename TOutputImage>
59 class ITK_TEMPLATE_EXPORT MirrorPadImageFilter : public PadImageFilter<TInputImage, TOutputImage>
60 {
61 public:
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 
107 protected:
108  MirrorPadImageFilter() = default;
109  ~MirrorPadImageFilter() override = default;
110 
111 
114  void
115  ConvertOutputIndexToInputIndex(OutputImageIndexType & outputIndex,
116  InputImageIndexType & inputIndex,
117  OutputImageRegionType & outputRegion,
118  InputImageRegionType & inputRegion,
119  int * oddRegionArray,
120  IndexValueType & distanceFromEdge);
121 
122  void
123  ConvertOutputIndexToInputIndex(OutputImageIndexType & outputIndex,
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
242  GenerateInputRequestedRegion() override;
243 
244 private:
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
itk::PadImageFilter::InputImageIndexType
typename TInputImage::IndexType InputImageIndexType
Definition: itkPadImageFilter.h:72
itk::PadImageFilter::OutputImageIndexType
typename TOutputImage::IndexType OutputImageIndexType
Definition: itkPadImageFilter.h:71
itk::SmartPointer< Self >
itk::IndexValueType
long IndexValueType
Definition: itkIntTypes.h:90
test
int test(char *inputFileName, char *outputFileName, bool isBinary)
Definition: itkMeshFileTestHelper.h:250
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::MirrorPadImageFilter
Increase the image size by padding with replicants of the input image value.
Definition: itkMirrorPadImageFilter.h:59
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::PadImageFilter
Increase the image size by padding. Superclass for filters that fill in extra pixels.
Definition: itkPadImageFilter.h:48
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:59
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkPadImageFilter.h
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itkNumericTraits.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90