ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkCropImageFilter.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 __itkCropImageFilter_h
19 #define __itkCropImageFilter_h
20 
21 #include "itkExtractImageFilter.h"
22 
23 namespace itk
24 {
42 template< class TInputImage, class TOutputImage >
43 class ITK_EXPORT CropImageFilter:
44  public ExtractImageFilter< TInputImage, TOutputImage >
45 {
46 public:
52 
54  itkNewMacro(Self);
55 
58 
62 
66 
68  typedef typename Superclass::OutputImageIndexType OutputImageIndexType;
69  typedef typename Superclass::InputImageIndexType InputImageIndexType;
70  typedef typename Superclass::OutputImageSizeType OutputImageSizeType;
73 
75  itkStaticConstMacro(InputImageDimension, unsigned int,
76  Superclass::InputImageDimension);
77  itkStaticConstMacro(OutputImageDimension, unsigned int,
78  Superclass::OutputImageDimension);
80 
82  itkSetMacro(UpperBoundaryCropSize, SizeType);
83  itkGetConstMacro(UpperBoundaryCropSize, SizeType);
84  itkSetMacro(LowerBoundaryCropSize, SizeType);
85  itkGetConstMacro(LowerBoundaryCropSize, SizeType);
87 
88  void SetBoundaryCropSize(const SizeType & s)
89  {
90  this->SetUpperBoundaryCropSize(s);
91  this->SetLowerBoundaryCropSize(s);
92  }
93 
94 #ifdef ITK_USE_CONCEPT_CHECKING
95 
96  itkConceptMacro( InputConvertibleToOutputCheck,
98  itkConceptMacro( SameDimensionCheck,
100 
102 #endif
103 
104 protected:
106  {
107  this->SetDirectionCollapseToSubmatrix();
108  m_UpperBoundaryCropSize.Fill(0);
109  m_LowerBoundaryCropSize.Fill(0);
110  }
111 
113  void PrintSelf(std::ostream & os, Indent indent) const;
114 
115  void GenerateOutputInformation();
116 
117 private:
118  CropImageFilter(const Self &); //purposely not implemented
119  void operator=(const Self &); //purposely not implemented
120 
123 };
124 } // end namespace itk
125 
126 #ifndef ITK_MANUAL_INSTANTIATION
127 #include "itkCropImageFilter.hxx"
128 #endif
129 
130 #endif
131