Developer documentation
Version 3.0.3-105-gd3941f44
freesurfer.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 __surface_freesurfer_h__
18#define __surface_freesurfer_h__
19
20#include <stdint.h>
21#include <fstream>
22
23#include "raw.h"
24
25#include "connectome/lut.h"
26
27#include "surface/scalar.h"
28#include "surface/types.h"
29
30namespace MR
31{
32 namespace Surface
33 {
34 namespace FreeSurfer
35 {
36
37
38 constexpr int32_t triangle_file_magic_number = 16777214;
39 constexpr int32_t quad_file_magic_number = 16777215;
40
41 constexpr int32_t new_curv_file_magic_number = 16777215;
42
43
44 inline int32_t get_int24_BE (std::ifstream& stream)
45 {
46 uint8_t bytes[3];
47 for (size_t i = 0; i != 3; ++i)
48 stream.read (reinterpret_cast<char*>(bytes+i), 1);
49 return (int32_t(bytes[0]) << 16) | (int32_t(bytes[1]) << 8) | int32_t(bytes[2]);
50 }
51
52
53
54 template <typename T>
55 inline T get_BE (std::ifstream& stream)
56 {
57 T temp;
58 stream.read (reinterpret_cast<char*>(&temp), sizeof(T));
59 return Raw::fetch_BE<T> (&temp);
60 }
61
62
63
64 void read_annot (const std::string&, label_vector_type&, Connectome::LUT&);
65 void read_label (const std::string&, VertexList&, Scalar&);
66
67
68
69 }
70 }
71}
72
73#endif
74
T get_BE(std::ifstream &stream)
Definition: freesurfer.h:55
constexpr int32_t triangle_file_magic_number
Definition: freesurfer.h:38
constexpr int32_t quad_file_magic_number
Definition: freesurfer.h:39
void read_label(const std::string &, VertexList &, Scalar &)
constexpr int32_t new_curv_file_magic_number
Definition: freesurfer.h:41
void read_annot(const std::string &, label_vector_type &, Connectome::LUT &)
int32_t get_int24_BE(std::ifstream &stream)
Definition: freesurfer.h:44
Eigen::Array< Connectome::node_t, Eigen::Dynamic, 1 > label_vector_type
Definition: types.h:51
Definition: base.h:24