NiftiImageReader.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2008-2015 Imperial College London
5  * Copyright 2008-2015 Daniel Rueckert, Julia Schnabel
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_NiftiImageReader_H
21 #define MIRTK_NiftiImageReader_H
22 
23 #include "mirtk/ImageReader.h"
24 #include "mirtk/Memory.h"
25 
26 
27 namespace mirtk {
28 
29 
30 // Forward declaration of internal NIfTI-1 image wrapper
31 class NiftiImage;
32 
33 
34 /**
35  * Class for reading images in NIFTI file format.
36  *
37  * This is a class which reads images in NIFTI file format and converts them
38  * into images. The NIFTI file format is a file format for 3D and 4D images.
39  *
40  * \sa http://nifti.nimh.nih.gov/nifti-1/
41  */
43 {
44  mirtkObjectMacro(NiftiImageReader);
45 
46  /// Path/name of image data file
47  mirtkReadOnlyAttributeMacro(string, ImageName);
48 
49  /// NIfTI image
50  UniquePtr<NiftiImage> _Nifti;
51 
52 public:
53 
54  /// Returns whether file has correct header
55  static bool CheckHeader(const char *);
56 
57  /// Check if this reader can read a given image file
58  virtual bool CanRead(const char *) const;
59 
60  /// Constructor
62 
63  /// Destructor
64  virtual ~NiftiImageReader();
65 
66  /// Open file and read image header
67  virtual void Initialize();
68 
69  /// Print image file information
70  virtual void Print() const;
71 
72 protected:
73 
74  /// Read header of NIFTI file
75  virtual void ReadHeader();
76 
77 };
78 
79 
80 } // namespace mirtk
81 
82 #endif // MIRTK_NiftiImageReader_H
static bool CheckHeader(const char *)
Returns whether file has correct header.
virtual ~NiftiImageReader()
Destructor.
virtual bool CanRead(const char *) const
Check if this reader can read a given image file.
Definition: IOConfig.h:41
NiftiImageReader()
Constructor.
virtual void Initialize()
Open file and read image header.
virtual void ReadHeader()
Read header of NIFTI file.
virtual void Print() const
Print image file information.