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
00039 template <class TInputImage, class TOutputImage>
00040 class ITK_EXPORT MirrorPadImageFilter:
00041 public PadImageFilter<TInputImage,TOutputImage>
00042 {
00043 public:
00045 typedef MirrorPadImageFilter Self;
00046 typedef PadImageFilter<TInputImage,TOutputImage> Superclass;
00047 typedef SmartPointer<Self> Pointer;
00048 typedef SmartPointer<const Self> ConstPointer;
00049
00051 itkNewMacro(Self);
00052
00054 itkTypeMacro(MirrorPadImageFilter, PadImageFilter);
00055
00056 typedef TInputImage InputImageType;
00057 typedef TOutputImage OutputImageType;
00058
00060 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00061 typedef typename Superclass::InputImageRegionType InputImageRegionType;
00062
00064 typedef typename Superclass::OutputImagePixelType OutputImagePixelType;
00065 typedef typename Superclass::InputImagePixelType InputImagePixelType;
00066
00068 typedef typename Superclass::OutputImageIndexType OutputImageIndexType;
00069 typedef typename Superclass::InputImageIndexType InputImageIndexType;
00070 typedef typename Superclass::OutputImageSizeType OutputImageSizeType;
00071 typedef typename Superclass::InputImageSizeType InputImageSizeType;
00072
00074 itkStaticConstMacro(ImageDimension, unsigned int,
00075 TInputImage::ImageDimension);
00076
00077 protected:
00078 MirrorPadImageFilter() {};
00079 ~MirrorPadImageFilter() {};
00080
00083 void ConvertOutputIndexToInputIndex(OutputImageIndexType & outputIndex,
00084 InputImageIndexType & inputIndex,
00085 OutputImageRegionType & outputRegion,
00086 InputImageRegionType & inputRegion,
00087 int oddRegionArray[ImageDimension]);
00088
00091 int RegionIsOdd(long base, long test, long size);
00092
00103 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00104 int threadId );
00108 int GenerateNextInputRegion(long *regIndices, long *regLimit,
00109 std::vector<long> indices[ImageDimension],
00110 std::vector<long> sizes[ImageDimension],
00111 InputImageRegionType& outputRegion);
00112
00116 int GenerateNextOutputRegion(long *regIndices, long *regLimit,
00117 std::vector<long> indices[ImageDimension],
00118 std::vector<long> sizes[ImageDimension],
00119 OutputImageRegionType& outputRegion);
00124 int FindRegionsInArea(long start, long end, long size, long offset);
00125
00132 int BuildInterRegions(std::vector<long>& inputRegionStart,
00133 std::vector<long>& outputRegionStart,
00134 std::vector<long>& inputRegionSizes,
00135 std::vector<long>& outputRegionSizes,
00136 long inputIndex, long outputIndex,
00137 long inputSize, long outputSize, int numRegs,
00138 int & regCtr);
00139
00148 int BuildPreRegions(std::vector<long>& inputRegionStart,
00149 std::vector<long>& outputRegionStart,
00150 std::vector<long>& inputRegionSizes,
00151 std::vector<long>& outputRegionSizes,
00152 long inputIndex, long outputIndex,
00153 long inputSize, long outputSize, int numRegs,
00154 int & regCtr);
00155
00164 int BuildPostRegions(std::vector<long>& inputRegionStart,
00165 std::vector<long>& outputRegionStart,
00166 std::vector<long>& inputRegionSizes,
00167 std::vector<long>& outputRegionSizes,
00168 long inputIndex, long outputIndex,
00169 long inputSize, long outputSize,
00170 int numRegs, int & regCtr);
00171
00179 virtual void GenerateInputRequestedRegion();
00180
00181 private:
00182 MirrorPadImageFilter(const Self&);
00183 void operator=(const Self&);
00184
00185 };
00186
00187
00188 }
00189
00190 #ifndef ITK_MANUAL_INSTANTIATION
00191 #include "itkMirrorPadImageFilter.txx"
00192 #endif
00193
00194 #endif