ITK  6.0.0
Insight Toolkit
itkRobustAutomaticThresholdImageFilter.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 itkRobustAutomaticThresholdImageFilter_h
19#define itkRobustAutomaticThresholdImageFilter_h
20
23
24namespace itk
25{
49template <typename TInputImage, typename TGradientImage = TInputImage, typename TOutputImage = TInputImage>
50class ITK_TEMPLATE_EXPORT RobustAutomaticThresholdImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
51{
52public:
53 ITK_DISALLOW_COPY_AND_MOVE(RobustAutomaticThresholdImageFilter);
54
60
62 itkNewMacro(Self);
63
65 itkOverrideGetNameOfClassMacro(RobustAutomaticThresholdImageFilter);
66
68 using InputImageType = TInputImage;
69 using GradientImageType = TGradientImage;
70
72 using InputPixelType = typename TInputImage::PixelType;
73 using OutputPixelType = typename TOutputImage::PixelType;
74 using GradientPixelType = typename TGradientImage::PixelType;
75
80
87
89
91 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
92 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
93
96 itkSetMacro(OutsideValue, OutputPixelType);
97
99 itkGetConstMacro(OutsideValue, OutputPixelType);
100
103 itkSetMacro(InsideValue, OutputPixelType);
104
106 itkGetConstMacro(InsideValue, OutputPixelType);
107
109 itkGetConstMacro(Threshold, InputPixelType);
110
111 itkSetMacro(Pow, double);
112 itkGetConstMacro(Pow, double);
113
114#ifdef ITK_USE_CONCEPT_CHECKING
115 // Begin concept checking
117 itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
118 // End concept checking
119#endif
120
122 void
124 {
125 // Process object is not const-correct so the const casting is required.
126 this->SetNthInput(1, const_cast<GradientImageType *>(input));
127 }
128
130 GradientImageType *
132 {
133 return static_cast<GradientImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
134 }
135
137 void
138 SetInput1(TInputImage * input)
139 {
140 this->SetInput(input);
141 }
142
144 void
146 {
147 this->SetGradientImage(input);
148 }
149
150protected:
153 void
154 PrintSelf(std::ostream & os, Indent indent) const override;
155
156 void
158
159 void
160 GenerateData() override;
161
162private:
163 double m_Pow{ 1 };
164 InputPixelType m_Threshold{};
165 OutputPixelType m_InsideValue{};
166 OutputPixelType m_OutsideValue{};
167};
168} // end namespace itk
169
170#ifndef ITK_MANUAL_INSTANTIATION
171# include "itkRobustAutomaticThresholdImageFilter.hxx"
172#endif
173
174#endif
Base class for all data objects in ITK.
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Threshold an image using robust automatic threshold selection (RATS) method.
void PrintSelf(std::ostream &os, Indent indent) const override
~RobustAutomaticThresholdImageFilter() override=default
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....