ITK
4.4.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ITK
Modules
Numerics
Statistics
include
itkHistogramToProbabilityImageFilter.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
#ifndef __itkHistogramToProbabilityImageFilter_h
19
#define __itkHistogramToProbabilityImageFilter_h
20
21
#include "
itkHistogramToImageFilter.h
"
22
23
namespace
itk
24
{
47
namespace
Function
48
{
49
template
<
class
TInput,
class
TOutput =
float
>
50
class
HistogramProbabilityFunction
51
{
52
public
:
53
54
//Probability function = Number of occurrences in each bin /
55
// Total Number of occurrences.
56
//
57
// Returns pixels of float..
58
typedef
TOutput
OutputPixelType
;
59
60
HistogramProbabilityFunction
():
61
m_TotalFrequency
(1) {}
62
63
~HistogramProbabilityFunction
() {}
64
65
inline
OutputPixelType
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
SetTotalFrequency
(
SizeValueType
n)
72
{
73
m_TotalFrequency
= n;
74
}
75
76
SizeValueType
GetTotalFrequency
()
const
77
{
78
return
m_TotalFrequency
;
79
}
80
81
private
:
82
SizeValueType
m_TotalFrequency
;
83
};
84
}
85
86
template
<
class
THistogram,
class
TImage=Image<
float
, 3> >
87
class
ITK_EXPORT
HistogramToProbabilityImageFilter
:
88
public
HistogramToImageFilter
< THistogram, TImage,
89
Function::HistogramProbabilityFunction< SizeValueType, typename TImage::PixelType > >
90
{
91
public
:
92
94
typedef
HistogramToProbabilityImageFilter
Self
;
95
97
typedef
HistogramToImageFilter
< THistogram, TImage,
98
Function::HistogramProbabilityFunction< SizeValueType, typename TImage::PixelType >
>
99
Superclass
;
100
101
typedef
SmartPointer< Self >
Pointer
;
102
typedef
SmartPointer< const Self >
ConstPointer
;
103
105
itkTypeMacro(
HistogramToProbabilityImageFilter
,
HistogramToImageFilter
);
106
108
itkNewMacro(
Self
);
109
110
protected
:
111
HistogramToProbabilityImageFilter
() {}
112
virtual
~HistogramToProbabilityImageFilter
() {}
113
114
private
:
115
HistogramToProbabilityImageFilter
(
const
Self &);
//purposely not implemented
116
void
operator=(
const
Self &);
//purposely not implemented
117
};
118
}
// end namespace itk
119
120
#endif
121
Generated on Mon May 13 2013 00:52:58 for ITK by
1.8.3.1