Modules
IO
src
NiftiImage.h
1
/*
2
* Medical Image Registration ToolKit (MIRTK)
3
*
4
* Copyright 2008-2016 Imperial College London
5
* Copyright 2008-2013 Daniel Rueckert, Julia Schnabel
6
* Copyright 2013-2016 Andreas Schuh
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*/
20
21
#ifndef MIRTK_NiftiImage_H
22
#define MIRTK_NiftiImage_H
23
24
#include "nifti/nifti2_io.h"
25
26
#ifndef LSB_FIRST
27
# define LSB_FIRST 1
28
#endif
29
#ifndef MSB_FIRST
30
# define MSB_FIRST 2
31
#endif
32
33
#include "mirtk/Matrix.h"
34
35
36
namespace
mirtk
{
37
38
39
/**
40
* The NIfTI-1 image class.
41
*
42
* This is a wrapper around the nifti_image struct.
43
*/
44
class
NiftiImage
45
{
46
public
:
47
48
enum
DataOrder { RADIOLOGICAL = -1, INCONSISTENT = 0, NEUROLOGICAL = 1 };
49
50
/// The "NIFTI-1" image storage struct.
51
nifti_image *
nim
;
52
53
/// Constructor
54
NiftiImage
(
const
char
*fname = NULL);
55
56
/// Destructor
57
~NiftiImage
();
58
59
/// Read header
60
void
Read
(
const
char
*);
61
62
// Initialize header with minimal set of fields and orientation info.
63
void
Initialize(
int
,
int
,
int
,
int
,
64
double
,
double
,
double
,
double
,
65
int
,
Matrix
&qmat,
Matrix
*smat = 0,
66
double
torigin = 0,
const
void
*data = NULL);
67
68
// Initialize header with minimal set of fields and orientation info.
69
void
Initialize(
int
,
int
,
int
,
int
,
int
,
70
double
,
double
,
double
,
double
,
71
int
,
Matrix
&qmat,
Matrix
*smat = 0,
72
double
torigin = 0,
const
void
*data = NULL);
73
74
/// Print header (for debugging purposes)
75
void
Print
();
76
77
};
78
79
80
}
// namespace mirtk
81
82
#endif // MIRTK_NiftiImage_H
mirtk::NiftiImage
Definition:
NiftiImage.h:44
mirtk::NiftiImage::Read
void Read(const char *)
Read header.
mirtk
Definition:
IOConfig.h:41
mirtk::NiftiImage::nim
nifti_image * nim
The "NIFTI-1" image storage struct.
Definition:
NiftiImage.h:51
mirtk::NiftiImage::Print
void Print()
Print header (for debugging purposes)
mirtk::Matrix
Definition:
Matrix.h:48
mirtk::NiftiImage::~NiftiImage
~NiftiImage()
Destructor.
mirtk::NiftiImage::NiftiImage
NiftiImage(const char *fname=NULL)
Constructor.