Developer documentation
Version 3.0.3-105-gd3941f44
average_space.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 __math_average_space_h__
18#define __math_average_space_h__
19
20#include <unsupported/Eigen/MatrixFunctions>
21#include <Eigen/SVD>
22#include <Eigen/Geometry>
23#include "transform.h"
24#include "image.h"
25#include "debug.h"
26
27namespace MR
28{
29 namespace Math
30 {
31 double matrix_average (vector<Eigen::MatrixXd> const &mat_in, Eigen::MatrixXd& mat_avg, bool verbose = false);
32 }
33 }
34
35 namespace MR {
36
37 Eigen::Matrix<default_type, 8, 4> get_cuboid_corners (const Eigen::Matrix<default_type, 4, 1>& xzx1);
38 Eigen::Matrix<default_type, 8, 4> get_bounding_box (const Header& header, const Eigen::Transform<default_type, 3, Eigen::Projective>& voxel2scanner);
39
41 const vector<Eigen::Transform<default_type, 3, Eigen::Projective>>& transform_header_with,
42 int voxel_subsampling = 1,
43 Eigen::Matrix<default_type, 4, 1> padding = Eigen::Matrix<default_type, 4, 1>(1.0, 1.0, 1.0, 1.0));
44
45 template<class ImageType1, class ImageType2>
47 const ImageType1& im1,
48 const ImageType2& im2,
49 Eigen::Transform<default_type, 3, Eigen::Projective> transform_1 = Eigen::Transform<default_type, 3, Eigen::Projective>::Identity(),
50 Eigen::Transform<default_type, 3, Eigen::Projective> transform_2 = Eigen::Transform<default_type, 3, Eigen::Projective>::Identity(),
51 Eigen::Matrix<default_type, 4, 1> padding = Eigen::Matrix<default_type, 4, 1>(1.0, 1.0, 1.0, 1.0),
52 int voxel_subsampling = 1) {
53 vector<Eigen::Transform<default_type, 3, Eigen::Projective>> init_transforms {transform_1, transform_2};
54 vector<Header> headers {im1,im2};
55 return compute_minimum_average_header (headers, init_transforms, voxel_subsampling, padding);
56 }
57 }
58#endif
double matrix_average(vector< Eigen::MatrixXd > const &mat_in, Eigen::MatrixXd &mat_avg, bool verbose=false)
Definition: base.h:24
Eigen::Matrix< default_type, 8, 4 > get_bounding_box(const Header &header, const Eigen::Transform< default_type, 3, Eigen::Projective > &voxel2scanner)
Header compute_minimum_average_header(const vector< Header > &input_headers, const vector< Eigen::Transform< default_type, 3, Eigen::Projective > > &transform_header_with, int voxel_subsampling=1, Eigen::Matrix< default_type, 4, 1 > padding=Eigen::Matrix< default_type, 4, 1 >(1.0, 1.0, 1.0, 1.0))
Eigen::Matrix< default_type, 8, 4 > get_cuboid_corners(const Eigen::Matrix< default_type, 4, 1 > &xzx1)