ITK  5.1.0
Insight Toolkit
itkHistogramThresholdImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 itkHistogramThresholdImageFilter_h
20 #define itkHistogramThresholdImageFilter_h
21 
22 #include "itkImageToImageFilter.h"
23 #include "itkHistogram.h"
25 
26 namespace itk
27 {
28 
60 template <typename TInputImage, typename TOutputImage, typename TMaskImage = TOutputImage>
61 class ITK_TEMPLATE_EXPORT HistogramThresholdImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
62 {
63 public:
64  ITK_DISALLOW_COPY_AND_ASSIGN(HistogramThresholdImageFilter);
65 
71 
73  itkNewMacro(Self);
74 
77 
78  using InputImageType = TInputImage;
79  using OutputImageType = TOutputImage;
80  using MaskImageType = TMaskImage;
81 
83  using InputPixelType = typename InputImageType::PixelType;
84  using OutputPixelType = typename OutputImageType::PixelType;
85  using MaskPixelType = typename MaskImageType::PixelType;
86 
88  using InputImagePointer = typename InputImageType::Pointer;
89  using OutputImagePointer = typename OutputImageType::Pointer;
90  using MaskImagePointer = typename MaskImageType::Pointer;
91 
101 
112 
114  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
115  static constexpr unsigned int OutputImageDimension = OutputImageType::ImageDimension;
116  static constexpr unsigned int MaskImageDimension = MaskImageType::ImageDimension;
117 
119  itkSetInputMacro(MaskImage, TMaskImage);
120  itkGetInputMacro(MaskImage, TMaskImage);
122 
124  void
125  SetInput1(const TInputImage * input)
126  {
127  this->SetInput(input);
128  }
129 
131  void
132  SetInput2(const TMaskImage * input)
133  {
134  this->SetMaskImage(input);
135  }
136 
139  itkSetMacro(OutsideValue, OutputPixelType);
140 
142  itkGetConstMacro(OutsideValue, OutputPixelType);
143 
146  itkSetMacro(InsideValue, OutputPixelType);
147 
149  itkGetConstMacro(InsideValue, OutputPixelType);
150 
152  itkSetMacro(NumberOfHistogramBins, unsigned int);
153  itkGetConstMacro(NumberOfHistogramBins, unsigned int);
155 
158  itkSetMacro(AutoMinimumMaximum, bool);
159  itkGetConstMacro(AutoMinimumMaximum, bool);
160  itkBooleanMacro(AutoMinimumMaximum);
162 
166  itkSetMacro(MaskOutput, bool);
167  itkGetConstMacro(MaskOutput, bool);
168  itkBooleanMacro(MaskOutput);
170 
174  itkSetMacro(MaskValue, MaskPixelType);
175  itkGetConstMacro(MaskValue, MaskPixelType);
177 
179  itkGetConstMacro(Threshold, InputPixelType);
180 
182  itkSetObjectMacro(Calculator, CalculatorType);
183  itkGetModifiableObjectMacro(Calculator, CalculatorType);
185 
186 #ifdef ITK_USE_CONCEPT_CHECKING
187  // Begin concept checking
188  itkConceptMacro(OutputEqualityComparableCheck, (Concept::EqualityComparable<OutputPixelType>));
189  itkConceptMacro(InputOStreamWritableCheck, (Concept::OStreamWritable<InputPixelType>));
190  itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
191  // End concept checking
192 #endif
193 
194 protected:
196  ~HistogramThresholdImageFilter() override = default;
197  void
198  PrintSelf(std::ostream & os, Indent indent) const override;
199 
200  void
201  GenerateInputRequestedRegion() override;
202  void
203  GenerateData() override;
204 
205 private:
211  unsigned m_NumberOfHistogramBins{ 256 };
213  bool m_MaskOutput{ true };
214 };
215 
216 } // end namespace itk
217 
218 #ifndef ITK_MANUAL_INSTANTIATION
219 # include "itkHistogramThresholdImageFilter.hxx"
220 #endif
221 
222 #endif
itk::HistogramThresholdImageFilter::InputIndexType
typename InputImageType::IndexType InputIndexType
Definition: itkHistogramThresholdImageFilter.h:93
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:634
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::HistogramThresholdImageFilter::SetInput1
void SetInput1(const TInputImage *input)
Definition: itkHistogramThresholdImageFilter.h:125
itk::HistogramThresholdImageFilter::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkHistogramThresholdImageFilter.h:83
itk::HistogramThresholdImageFilter::HistogramSizeType
typename HistogramType::SizeType HistogramSizeType
Definition: itkHistogramThresholdImageFilter.h:107
itk::HistogramThresholdImageFilter::HistogramPointer
typename HistogramType::Pointer HistogramPointer
Definition: itkHistogramThresholdImageFilter.h:105
itk::HistogramThresholdImageFilter::MaskImageRegionType
typename MaskImageType::RegionType MaskImageRegionType
Definition: itkHistogramThresholdImageFilter.h:100
itk::HistogramThresholdImageFilter::MaskSizeType
typename MaskImageType::SizeType MaskSizeType
Definition: itkHistogramThresholdImageFilter.h:98
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::HistogramThresholdImageFilter::OutputSizeType
typename OutputImageType::SizeType OutputSizeType
Definition: itkHistogramThresholdImageFilter.h:95
itk::HistogramThresholdImageFilter
Threshold an image using a HistogramThresholdCalculator.
Definition: itkHistogramThresholdImageFilter.h:61
itk::HistogramThresholdImageFilter::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkHistogramThresholdImageFilter.h:84
itkHistogramThresholdCalculator.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::HistogramThresholdImageFilter::HistogramConstPointer
typename HistogramType::ConstPointer HistogramConstPointer
Definition: itkHistogramThresholdImageFilter.h:106
itk::HistogramThresholdImageFilter::m_Calculator
CalculatorPointer m_Calculator
Definition: itkHistogramThresholdImageFilter.h:210
itk::HistogramThresholdImageFilter::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Definition: itkHistogramThresholdImageFilter.h:96
itk::HistogramThresholdImageFilter::m_MaskValue
MaskPixelType m_MaskValue
Definition: itkHistogramThresholdImageFilter.h:209
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Statistics::Histogram::MeasurementVectorType
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:100
itk::Statistics::Histogram
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:76
itk::HistogramThresholdImageFilter::m_InsideValue
OutputPixelType m_InsideValue
Definition: itkHistogramThresholdImageFilter.h:206
itkHistogram.h
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::HistogramThresholdImageFilter::MaskPixelType
typename MaskImageType::PixelType MaskPixelType
Definition: itkHistogramThresholdImageFilter.h:85
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::HistogramThresholdImageFilter::InputSizeType
typename InputImageType::SizeType InputSizeType
Definition: itkHistogramThresholdImageFilter.h:92
itk::HistogramThresholdImageFilter::HistogramMeasurementType
typename HistogramType::MeasurementType HistogramMeasurementType
Definition: itkHistogramThresholdImageFilter.h:108
itk::HistogramThresholdImageFilter::MaskImageType
TMaskImage MaskImageType
Definition: itkHistogramThresholdImageFilter.h:80
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::HistogramThresholdCalculator
Base class to compute a threshold value based on the histogram of an image.
Definition: itkHistogramThresholdCalculator.h:46
itk::HistogramThresholdImageFilter::HistogramMeasurementVectorType
typename HistogramType::MeasurementVectorType HistogramMeasurementVectorType
Definition: itkHistogramThresholdImageFilter.h:109
itk::HistogramThresholdImageFilter::ValueRealType
typename NumericTraits< ValueType >::RealType ValueRealType
Definition: itkHistogramThresholdImageFilter.h:103
itk::HistogramThresholdImageFilter::SetInput2
void SetInput2(const TMaskImage *input)
Definition: itkHistogramThresholdImageFilter.h:132
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::HistogramThresholdImageFilter::CalculatorPointer
typename CalculatorType::Pointer CalculatorPointer
Definition: itkHistogramThresholdImageFilter.h:111
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:64
itk::HistogramThresholdImageFilter::MaskIndexType
typename MaskImageType::IndexType MaskIndexType
Definition: itkHistogramThresholdImageFilter.h:99
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:135
itk::HistogramThresholdImageFilter::m_Threshold
InputPixelType m_Threshold
Definition: itkHistogramThresholdImageFilter.h:208
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::HistogramThresholdImageFilter::ValueType
typename NumericTraits< InputPixelType >::ValueType ValueType
Definition: itkHistogramThresholdImageFilter.h:102
itk::HistogramThresholdImageFilter::m_OutsideValue
OutputPixelType m_OutsideValue
Definition: itkHistogramThresholdImageFilter.h:207
itk::Statistics::Histogram::MeasurementType
TMeasurement MeasurementType
Definition: itkHistogram.h:97
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::HistogramThresholdImageFilter::MaskImagePointer
typename MaskImageType::Pointer MaskImagePointer
Definition: itkHistogramThresholdImageFilter.h:90
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:304
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::HistogramThresholdImageFilter::m_AutoMinimumMaximum
bool m_AutoMinimumMaximum
Definition: itkHistogramThresholdImageFilter.h:212