Developer documentation
Version 3.0.3-105-gd3941f44
gradient3D.h
Go to the documentation of this file.
1
/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2
*
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
*
7
* Covered Software is provided under this License on an "as is"
8
* basis, without warranty of any kind, either expressed, implied, or
9
* statutory, including, without limitation, warranties that the
10
* Covered Software is free of defects, merchantable, fit for a
11
* particular purpose or non-infringing.
12
* See the Mozilla Public License v. 2.0 for more details.
13
*
14
* For more details, see http://www.mrtrix.org/.
15
*/
16
17
#ifndef __image_adapter_gradient3D_h__
18
#define __image_adapter_gradient3D_h__
19
20
#include "
adapter/gradient1D.h
"
21
#include "transform.h"
22
23
namespace
MR
24
{
25
namespace
Adapter
26
{
27
28
template
<
class
ImageType>
29
class
Gradient3D
:
30
public
Gradient1D
<ImageType>
31
{
MEMALIGN
(
Gradient3D<ImageType>
)
32
33
public
:
34
35
using
value_type = Eigen::Matrix<typename ImageType::value_type,3,1>;
36
37
Gradient3D
(
const
ImageType& parent,
38
bool
wrt_scanner
=
false
) :
39
Gradient1D<ImageType>
(parent,
wrt_scanner
),
40
wrt_scanner
(
wrt_scanner
),
41
transform
(parent) {}
42
43
value_type value ()
44
{
45
value_type grad;
46
for
(
size_t
i = 0; i < 3; ++i) {
47
Gradient1D<ImageType>::set_axis
(i);
48
grad[i] =
Gradient1D<ImageType>::value
();
49
}
50
if
(
wrt_scanner
)
51
grad =
transform
.
image2scanner
.linear().template cast<typename ImageType::value_type>() * grad;
52
53
return
grad;
54
}
55
56
protected
:
57
const
bool
wrt_scanner
;
58
Transform
transform
;
59
};
60
}
61
}
62
63
#endif
64
MR::Adapter::Gradient1D
Definition:
gradient1D.h:30
MR::Adapter::Gradient3D
Definition:
gradient3D.h:31
MR::Adapter::Gradient3D::wrt_scanner
const bool wrt_scanner
Definition:
gradient3D.h:57
MR::Adapter::Gradient3D::transform
Transform transform
Definition:
gradient3D.h:58
MR::Transform
Definition:
transform.h:24
MR::Transform::image2scanner
const transform_type image2scanner
Definition:
transform.h:43
gradient1D.h
MR
Definition:
base.h:24
MEMALIGN
#define MEMALIGN(...)
Definition:
types.h:185
core
adapter
gradient3D.h
Generated on Mon Jul 4 2022 08:00:06 for MRtrix by
1.9.3