ITK  5.2.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  * 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 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_ASSIGN(MirrorPadImageFilter);
63 
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(MirrorPadImageFilter, PadImageFilter);
75 
76  using InputImageType = TInputImage;
77  using OutputImageType = TOutputImage;
78 
80  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
81  using InputImageRegionType = typename Superclass::InputImageRegionType;
82 
84  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
85  using InputImagePixelType = typename Superclass::InputImagePixelType;
86 
88  using OutputImageIndexType = typename Superclass::OutputImageIndexType;
89  using InputImageIndexType = typename Superclass::InputImageIndexType;
90  using OutputImageSizeType = typename Superclass::OutputImageSizeType;
91  using InputImageSizeType = 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);
100 
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  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  long * regLimit,
155  std::vector<long> * indices,
156  std::vector<long> * sizes,
157  InputImageRegionType & outputRegion);
158 
162  int
163  GenerateNextOutputRegion(long * regIndices,
164  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::MirrorPadImageFilter::InputImageIndexType
typename Superclass::InputImageIndexType InputImageIndexType
Definition: itkMirrorPadImageFilter.h:89
itk::SmartPointer< Self >
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::MirrorPadImageFilter::OutputImageIndexType
typename Superclass::OutputImageIndexType OutputImageIndexType
Definition: itkMirrorPadImageFilter.h:88
test
int test(char *INfilename, char *OUTfilename, bool IsBinary)
Definition: itkMeshFileTestHelper.h:250
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::MirrorPadImageFilter::OutputImageSizeType
typename Superclass::OutputImageSizeType OutputImageSizeType
Definition: itkMirrorPadImageFilter.h:90
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkPadImageFilter.h
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:64
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:138
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::Concept::Convertible
Definition: itkConceptChecking.h:214
itk::IndexValueType
signed long IndexValueType
Definition: itkIntTypes.h:90
itkNumericTraits.h
itk::MirrorPadImageFilter::InputImageSizeType
typename Superclass::InputImageSizeType InputImageSizeType
Definition: itkMirrorPadImageFilter.h:91
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90