ITK  4.9.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>
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;
81  typedef typename TOutputImage::IndexType OutputIndexType;
82  typedef typename TInputImage::IndexType InputIndexType;
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  BinShrinkImageFilter(const Self&) ITK_DELETE_FUNCTION;
135  void operator=(const Self&) ITK_DELETE_FUNCTION;
136 
138 
140  template< class TOutputType, class TInputType >
141  typename EnableIfC<std::numeric_limits<TOutputType>::is_integer, TOutputType>::Type
142  RoundIfInteger( TInputType input )
143  {
144  return Math::Round< TOutputType >( input );
145  }
146 
147  // For Non-fundamental types numeric_limits is not specialized, and
148  // is_integer defaults to false.
149  template< class TOutputType, class TInputType >
151  RoundIfInteger( const TInputType & input, ...)
152  {
153  return static_cast<TOutputType>(input);
154  }
155 };
156 
157 } // end namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 #include "itkBinShrinkImageFilter.hxx"
161 #endif
162 
163 #endif
OutputImageType::Pointer OutputImagePointer
TOutputImage::OffsetType OutputOffsetType
void PrintSelf(std::ostream &os, Indent indent) const override
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)
static const unsigned int ImageDimension
virtual void GenerateOutputInformation() override
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
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
static const unsigned int OutputImageDimension
virtual void SetShrinkFactors(ShrinkFactorsType _arg)
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
Reduce the size of an image by an integer factor in each dimension.
void SetShrinkFactor(unsigned int i, unsigned int factor)
#define itkConceptMacro(name, concept)
An implementation of the negation of the enable if idiom.
Definition: itkEnableIf.h:71
InputImageType::ConstPointer InputImageConstPointer
virtual void GenerateInputRequestedRegion() override