Modules
Image
include
mirtk
ConstExtrapolateImageFunction.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_ConstExtrapolateImageFunction_H
21
#define MIRTK_ConstExtrapolateImageFunction_H
22
23
#include "mirtk/ExtrapolateImageFunction.h"
24
25
#include "mirtk/VoxelCast.h"
26
#include "mirtk/BaseImage.h"
27
28
29
namespace
mirtk
{
30
31
32
/**
33
* Constant extrapolation (i.e., padding) of generic image
34
*
35
* This discrete image extrapolation function assumes a constant image value
36
* for image grid points outside the discrete domain on which the discrete image
37
* function is defined.
38
*/
39
template
<
class
TImage>
40
class
GenericConstExtrapolateImageFunction
41
:
public
GenericExtrapolateImageFunction
<TImage>
42
{
43
mirtkGenericExtrapolatorMacro(
44
GenericConstExtrapolateImageFunction
,
45
Extrapolation_Const
46
);
47
48
public
:
49
50
/// Default constructor
51
GenericConstExtrapolateImageFunction
(
double
padding_value = .0)
52
{
53
this->_DefaultValue = padding_value;
54
}
55
56
/// Destructor
57
virtual
~GenericConstExtrapolateImageFunction
() {}
58
59
/// Get image value at an arbitrary discrete image location
60
virtual
VoxelType
Get
(
int
i,
int
j,
int
k = 0,
int
l = 0)
const
61
{
62
if
(0 <= i && i < this->
X
() &&
63
0 <= j && j < this->
Y
() &&
64
0 <= k && k < this->
Z
() &&
65
0 <= l && l < this->
T
()) {
66
return
this->
Input
()->Get(i, j, k, l);
67
}
else
{
68
return
voxel_cast<
VoxelType
>(this->_DefaultValue);
69
}
70
}
71
72
};
73
74
75
/**
76
* Constant extrapolation (i.e., padding) of any image
77
*/
78
class
ConstExtrapolateImageFunction
79
:
public
GenericConstExtrapolateImageFunction
<BaseImage>
80
{
81
mirtkObjectMacro(
ConstExtrapolateImageFunction
);
82
83
public
:
84
85
/// Constructor
86
ConstExtrapolateImageFunction
(
double
padding_value = .0)
87
:
88
GenericConstExtrapolateImageFunction
<
BaseImage
>(padding_value)
89
{}
90
91
/// Destructor
92
virtual
~ConstExtrapolateImageFunction
() {}
93
94
};
95
96
97
}
// namespace mirtk
98
99
#endif // MIRTK_ConstExtrapolateImageFunction_H
mirtk::ConstExtrapolateImageFunction::ConstExtrapolateImageFunction
ConstExtrapolateImageFunction(double padding_value=.0)
Constructor.
Definition:
ConstExtrapolateImageFunction.h:86
mirtk::GenericExtrapolateImageFunction
Definition:
ExtrapolateImageFunction.h:150
mirtk::GenericConstExtrapolateImageFunction::Get
virtual VoxelType Get(int i, int j, int k=0, int l=0) const
Get image value at an arbitrary discrete image location.
Definition:
ConstExtrapolateImageFunction.h:60
mirtk::ExtrapolateImageFunction::T
int T() const
Size of input image in t dimension.
Definition:
ExtrapolateImageFunction.h:399
mirtk::ConstExtrapolateImageFunction::~ConstExtrapolateImageFunction
virtual ~ConstExtrapolateImageFunction()
Destructor.
Definition:
ConstExtrapolateImageFunction.h:92
mirtk::ExtrapolateImageFunction::Z
int Z() const
Size of input image in z dimension.
Definition:
ExtrapolateImageFunction.h:393
mirtk::ExtrapolateImageFunction::X
int X() const
Size of input image in x dimension.
Definition:
ExtrapolateImageFunction.h:381
mirtk::BaseImage
Definition:
BaseImage.h:72
mirtk
Definition:
IOConfig.h:41
mirtk::GenericExtrapolateImageFunction< BaseImage >::VoxelType
ImageType::VoxelType VoxelType
Input voxel type.
Definition:
ExtrapolateImageFunction.h:160
mirtk::ConstExtrapolateImageFunction
Definition:
ConstExtrapolateImageFunction.h:78
mirtk::GenericConstExtrapolateImageFunction::GenericConstExtrapolateImageFunction
GenericConstExtrapolateImageFunction(double padding_value=.0)
Default constructor.
Definition:
ConstExtrapolateImageFunction.h:51
mirtk::ExtrapolateImageFunction::Y
int Y() const
Size of input image in y dimension.
Definition:
ExtrapolateImageFunction.h:387
mirtk::GenericConstExtrapolateImageFunction::~GenericConstExtrapolateImageFunction
virtual ~GenericConstExtrapolateImageFunction()
Destructor.
Definition:
ConstExtrapolateImageFunction.h:57
mirtk::GenericExtrapolateImageFunction::Input
const ImageType * Input() const
Get input image.
Definition:
ExtrapolateImageFunction.h:539
mirtk::GenericConstExtrapolateImageFunction
Definition:
ConstExtrapolateImageFunction.h:40