ITK  4.8.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 #include "itkIsSame.h"
24 
25 namespace itk
26 {
27 
57 template <typename TInputImage, typename TOutputImage>
59  public ImageToImageFilter<TInputImage,TOutputImage>
60 {
61 public:
67 
69  itkNewMacro(Self);
70 
73 
75  typedef TOutputImage OutputImageType;
76  typedef TInputImage InputImageType;
77  typedef typename OutputImageType::Pointer OutputImagePointer;
78  typedef typename InputImageType::Pointer InputImagePointer;
79  typedef typename InputImageType::ConstPointer InputImageConstPointer;
80 
81  typedef typename TOutputImage::OffsetType OutputOffsetType;
82  typedef typename TOutputImage::IndexType OutputIndexType;
83  typedef typename TInputImage::IndexType InputIndexType;
84 
86  typedef typename TOutputImage::RegionType OutputImageRegionType;
87 
89  itkStaticConstMacro(ImageDimension, unsigned int,
90  TInputImage::ImageDimension );
91  itkStaticConstMacro(OutputImageDimension, unsigned int,
92  TOutputImage::ImageDimension );
94 
96 
99  itkSetMacro(ShrinkFactors, ShrinkFactorsType);
100  void SetShrinkFactors(unsigned int factor);
101  void SetShrinkFactor(unsigned int i, unsigned int factor);
103 
105  itkGetConstReferenceMacro(ShrinkFactors, ShrinkFactorsType);
106 
107  virtual void GenerateOutputInformation() ITK_OVERRIDE;
108 
114  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
115 
116 
117 #ifdef ITK_USE_CONCEPT_CHECKING
118 
119  itkConceptMacro(InputConvertibleToOutputCheck,
121  itkConceptMacro(SameDimensionCheck,
123 
125 #endif
126 
127 protected:
129  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
130 
131  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
132  ThreadIdType threadId ) ITK_OVERRIDE;
133 
134 private:
135  BinShrinkImageFilter(const Self&); //purposely not implemented
136  void operator=(const Self&); //purposely not implemented
137 
139 
141  template< class TOutputType, class TInputType >
142  typename EnableIfC<std::numeric_limits<TOutputType>::is_integer, TOutputType>::Type
143  RoundIfInteger( TInputType input )
144  {
145  return Math::Round< TOutputType >( input );
146  }
147 
148  // For Non-fundamental types numeric_limits is not specialized, and
149  // is_integer defaults to false.
150  template< class TOutputType, class TInputType >
152  RoundIfInteger( const TInputType & input, ...)
153  {
154  return static_cast<TOutputType>(input);
155  }
156 };
157 
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 #include "itkBinShrinkImageFilter.hxx"
162 #endif
163 
164 #endif
OutputImageType::Pointer OutputImagePointer
void operator=(const Self &)
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)
InputImageType::ConstPointer InputImageConstPointer
virtual void GenerateInputRequestedRegion() override