ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkBinShrinkImageFilter.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 itkBinShrinkImageFilter_h
19 #define itkBinShrinkImageFilter_h
20 
21 #include "itkShrinkImageFilter.h"
22 #include "itkEnableIf.h"
23 
24 namespace itk
25 {
26 
56 template <typename TInputImage, typename TOutputImage>
57 class ITK_TEMPLATE_EXPORT BinShrinkImageFilter :
58  public ImageToImageFilter<TInputImage,TOutputImage>
59 {
60 public:
66 
68  itkNewMacro(Self);
69 
72 
74  typedef TOutputImage OutputImageType;
75  typedef TInputImage InputImageType;
76  typedef typename OutputImageType::Pointer OutputImagePointer;
77  typedef typename InputImageType::Pointer InputImagePointer;
78  typedef typename InputImageType::ConstPointer InputImageConstPointer;
79 
80  typedef typename TOutputImage::OffsetType OutputOffsetType;
83 
85  typedef typename TOutputImage::RegionType OutputImageRegionType;
86 
88  itkStaticConstMacro(ImageDimension, unsigned int,
89  TInputImage::ImageDimension );
90  itkStaticConstMacro(OutputImageDimension, unsigned int,
91  TOutputImage::ImageDimension );
93 
95 
98  itkSetMacro(ShrinkFactors, ShrinkFactorsType);
99  void SetShrinkFactors(unsigned int factor);
100  void SetShrinkFactor(unsigned int i, unsigned int factor);
102 
104  itkGetConstReferenceMacro(ShrinkFactors, ShrinkFactorsType);
105 
106  virtual void GenerateOutputInformation() ITK_OVERRIDE;
107 
113  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
114 
115 
116 #ifdef ITK_USE_CONCEPT_CHECKING
117 
118  itkConceptMacro(InputConvertibleToOutputCheck,
120  itkConceptMacro(SameDimensionCheck,
122 
124 #endif
125 
126 protected:
128  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
129 
130  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
131  ThreadIdType threadId ) ITK_OVERRIDE;
132 
133 private:
134  ITK_DISALLOW_COPY_AND_ASSIGN(BinShrinkImageFilter);
135 
137 
139  template< class TOutputType, class TInputType >
140  typename EnableIfC<std::numeric_limits<TOutputType>::is_integer, TOutputType>::Type
141  RoundIfInteger( TInputType input )
142  {
143  return Math::Round< TOutputType >( input );
144  }
145 
146  // For Non-fundamental types numeric_limits is not specialized, and
147  // is_integer defaults to false.
148  template< class TOutputType, class TInputType >
150  RoundIfInteger( const TInputType & input, ...)
151  {
152  return static_cast<TOutputType>(input);
153  }
154 };
155 
156 } // end namespace itk
157 
158 #ifndef ITK_MANUAL_INSTANTIATION
159 #include "itkBinShrinkImageFilter.hxx"
160 #endif
161 
162 #endif
OutputImageType::Pointer OutputImagePointer
TOutputImage::OffsetType OutputOffsetType
Base class for all process objects that output image data.
TOutputImage::RegionType OutputImageRegionType
EnableIfC< std::numeric_limits< TOutputType >::is_integer, TOutputType >::Type RoundIfInteger(TInputType input)
ImageToImageFilter< TInputImage, TOutputImage > Superclass
DisableIfC< std::numeric_limits< TOutputType >::is_integer, TOutputType >::Type RoundIfInteger(const TInputType &input,...)
FixedArray< unsigned int, ImageDimension > ShrinkFactorsType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Reduce the size of an image by an integer factor in each dimension while performing averaging of an i...
TOutputImage::IndexType OutputIndexType
InputImageType::Pointer InputImagePointer
TInputImage::IndexType InputIndexType
Base class for filters that take an image as input and produce an image as output.
SmartPointer< const Self > ConstPointer
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
An implementation of the negation of the enable if idiom.
Definition: itkEnableIf.h:71
InputImageType::ConstPointer InputImageConstPointer