Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Utilities
ITK
Code
Common
itkWindowedSincInterpolateImageFunction.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Insight Segmentation & Registration Toolkit
4
Module: $RCSfile: itkWindowedSincInterpolateImageFunction.h,v $
5
Language: C++
6
Date: $Date: 2009-10-29 11:18:58 $
7
Version: $Revision: 1.10 $
8
9
Copyright (c) Insight Software Consortium. All rights reserved.
10
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
PURPOSE. See the above copyright notices for more information.
15
16
=========================================================================*/
17
#ifndef __itkWindowedSincInterpolateImageFunction_h
18
#define __itkWindowedSincInterpolateImageFunction_h
19
20
#include "
itkConstNeighborhoodIterator.h
"
21
#include "
itkConstantBoundaryCondition.h
"
22
#include "
itkInterpolateImageFunction.h
"
23
24
namespace
itk
25
{
26
27
namespace
Function {
28
35
template
<
unsigned
int
VRadius,
36
class
TInput=double,
class
TOutput=
double
>
37
class
CosineWindowFunction
38
{
39
public
:
40
inline
TOutput
operator()
(
const
TInput & A )
const
41
{
return
(TOutput) vcl_cos(A *
m_Factor
); }
42
private
:
44
static
const
double
m_Factor
;
45
};
46
53
template
<
unsigned
int
VRadius,
54
class
TInput=double,
class
TOutput=
double
>
55
class
HammingWindowFunction
56
{
57
public
:
58
inline
TOutput
operator()
(
const
TInput & A )
const
59
{
return
(TOutput) 0.54 + 0.46 * vcl_cos(A *
m_Factor
); }
60
private
:
62
static
const
double
m_Factor
;
63
};
64
71
template
<
unsigned
int
VRadius,
72
class
TInput=double,
class
TOutput=
double
>
73
class
WelchWindowFunction
74
{
75
public
:
76
inline
TOutput
operator()
(
const
TInput & A )
const
77
{
return
(TOutput) (1.0 - A *
m_Factor
* A); }
78
private
:
80
static
const
double
m_Factor
;
81
};
82
91
template
<
unsigned
int
VRadius,
92
class
TInput=double,
class
TOutput=
double
>
93
class
LanczosWindowFunction
94
{
95
public
:
96
inline
TOutput
operator()
(
const
TInput & A )
const
97
{
98
if
(A == 0.0)
return
(TOutput) 1.0;
99
double
z =
m_Factor
* A;
100
return
(TOutput) ( vcl_sin(z) / z );
101
}
102
private
:
104
static
const
double
m_Factor
;
105
};
106
113
template
<
unsigned
int
VRadius,
114
class
TInput=double,
class
TOutput=
double
>
115
class
BlackmanWindowFunction
116
{
117
public
:
118
inline
TOutput
operator()
(
const
TInput & A )
const
119
{
120
return
(TOutput)
121
(0.42 + 0.5 * vcl_cos(A *
m_Factor1
) + 0.08 * vcl_cos(A *
m_Factor2
));
122
}
123
private
:
125
static
const
double
m_Factor1
;
126
128
static
const
double
m_Factor2
;
129
};
130
131
}
// namespace Function
132
242
template
<
243
class
TInputImage,
244
unsigned
int
VRadius,
245
class
TWindowFunction =
Function::HammingWindowFunction<VRadius>
,
246
class
TBoundaryCondition =
ConstantBoundaryCondition<TInputImage>
,
247
class
TCoordRep=
double
>
248
class
ITK_EXPORT
WindowedSincInterpolateImageFunction
:
249
public
InterpolateImageFunction
<TInputImage, TCoordRep>
250
{
251
public
:
253
typedef
WindowedSincInterpolateImageFunction
Self
;
254
typedef
InterpolateImageFunction<TInputImage,TCoordRep>
Superclass
;
255
256
typedef
SmartPointer<Self>
Pointer
;
257
typedef
SmartPointer<const Self>
ConstPointer
;
258
260
itkTypeMacro(
WindowedSincInterpolateImageFunction
,
261
InterpolateImageFunction
);
262
264
itkNewMacro(
Self
);
265
267
typedef
typename
Superclass::OutputType
OutputType
;
268
270
typedef
typename
Superclass::InputImageType
InputImageType
;
271
273
typedef
typename
Superclass::RealType
RealType
;
274
276
itkStaticConstMacro(ImageDimension,
unsigned
int
,Superclass::ImageDimension);
277
279
typedef
typename
Superclass::IndexType
IndexType
;
280
typedef
typename
Superclass::IndexValueType
IndexValueType
;
281
283
typedef
TInputImage
ImageType
;
284
286
typedef
typename
Superclass::ContinuousIndexType
ContinuousIndexType
;
287
288
virtual
void
SetInputImage(
const
ImageType
*image);
289
296
virtual
OutputType
EvaluateAtContinuousIndex(
297
const
ContinuousIndexType
& index )
const
;
298
299
protected
:
300
WindowedSincInterpolateImageFunction
();
301
virtual
~
WindowedSincInterpolateImageFunction
();
302
void
PrintSelf(std::ostream& os,
Indent
indent)
const
;
303
304
private
:
305
WindowedSincInterpolateImageFunction
(
const
Self
& );
//not implemented
306
void
operator=(
const
Self
& );
//purposely not implemented
307
308
// Internal typedefs
309
typedef
ConstNeighborhoodIterator
<
310
ImageType
, TBoundaryCondition>
IteratorType
;
311
312
// Constant to store twice the radius
313
static
const
unsigned
int
m_WindowSize
;
314
316
TWindowFunction
m_WindowFunction
;
317
320
unsigned
int
*
m_OffsetTable
;
321
323
unsigned
int
m_OffsetTableSize
;
324
326
unsigned
int
**
m_WeightOffsetTable
;
327
329
inline
double
Sinc(
double
x)
const
330
{
331
double
px = vnl_math::pi * x;
332
return
(x == 0.0) ? 1.0 : vcl_sin(px) / px;
333
}
334
};
335
336
}
// namespace itk
337
338
#ifndef ITK_MANUAL_INSTANTIATION
339
#include "
itkWindowedSincInterpolateImageFunction.txx
"
340
#endif
341
342
#endif // _itkWindowedSincInterpolateImageFunction_h
Generated at Sun Feb 3 2013 00:15:07 for
Orfeo Toolbox
with
doxygen 1.8.1.1