ITK  5.4.0
Insight Toolkit
itkIntermodesThresholdImageFilter.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
19#ifndef itkIntermodesThresholdImageFilter_h
20#define itkIntermodesThresholdImageFilter_h
21
24
25namespace itk
26{
27
51template <typename TInputImage, typename TOutputImage, typename TMaskImage = TOutputImage>
52class ITK_TEMPLATE_EXPORT IntermodesThresholdImageFilter
53 : public HistogramThresholdImageFilter<TInputImage, TOutputImage, TMaskImage>
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(IntermodesThresholdImageFilter);
57
63
65 itkNewMacro(Self);
66
68 itkOverrideGetNameOfClassMacro(IntermodesThresholdImageFilter);
69
70 using InputImageType = TInputImage;
71 using OutputImageType = TOutputImage;
72 using MaskImageType = TMaskImage;
73
75 using InputPixelType = typename InputImageType::PixelType;
76 using OutputPixelType = typename OutputImageType::PixelType;
77 using MaskPixelType = typename MaskImageType::PixelType;
78
82
92
93 using typename Superclass::HistogramType;
95
96
97 itkSetMacro(MaximumSmoothingIterations, SizeValueType);
98 itkGetMacro(MaximumSmoothingIterations, SizeValueType);
99
102 itkSetMacro(UseInterMode, bool);
103 itkGetConstReferenceMacro(UseInterMode, bool);
104 itkBooleanMacro(UseInterMode);
108 static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
109 static constexpr unsigned int OutputImageDimension = OutputImageType::ImageDimension;
110
111protected:
113 {
114 auto calculator = CalculatorType::New();
115 calculator->SetMaximumSmoothingIterations(m_MaximumSmoothingIterations);
116 calculator->SetUseInterMode(m_UseInterMode);
117 Superclass::SetCalculator(calculator);
118 }
120
121 void
122 VerifyPreconditions() ITKv5_CONST override
123 {
124 Superclass::VerifyPreconditions();
125 if (dynamic_cast<const CalculatorType *>(Superclass::GetCalculator()) == nullptr)
126 {
127 itkExceptionMacro("Invalid IntermodesCalculator.");
128 }
129 }
130
131 void
132 GenerateData() override
133 {
134 auto calculator = static_cast<CalculatorType *>(this->Superclass::GetModifiableCalculator());
135 calculator->SetMaximumSmoothingIterations(m_MaximumSmoothingIterations);
136 calculator->SetUseInterMode(m_UseInterMode);
137 this->Superclass::GenerateData();
138 }
139
140
141 void
142 PrintSelf(std::ostream & os, Indent indent) const override
143 {
144 Superclass::PrintSelf(os, indent);
145 os << indent << "MaximumSmoothingIterations: " << m_MaximumSmoothingIterations << std::endl;
146 os << indent << "UseInterMode: " << m_UseInterMode << std::endl;
147 }
148
149private:
150 SizeValueType m_MaximumSmoothingIterations{ 1000 };
151 bool m_UseInterMode{ true };
152};
153
154} // end namespace itk
155
156#endif
Threshold an image using a HistogramThresholdCalculator.
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
typename InputImageType::Pointer InputImagePointer
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Computes the Intermodes's threshold for an image.
virtual void SetMaximumSmoothingIterations(SizeValueType _arg)
Threshold an image using the Intermodes Threshold.
typename OutputImageType::IndexType OutputIndexType
typename MaskImageType::RegionType MaskImageRegionType
typename MaskImageType::IndexType MaskIndexType
~IntermodesThresholdImageFilter() override=default
typename InputImageType::SizeType InputSizeType
typename OutputImageType::SizeType OutputSizeType
void VerifyPreconditions() ITKv5_CONST override
Verifies that the process object has been configured correctly, that all required inputs are set,...
typename MaskImageType::PixelType MaskPixelType
typename InputImageType::IndexType InputIndexType
typename OutputImageType::PixelType OutputPixelType
void PrintSelf(std::ostream &os, Indent indent) const override
typename InputImageType::PixelType InputPixelType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
static Pointer New()
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:83