ITK  6.0.0
Insight Toolkit
itkHistogramAlgorithmBase.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 itkHistogramAlgorithmBase_h
19 #define itkHistogramAlgorithmBase_h
20 
21 #include "itkMacro.h"
22 #include "itkObjectFactory.h"
23 #include "itkObject.h"
24 
25 namespace itk
26 {
36 template <typename TInputHistogram>
37 class ITK_TEMPLATE_EXPORT HistogramAlgorithmBase : public Object
38 {
39 public:
42  using Superclass = Object;
45 
47  itkOverrideGetNameOfClassMacro(HistogramAlgorithmBase);
48 
50  using InputHistogramType = TInputHistogram;
51 
53  void
54  SetInputHistogram(const TInputHistogram * histogram)
55  {
56  if (m_InputHistogram != histogram)
57  {
58  m_InputHistogram = histogram;
59  this->Modified();
60  }
61  }
65  const TInputHistogram *
67  {
68  return m_InputHistogram.GetPointer();
69  }
70 
76 #if !defined(ITK_LEGACY_REMOVE)
77  void
78  Update()
79  {
80  this->Compute();
81  }
82 #endif
83 
84 protected:
85  HistogramAlgorithmBase();
86  ~HistogramAlgorithmBase() override = default;
87  void
88  PrintSelf(std::ostream & os, Indent indent) const override;
89 
90  virtual void
91  Compute() = 0;
92 
93 private:
95  typename TInputHistogram::ConstPointer m_InputHistogram{};
96 }; // end of class
97 } // end of namespace itk
98 
99 #ifndef ITK_MANUAL_INSTANTIATION
100 # include "itkHistogramAlgorithmBase.hxx"
101 #endif
102 
103 #endif
itkObjectFactory.h
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::HistogramAlgorithmBase< THistogram >::InputHistogramType
THistogram InputHistogramType
Definition: itkHistogramAlgorithmBase.h:50
itk::SmartPointer< Self >
itk::HistogramAlgorithmBase::SetInputHistogram
void SetInputHistogram(const TInputHistogram *histogram)
Definition: itkHistogramAlgorithmBase.h:54
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkMacro.h
itkObject.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::HistogramAlgorithmBase::GetInputHistogram
const TInputHistogram * GetInputHistogram() const
Definition: itkHistogramAlgorithmBase.h:66
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::HistogramAlgorithmBase
base class for algorithms operating on histograms
Definition: itkHistogramAlgorithmBase.h:37