Modules
Image
include
mirtk
NearestNeighborExtrapolateImageFunction.h
1
/*
2
* Medical Image Registration ToolKit (MIRTK)
3
*
4
* Copyright 2013-2015 Imperial College London
5
* Copyright 2013-2015 Andreas Schuh
6
*
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
10
*
11
* http://www.apache.org/licenses/LICENSE-2.0
12
*
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
18
*/
19
20
#ifndef MIRTK_NearestNeighorExtrapolateImageFunction_H
21
#define MIRTK_NearestNeighorExtrapolateImageFunction_H
22
23
#include "mirtk/ExtrapolateImageFunction.h"
24
#include "mirtk/BaseImage.h"
25
26
27
namespace
mirtk
{
28
29
30
/**
31
* Nearest neighbor extrapolation of generic image
32
*
33
* The nearest neighor extrapolation of a discrete image corresponds to a
34
* Neumann boundary condition with the derivative value outside the image domain
35
* set to zero.
36
*/
37
template
<
class
TImage>
38
class
GenericNearestNeighborExtrapolateImageFunction
39
:
public
IndexExtrapolateImageFunction
<TImage>
40
{
41
mirtkExtrapolatorMacro(
42
GenericNearestNeighborExtrapolateImageFunction
,
43
Extrapolation_NN
44
);
45
46
public
:
47
48
/// Constructor
49
GenericNearestNeighborExtrapolateImageFunction
() {}
50
51
/// Destructor
52
virtual
~GenericNearestNeighborExtrapolateImageFunction
() {}
53
54
/// Transform index such that it is inside the range [0, max]
55
virtual
void
TransformIndex
(
int
&index,
int
max)
const
56
{
57
if
(index < 0 ) index = 0;
58
else
if
(index > max) index = max;
59
}
60
61
};
62
63
64
/**
65
* Nearest neighbor extrapolation of any image
66
*
67
* The nearest neighor extrapolation of a discrete image corresponds to a
68
* Neumann boundary condition with the derivative value outside the image domain
69
* set to zero.
70
*/
71
class
NearestNeighborExtrapolateImageFunction
72
:
public
GenericNearestNeighborExtrapolateImageFunction
<BaseImage>
73
{
74
mirtkObjectMacro(
NearestNeighborExtrapolateImageFunction
);
75
76
public
:
77
78
/// Constructor
79
NearestNeighborExtrapolateImageFunction
() {}
80
81
/// Destructor
82
virtual
~NearestNeighborExtrapolateImageFunction
() {}
83
84
};
85
86
87
}
// namespace mirtk
88
89
#endif // MIRTK_NearestNeighorExtrapolateImageFunction_H
mirtk::GenericNearestNeighborExtrapolateImageFunction::~GenericNearestNeighborExtrapolateImageFunction
virtual ~GenericNearestNeighborExtrapolateImageFunction()
Destructor.
Definition:
NearestNeighborExtrapolateImageFunction.h:52
mirtk::IndexExtrapolateImageFunction
Definition:
ExtrapolateImageFunction.h:241
mirtk::GenericNearestNeighborExtrapolateImageFunction::GenericNearestNeighborExtrapolateImageFunction
GenericNearestNeighborExtrapolateImageFunction()
Constructor.
Definition:
NearestNeighborExtrapolateImageFunction.h:49
mirtk
Definition:
IOConfig.h:41
mirtk::GenericNearestNeighborExtrapolateImageFunction
Definition:
NearestNeighborExtrapolateImageFunction.h:38
mirtk::NearestNeighborExtrapolateImageFunction::NearestNeighborExtrapolateImageFunction
NearestNeighborExtrapolateImageFunction()
Constructor.
Definition:
NearestNeighborExtrapolateImageFunction.h:79
mirtk::NearestNeighborExtrapolateImageFunction::~NearestNeighborExtrapolateImageFunction
virtual ~NearestNeighborExtrapolateImageFunction()
Destructor.
Definition:
NearestNeighborExtrapolateImageFunction.h:82
mirtk::GenericNearestNeighborExtrapolateImageFunction::TransformIndex
virtual void TransformIndex(int &index, int max) const
Transform index such that it is inside the range [0, max].
Definition:
NearestNeighborExtrapolateImageFunction.h:55
mirtk::NearestNeighborExtrapolateImageFunction
Definition:
NearestNeighborExtrapolateImageFunction.h:71