Developer documentation
Version 3.0.3-105-gd3941f44
normalise.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_filter_normalise3D_h__
18#define __image_filter_normalise3D_h__
19
20#include "image.h"
21#include "algo/threaded_copy.h"
22#include "adapter/normalise3D.h"
23#include "filter/base.h"
24
25namespace MR
26{
27 namespace Filter
28 {
43 class Normalise : public Base { MEMALIGN(Normalise)
44
45 public:
46 template <class HeaderType>
47 Normalise (const HeaderType& in) :
48 Base (in),
49 extent (1,3) {
50 datatype() = DataType::Float32;
51 }
52
53 template <class HeaderType>
54 Normalise (const HeaderType& in, const std::string& message) :
55 Base (in, message),
56 extent (1,3) {
57 datatype() = DataType::Float32;
58 }
59
60 template <class HeaderType>
61 Normalise (const HeaderType& in, const vector<uint32_t>& extent) :
62 Base (in),
63 extent (extent) {
64 datatype() = DataType::Float32;
65 }
66
67 template <class HeaderType>
68 Normalise (const HeaderType& in, const std::string& message, const vector<uint32_t>& extent) :
69 Base (in, message),
70 extent (extent) {
71 datatype() = DataType::Float32;
72 }
73
77 void set_extent (const vector<uint32_t>& ext) {
78 for (size_t i = 0; i < ext.size(); ++i) {
79 if (!(ext[i] & uint32_t(1)))
80 throw Exception ("expected odd number for extent");
81 }
82 extent = ext;
83 }
84
85 template <class InputImageType, class OutputImageType>
86 void operator() (InputImageType& in, OutputImageType& out) {
88 if (message.size())
90 else
91 threaded_copy (normalise, out);
92 }
93
94 protected:
96 };
98 }
99}
100
101
102#endif
static constexpr uint8_t Float32
Definition: datatype.h:147
std::string message
Definition: base.h:66
vector< uint32_t > extent
Definition: normalise.h:95
Definition: base.h:24
void threaded_copy(InputImageType &source, OutputImageType &destination, const vector< size_t > &axes, size_t num_axes_in_thread=1)
Definition: threaded_copy.h:43
void threaded_copy_with_progress_message(const std::string &message, InputImageType &source, OutputImageType &destination, const vector< size_t > &axes, size_t num_axes_in_thread=1)
Definition: threaded_copy.h:69