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
23namespace MR
24{
25 namespace Adapter
26 {
27
28 template <class ImageType>
29 class Gradient3D :
30 public Gradient1D<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) :
41 transform (parent) {}
42
43 value_type value ()
44 {
45 value_type grad;
46 for (size_t i = 0; i < 3; ++i) {
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;
59 };
60 }
61}
62
63#endif
64
const bool wrt_scanner
Definition: gradient3D.h:57
const transform_type image2scanner
Definition: transform.h:43
Definition: base.h:24
#define MEMALIGN(...)
Definition: types.h:185