Developer documentation
Version 3.0.3-105-gd3941f44
jacobian.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_jacobian_h__
18
#define __image_adapter_jacobian_h__
19
20
#include "
adapter/base.h
"
21
#include "
adapter/gradient1D.h
"
22
#include "transform.h"
23
24
namespace
MR
25
{
26
namespace
Adapter
27
{
28
29
template
<
class
WarpType>
30
class
Jacobian
:
31
public
Base
<Jacobian<WarpType>,WarpType>
32
{
MEMALIGN
(
Jacobian<WarpType>
)
33
public
:
34
35
using
base_type =
Base<Jacobian<WarpType>
, WarpType>;
36
using
value_type = Eigen::Matrix<typename WarpType::value_type, 3, 3>;
37
38
using
base_type::name
;
39
using
base_type::size;
40
using
base_type::spacing;
41
using
base_type::index
;
42
43
Jacobian
(
const
WarpType& parent,
bool
wrt_scanner
=
true
) :
44
base_type (parent),
45
gradient1D
(parent, 0,
wrt_scanner
),
46
transform
(parent),
47
wrt_scanner
(
wrt_scanner
) { }
48
49
value_type value ()
50
{
51
for
(
size_t
dim = 0; dim < 3; ++dim)
52
gradient1D
.index(dim) =
index
(dim);
53
for
(
size_t
i = 0; i < 3; ++i) {
54
gradient1D
.index(3) = i;
55
for
(
size_t
j = 0; j < 3; ++j) {
56
gradient1D
.set_axis(j);
57
jacobian
(i, j) =
gradient1D
.value();
58
}
59
}
60
61
if
(
wrt_scanner
)
62
jacobian
=
jacobian
*
transform
.
scanner2image
.linear().template cast<typename WarpType::value_type>();
63
return
jacobian
;
64
}
65
66
67
protected
:
68
value_type
jacobian
;
69
Gradient1D<WarpType>
gradient1D
;
70
Transform
transform
;
71
const
bool
wrt_scanner
;
72
};
73
}
74
}
75
76
77
#endif
78
MR::Adapter::Base
Definition:
base.h:38
MR::Adapter::Gradient1D< WarpType >
MR::Adapter::Jacobian
Definition:
jacobian.h:32
MR::Adapter::Jacobian::transform
Transform transform
Definition:
jacobian.h:70
MR::Adapter::Jacobian::jacobian
value_type jacobian
Definition:
jacobian.h:68
MR::Adapter::Jacobian::gradient1D
Gradient1D< WarpType > gradient1D
Definition:
jacobian.h:69
MR::Adapter::Jacobian::wrt_scanner
const bool wrt_scanner
Definition:
jacobian.h:71
MR::Transform
Definition:
transform.h:24
MR::Transform::scanner2image
const transform_type scanner2image
Definition:
transform.h:43
base.h
gradient1D.h
MR
Definition:
base.h:24
index
size_t index
Definition:
ordered_thread_queue.h:38
MEMALIGN
#define MEMALIGN(...)
Definition:
types.h:185
name
const std::string name
Definition:
thread.h:108
core
adapter
jacobian.h
Generated on Mon Jul 4 2022 08:00:06 for MRtrix by
1.9.3