00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMirrorPadImageFilter_h
00018 #define __itkMirrorPadImageFilter_h
00019
00020 #include "itkPadImageFilter.h"
00021 #include <vector>
00022
00023 namespace itk
00024 {
00025
00044 template <class TInputImage, class TOutputImage>
00045 class ITK_EXPORT MirrorPadImageFilter:
00046 public PadImageFilter<TInputImage,TOutputImage>
00047 {
00048 public:
00050 typedef MirrorPadImageFilter Self;
00051 typedef PadImageFilter<TInputImage,TOutputImage> Superclass;
00052 typedef SmartPointer<Self> Pointer;
00053 typedef SmartPointer<const Self> ConstPointer;
00054
00056 itkNewMacro(Self);
00057
00059 itkTypeMacro(MirrorPadImageFilter, PadImageFilter);
00060
00061 typedef TInputImage InputImageType;
00062 typedef TOutputImage OutputImageType;
00063
00065 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00066 typedef typename Superclass::InputImageRegionType InputImageRegionType;
00067
00069 typedef typename Superclass::OutputImagePixelType OutputImagePixelType;
00070 typedef typename Superclass::InputImagePixelType InputImagePixelType;
00071
00073 typedef typename Superclass::OutputImageIndexType OutputImageIndexType;
00074 typedef typename Superclass::InputImageIndexType InputImageIndexType;
00075 typedef typename Superclass::OutputImageSizeType OutputImageSizeType;
00076 typedef typename Superclass::InputImageSizeType InputImageSizeType;
00077
00079 itkStaticConstMacro(ImageDimension, unsigned int,
00080 TInputImage::ImageDimension);
00081
00082 protected:
00083 MirrorPadImageFilter() {};
00084 ~MirrorPadImageFilter() {};
00085
00088 void ConvertOutputIndexToInputIndex(OutputImageIndexType & outputIndex,
00089 InputImageIndexType & inputIndex,
00090 OutputImageRegionType & outputRegion,
00091 InputImageRegionType & inputRegion,
00092 int* oddRegionArray);
00093
00096 int RegionIsOdd(long base, long test, long size);
00097
00108 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00109 int threadId );
00113 int GenerateNextInputRegion(long *regIndices, long *regLimit,
00114 std::vector<long>* indices,
00115 std::vector<long>* sizes,
00116 InputImageRegionType& outputRegion);
00117
00121 int GenerateNextOutputRegion(long *regIndices, long *regLimit,
00122 std::vector<long>* indices,
00123 std::vector<long>* sizes,
00124 OutputImageRegionType& outputRegion);
00129 int FindRegionsInArea(long start, long end, long size, long offset);
00130
00137 int BuildInterRegions(std::vector<long>& inputRegionStart,
00138 std::vector<long>& outputRegionStart,
00139 std::vector<long>& inputRegionSizes,
00140 std::vector<long>& outputRegionSizes,
00141 long inputIndex, long outputIndex,
00142 long inputSize, long outputSize, int numRegs,
00143 int & regCtr);
00144
00153 int BuildPreRegions(std::vector<long>& inputRegionStart,
00154 std::vector<long>& outputRegionStart,
00155 std::vector<long>& inputRegionSizes,
00156 std::vector<long>& outputRegionSizes,
00157 long inputIndex, long outputIndex,
00158 long inputSize, long outputSize, int numRegs,
00159 int & regCtr);
00160
00169 int BuildPostRegions(std::vector<long>& inputRegionStart,
00170 std::vector<long>& outputRegionStart,
00171 std::vector<long>& inputRegionSizes,
00172 std::vector<long>& outputRegionSizes,
00173 long inputIndex, long outputIndex,
00174 long inputSize, long outputSize,
00175 int numRegs, int & regCtr);
00176
00184 virtual void GenerateInputRequestedRegion();
00185
00186 private:
00187 MirrorPadImageFilter(const Self&);
00188 void operator=(const Self&);
00189
00190 };
00191
00192
00193 }
00194
00195 #ifndef ITK_MANUAL_INSTANTIATION
00196 #include "itkMirrorPadImageFilter.txx"
00197 #endif
00198
00199 #endif