ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkMirrorPadImageFilter.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 __itkMirrorPadImageFilter_h
19 #define __itkMirrorPadImageFilter_h
20 
21 #include "itkPadImageFilter.h"
22 #include <vector>
23 
24 namespace itk
25 {
51 template< class TInputImage, class TOutputImage >
52 class ITK_EXPORT MirrorPadImageFilter:
53  public PadImageFilter< TInputImage, TOutputImage >
54 {
55 public:
61 
63  itkNewMacro(Self);
64 
67 
68  typedef TInputImage InputImageType;
69  typedef TOutputImage OutputImageType;
70 
72  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
73  typedef typename Superclass::InputImageRegionType InputImageRegionType;
74 
76  typedef typename Superclass::OutputImagePixelType OutputImagePixelType;
77  typedef typename Superclass::InputImagePixelType InputImagePixelType;
78 
80  typedef typename Superclass::OutputImageIndexType OutputImageIndexType;
81  typedef typename Superclass::InputImageIndexType InputImageIndexType;
82  typedef typename Superclass::OutputImageSizeType OutputImageSizeType;
83  typedef typename Superclass::InputImageSizeType InputImageSizeType;
84 
86  itkStaticConstMacro(ImageDimension, unsigned int,
87  TInputImage::ImageDimension);
88 
89 #ifdef ITK_USE_CONCEPT_CHECKING
90 
91  itkConceptMacro( InputConvertibleToOutputCheck,
93 
95 #endif
96 
97 protected:
100 
103  void ConvertOutputIndexToInputIndex(OutputImageIndexType & outputIndex,
104  InputImageIndexType & inputIndex,
105  OutputImageRegionType & outputRegion,
106  InputImageRegionType & inputRegion,
107  int *oddRegionArray);
108 
111  int RegionIsOdd(long base, long test, long size);
112 
123  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
124  ThreadIdType threadId);
125 
129  int GenerateNextInputRegion(long *regIndices, long *regLimit,
130  std::vector< long > *indices,
131  std::vector< long > *sizes,
132  InputImageRegionType & outputRegion);
133 
137  int GenerateNextOutputRegion(long *regIndices, long *regLimit,
138  std::vector< long > *indices,
139  std::vector< long > *sizes,
140  OutputImageRegionType & outputRegion);
141 
146  int FindRegionsInArea(long start, long end, long size, long offset);
147 
154  int BuildInterRegions(std::vector< long > & inputRegionStart,
155  std::vector< long > & outputRegionStart,
156  std::vector< long > & inputRegionSizes,
157  std::vector< long > & outputRegionSizes,
158  long inputIndex, long outputIndex,
159  long inputSize, long outputSize, int numRegs,
160  int & regCtr);
161 
170  int BuildPreRegions(std::vector< long > & inputRegionStart,
171  std::vector< long > & outputRegionStart,
172  std::vector< long > & inputRegionSizes,
173  std::vector< long > & outputRegionSizes,
174  long inputIndex, long outputIndex,
175  long inputSize, long outputSize, int numRegs,
176  int & regCtr);
177 
186  int BuildPostRegions(std::vector< long > & inputRegionStart,
187  std::vector< long > & outputRegionStart,
188  std::vector< long > & inputRegionSizes,
189  std::vector< long > & outputRegionSizes,
190  long inputIndex, long outputIndex,
191  long inputSize, long outputSize,
192  int numRegs, int & regCtr);
193 
201  virtual void GenerateInputRequestedRegion();
202 
203 private:
204  MirrorPadImageFilter(const Self &); //purposely not implemented
205  void operator=(const Self &); //purposely not implemented
206 };
207 } // end namespace itk
208 
209 #ifndef ITK_MANUAL_INSTANTIATION
210 #include "itkMirrorPadImageFilter.hxx"
211 #endif
212 
213 #endif
214