ITK  5.4.0
Insight Toolkit
itkRobustAutomaticThresholdCalculator.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 itkRobustAutomaticThresholdCalculator_h
19#define itkRobustAutomaticThresholdCalculator_h
20
21#include "itkMacro.h"
22#include "itkImage.h"
23
24namespace itk
25{
39template <typename TInputImage, typename TGradientImage>
40class ITK_TEMPLATE_EXPORT RobustAutomaticThresholdCalculator : public Object
41{
42public:
43 ITK_DISALLOW_COPY_AND_MOVE(RobustAutomaticThresholdCalculator);
44
50
52 itkNewMacro(Self);
53
55 itkOverrideGetNameOfClassMacro(RobustAutomaticThresholdCalculator);
56
58 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
59
61 using InputImageType = TInputImage;
62 using GradientImageType = TGradientImage;
63
69 using InputPixelType = typename InputImageType::PixelType;
70 using GradientPixelType = typename GradientImageType::PixelType;
71
73 virtual void
74 SetInput(const InputImageType * image)
75 {
76 if (m_Input != image)
77 {
78 m_Input = image;
79 this->Modified();
80 m_Valid = false;
81 }
82 }
85 virtual void
87 {
88 if (m_Gradient != image)
89 {
90 m_Gradient = image;
91 this->Modified();
92 m_Valid = false;
93 }
94 }
95
96 itkSetMacro(Pow, double);
97 itkGetConstMacro(Pow, double);
98
104 void
106
107 const InputPixelType &
108 GetOutput() const;
109
110protected:
113 void
114 PrintSelf(std::ostream & os, Indent indent) const override;
115
116private:
117 bool m_Valid{ false }; // Have moments been computed yet?
118 double m_Pow{ 1 };
119 InputPixelType m_Output{};
120
123};
124} // end namespace itk
125
126#ifndef ITK_MANUAL_INSTANTIATION
127# include "itkRobustAutomaticThresholdCalculator.hxx"
128#endif
129
130#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
const InputPixelType & GetOutput() const
virtual void SetGradient(const GradientImageType *image)
virtual void SetInput(const InputImageType *image)
~RobustAutomaticThresholdCalculator() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
typename GradientImageType::PixelType GradientPixelType
typename InputImageType::ConstPointer InputImageConstPointer
typename GradientImageType::ConstPointer GradientImageConstPointer
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....