ITK  6.0.0
Insight Toolkit
itkHistogramToProbabilityImageFilter.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 itkHistogramToProbabilityImageFilter_h
19#define itkHistogramToProbabilityImageFilter_h
20
22
23namespace itk
24{
48namespace Function
49{
50template <typename TInput, typename TOutput = float>
52{
53public:
54 // Probability function = Number of occurrences in each bin /
55 // Total Number of occurrences.
56 //
57 // Returns pixels of float..
58 using OutputPixelType = TOutput;
59
61
63
64 inline OutputPixelType
65 operator()(const TInput & A) const
66 {
67 return static_cast<OutputPixelType>(static_cast<OutputPixelType>(A) /
68 static_cast<OutputPixelType>(m_TotalFrequency));
69 }
70
71 void
73 {
75 }
76
79 {
80 return m_TotalFrequency;
81 }
82
83private:
85};
86} // namespace Function
87
88template <typename THistogram, typename TImage = Image<float, 3>>
90 : public HistogramToImageFilter<THistogram,
91 TImage,
92 Function::HistogramProbabilityFunction<SizeValueType, typename TImage::PixelType>>
93{
94public:
95 ITK_DISALLOW_COPY_AND_MOVE(HistogramToProbabilityImageFilter);
96
99
102 HistogramToImageFilter<THistogram,
103 TImage,
105
108
110 itkOverrideGetNameOfClassMacro(HistogramToProbabilityImageFilter);
111
113 itkNewMacro(Self);
114
115protected:
118};
119} // end namespace itk
120
121#endif
This class takes a histogram as an input and returns an image of type specified by the functor.
The class takes a histogram as an input and gives the probability image as the output....
~HistogramToProbabilityImageFilter() override=default
Light weight base class for most itk classes.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86