ITK
5.2.0
Insight Toolkit
ITK
Modules
Filtering
ImageStatistics
include
itkMedianProjectionImageFilter.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
* 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 itkMedianProjectionImageFilter_h
19
#define itkMedianProjectionImageFilter_h
20
21
#include "
itkProjectionImageFilter.h
"
22
#include "
itkConceptChecking.h
"
23
24
#include <vector>
25
#include <algorithm>
26
27
namespace
itk
28
{
49
namespace
Functor
50
{
51
template
<
typename
TInputPixel>
52
class
MedianAccumulator
53
{
54
public
:
55
MedianAccumulator
(
SizeValueType
size) {
m_Values
.reserve(size); }
56
57
~MedianAccumulator
() =
default
;
58
59
inline
void
60
Initialize
()
61
{
62
m_Values
.clear();
63
}
64
65
inline
void
66
operator()
(
const
TInputPixel & input)
67
{
68
m_Values
.push_back(input);
69
}
70
71
inline
TInputPixel
72
GetValue
()
73
{
74
auto
medianIterator =
m_Values
.begin() +
m_Values
.size() / 2;
75
std::nth_element(
m_Values
.begin(), medianIterator,
m_Values
.end());
76
return
*medianIterator;
77
}
78
79
std::vector<TInputPixel>
m_Values
;
80
};
81
}
// namespace Functor
82
83
template
<
typename
TInputImage,
typename
TOutputImage>
84
class
MedianProjectionImageFilter
85
:
public
ProjectionImageFilter
<TInputImage, TOutputImage, Functor::MedianAccumulator<typename TInputImage::PixelType>>
86
{
87
public
:
88
ITK_DISALLOW_COPY_AND_MOVE(
MedianProjectionImageFilter
);
89
90
using
Self
=
MedianProjectionImageFilter
;
91
using
Superclass
=
92
ProjectionImageFilter<TInputImage, TOutputImage, Functor::MedianAccumulator<typename TInputImage::PixelType>
>;
93
94
using
Pointer
=
SmartPointer<Self>
;
95
using
ConstPointer
=
SmartPointer<const Self>
;
96
98
itkTypeMacro(
MedianProjectionImageFilter
,
ProjectionImageFilter
);
99
101
itkNewMacro(
Self
);
102
103
#ifdef ITK_USE_CONCEPT_CHECKING
104
// Begin concept checking
105
// End concept checking
106
#endif
107
108
protected
:
109
MedianProjectionImageFilter
() =
default
;
110
~MedianProjectionImageFilter
()
override
=
default
;
111
};
// end MedianProjectionImageFilter
112
}
// end namespace itk
113
114
#endif
itkProjectionImageFilter.h
itkConceptChecking.h
itk::SmartPointer< Self >
itk::MedianProjectionImageFilter::MedianProjectionImageFilter
MedianProjectionImageFilter()=default
itk::Functor::MedianAccumulator::Initialize
void Initialize()
Definition:
itkMedianProjectionImageFilter.h:60
itk::ProjectionImageFilter
Implements an accumulation of an image along a selected direction.
Definition:
itkProjectionImageFilter.h:57
itk::ImageSource
Base class for all process objects that output image data.
Definition:
itkImageSource.h:67
itk::Functor::MedianAccumulator::MedianAccumulator
MedianAccumulator(SizeValueType size)
Definition:
itkMedianProjectionImageFilter.h:55
itk::Functor::MedianAccumulator::m_Values
std::vector< TInputPixel > m_Values
Definition:
itkMedianProjectionImageFilter.h:79
itk::Functor::MedianAccumulator
Definition:
itkMedianProjectionImageFilter.h:52
itk::MedianProjectionImageFilter
Median projection.
Definition:
itkMedianProjectionImageFilter.h:84
itk::Functor::MedianAccumulator::operator()
void operator()(const TInputPixel &input)
Definition:
itkMedianProjectionImageFilter.h:66
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition:
itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition:
itkProcessObject.h:138
itk::MedianProjectionImageFilter::~MedianProjectionImageFilter
~MedianProjectionImageFilter() override=default
itk::Functor::MedianAccumulator::GetValue
TInputPixel GetValue()
Definition:
itkMedianProjectionImageFilter.h:72
itk::Functor::MedianAccumulator::~MedianAccumulator
~MedianAccumulator()=default
itk::SizeValueType
unsigned long SizeValueType
Definition:
itkIntTypes.h:83
Generated on Thu Apr 1 2021 01:55:35 for ITK by
1.8.16