00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkCropImageFilter_h
00018 #define __itkCropImageFilter_h
00019
00020 #include "itkExtractImageFilter.h"
00021
00022 namespace itk
00023 {
00024
00037 template <class TInputImage, class TOutputImage>
00038 class ITK_EXPORT CropImageFilter:
00039 public ExtractImageFilter<TInputImage,TOutputImage>
00040 {
00041 public:
00043 typedef CropImageFilter Self;
00044 typedef ExtractImageFilter<TInputImage,TOutputImage> Superclass;
00045 typedef SmartPointer<Self> Pointer;
00046 typedef SmartPointer<const Self> ConstPointer;
00047
00049 itkNewMacro(Self);
00050
00052 itkTypeMacro(CropImageFilter, ExtractImageFilter);
00053
00055 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00056 typedef typename Superclass::InputImageRegionType InputImageRegionType;
00057
00059 typedef typename Superclass::OutputImagePixelType OutputImagePixelType;
00060 typedef typename Superclass::InputImagePixelType InputImagePixelType;
00061
00063 typedef typename Superclass::OutputImageIndexType OutputImageIndexType;
00064 typedef typename Superclass::InputImageIndexType InputImageIndexType;
00065 typedef typename Superclass::OutputImageSizeType OutputImageSizeType;
00066 typedef typename Superclass::InputImageSizeType InputImageSizeType;
00067 typedef InputImageSizeType SizeType;
00068
00070 itkStaticConstMacro(InputImageDimension, unsigned int,
00071 Superclass::InputImageDimension);
00072 itkStaticConstMacro(OutputImageDimension, unsigned int,
00073 Superclass::OutputImageDimension);
00075
00077 itkSetMacro(UpperBoundaryCropSize, SizeType);
00078 itkGetMacro(UpperBoundaryCropSize, SizeType);
00079 itkSetMacro(LowerBoundaryCropSize, SizeType);
00080 itkGetMacro(LowerBoundaryCropSize, SizeType);
00082
00083 void SetUpperBoundaryCropSize(const unsigned long bound)
00084 {
00085 SizeType s;
00086 s.Fill( bound );
00087 this->SetUpperBoundaryCropSize( s );
00088 }
00089
00090 void SetLowerBoundaryCropSize(const unsigned long bound)
00091 {
00092 SizeType s;
00093 s.Fill( bound );
00094 this->SetLowerBoundaryCropSize( s );
00095 }
00096
00097 void SetBoundaryCropSize(const SizeType & s)
00098 {
00099 this->SetUpperBoundaryCropSize( s );
00100 this->SetLowerBoundaryCropSize( s );
00101 }
00102
00103 void SetBoundaryCropSize(const unsigned long bound)
00104 {
00105 SizeType s;
00106 s.Fill( bound );
00107 this->SetBoundaryCropSize( s );
00108 }
00109
00110 #ifdef ITK_USE_CONCEPT_CHECKING
00111
00112 itkConceptMacro(InputConvertibleToOutputCheck,
00113 (Concept::Convertible<InputImagePixelType, OutputImagePixelType>));
00114 itkConceptMacro(SameDimensionCheck,
00115 (Concept::SameDimension<InputImageDimension, OutputImageDimension>));
00116
00118 #endif
00119
00120 protected:
00121 CropImageFilter()
00122 {
00123 m_UpperBoundaryCropSize.Fill(0);
00124 m_LowerBoundaryCropSize.Fill(0);
00125 };
00126 ~CropImageFilter() {};
00127 void PrintSelf(std::ostream& os, Indent indent) const;
00128
00129
00130 void GenerateOutputInformation();
00131
00132 private:
00133 CropImageFilter(const Self&);
00134 void operator=(const Self&);
00135
00136 SizeType m_UpperBoundaryCropSize;
00137 SizeType m_LowerBoundaryCropSize;
00138 };
00139
00140
00141 }
00142
00143 #ifndef ITK_MANUAL_INSTANTIATION
00144 #include "itkCropImageFilter.txx"
00145 #endif
00146
00147 #endif
00148