ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkShrinkDecimateImageFilter.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 itkShrinkDecimateImageFilter_h
19#define itkShrinkDecimateImageFilter_h
20
22
23#include <type_traits> // For std::enable_if
24
25namespace itk
26{
42template <typename TInputImage, typename TOutputImage>
43class ShrinkDecimateImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
44{
45public:
46 ITK_DISALLOW_COPY_AND_MOVE(ShrinkDecimateImageFilter);
47
53
55 itkNewMacro(Self);
56
58 itkOverrideGetNameOfClassMacro(ShrinkDecimateImageFilter);
59
61 using OutputImageType = TOutputImage;
62 using InputImageType = TInputImage;
63 using OutputImagePointer = typename OutputImageType::Pointer;
64 using InputImagePointer = typename InputImageType::Pointer;
65 using InputImageConstPointer = typename InputImageType::ConstPointer;
66
67 using OutputOffsetType = typename TOutputImage::OffsetType;
68 using OutputIndexType = typename TOutputImage::IndexType;
69 using InputIndexType = typename TInputImage::IndexType;
70
72 using OutputImageRegionType = typename TOutputImage::RegionType;
73
75 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
76 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
77
79
83 void
84 SetShrinkFactors(unsigned int factor);
85
86 void
87 SetShrinkFactor(unsigned int i, unsigned int factor);
88
90 itkGetConstReferenceMacro(ShrinkFactors, ShrinkFactorsType);
91
92 void
94
100 void
102
103 itkConceptMacro(InputConvertibleToOutputCheck,
105 static_assert(ImageDimension == OutputImageDimension);
106
107protected:
109 void
110 PrintSelf(std::ostream & os, Indent indent) const override;
111
112 void
113 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
114
115private:
117
119 template <class TOutputType, class TInputType>
120 typename std::enable_if<std::numeric_limits<TOutputType>::is_integer, TOutputType>::type
121 RoundIfInteger(TInputType input)
122 {
123 return Math::Round<TOutputType>(input);
124 }
125
126 // For Non-fundamental types numeric_limits is not specialized, and
127 // is_integer defaults to false.
128 template <class TOutputType, class TInputType>
129 typename std::enable_if<!std::numeric_limits<TOutputType>::is_integer, TOutputType>::type
130 RoundIfInteger(const TInputType & input, ...)
131 {
132 return static_cast<TOutputType>(input);
133 }
134};
135} // end namespace itk
136
137#ifndef ITK_MANUAL_INSTANTIATION
138# include "itkShrinkDecimateImageFilter.hxx"
139#endif
140
141#endif
Simulate a standard C array with copy semantics.
Control indentation during Print() invocation.
Definition itkIndent.h:53
void GenerateInputRequestedRegion() override
std::enable_if< std::numeric_limits< TOutputType >::is_integer, TOutputType >::type RoundIfInteger(TInputType input)
void SetShrinkFactors(unsigned int factor)
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void SetShrinkFactor(unsigned int i, unsigned int factor)
std::enable_if<!std::numeric_limits< TOutputType >::is_integer, TOutputType >::type RoundIfInteger(const TInputType &input,...)
void GenerateOutputInformation() override
ImageToImageFilter< typename InverseFFTFilterType::OutputImageType, typename InverseFFTFilterType::OutputImageType > Superclass
void PrintSelf(std::ostream &os, Indent indent) const override
Implements transparent reference counting.
#define itkConceptMacro(name, conceptType)
Compile-time check that a template argument satisfies an itk::Concept.
TInput TInput constexpr auto Round(TInput x)
Definition itkMath.h:202
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
#define itkSetMacro(name, type)