ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkBinShrinkImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
22#include <type_traits>
23
24namespace itk
25{
26
57template <typename TInputImage, typename TOutputImage>
58class ITK_TEMPLATE_EXPORT BinShrinkImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
59{
60public:
61 ITK_DISALLOW_COPY_AND_MOVE(BinShrinkImageFilter);
63
69
71 itkNewMacro(Self);
72
74 itkOverrideGetNameOfClassMacro(BinShrinkImageFilter);
75
77 using OutputImageType = TOutputImage;
78 using InputImageType = TInputImage;
79 using OutputImagePointer = typename OutputImageType::Pointer;
80 using InputImagePointer = typename InputImageType::Pointer;
81 using InputImageConstPointer = typename InputImageType::ConstPointer;
82
83 using OutputOffsetType = typename TOutputImage::OffsetType;
84 using OutputIndexType = typename TOutputImage::IndexType;
85 using InputIndexType = typename TInputImage::IndexType;
86
88 using OutputImageRegionType = typename TOutputImage::RegionType;
89
91 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
92 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
93
95
98 itkSetMacro(ShrinkFactors, ShrinkFactorsType);
99 void
100 SetShrinkFactors(unsigned int factor);
101 void
102 SetShrinkFactor(unsigned int i, unsigned int factor);
104
106 itkGetConstReferenceMacro(ShrinkFactors, ShrinkFactorsType);
107
108 void
110
116 void
118
119
120 itkConceptMacro(InputConvertibleToOutputCheck,
123
124protected:
126 void
127 PrintSelf(std::ostream & os, Indent indent) const override;
128
129 void
130 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
131
132private:
134
136 template <class TOutputType, class TInputType>
137 std::enable_if_t<std::numeric_limits<TOutputType>::is_integer, TOutputType>
138 RoundIfInteger(TInputType input)
139 {
140 return Math::Round<TOutputType>(input);
141 }
142
143 // For Non-fundamental types numeric_limits is not specialized, and
144 // is_integer defaults to false.
145 template <class TOutputType, class TInputType>
146 std::enable_if_t<!std::numeric_limits<TOutputType>::is_integer, TOutputType>
147 RoundIfInteger(const TInputType & input, ...)
148 {
149 return static_cast<TOutputType>(input);
150 }
151};
152
153} // end namespace itk
154
155#ifndef ITK_MANUAL_INSTANTIATION
156# include "itkBinShrinkImageFilter.hxx"
157#endif
158
159#endif
void GenerateOutputInformation() override
typename InputImageType::Pointer InputImagePointer
void SetShrinkFactors(unsigned int factor)
typename TInputImage::IndexType InputIndexType
static constexpr unsigned int OutputImageDimension
typename TOutputImage::OffsetType OutputOffsetType
typename TOutputImage::RegionType OutputImageRegionType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
typename InputImageType::ConstPointer InputImageConstPointer
void PrintSelf(std::ostream &os, Indent indent) const override
std::enable_if_t< std::numeric_limits< TOutputType >::is_integer, TOutputType > RoundIfInteger(TInputType input)
void GenerateInputRequestedRegion() override
typename OutputImageType::Pointer OutputImagePointer
static constexpr unsigned int ImageDimension
typename TOutputImage::IndexType OutputIndexType
void SetShrinkFactor(unsigned int i, unsigned int factor)
ImageToImageFilter< TInputImage, TOutputImage > Superclass
std::enable_if_t<!std::numeric_limits< TOutputType >::is_integer, TOutputType > RoundIfInteger(const TInputType &input,...)
FixedArray< unsigned int, ImageDimension > ShrinkFactorsType
SmartPointer< const Self > ConstPointer
Simulate a standard C array with copy semantics.
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
TInput TInput TReturn Round(TInput x)
Definition itkMath.h:179
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....