NiftiImageWriter.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2008-2015 Imperial College London
5  * Copyright 2008-2013 Daniel Rueckert, Julia Schnabel
6  * Copyright 2013-2015 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_NiftiImageWriter_H
22 #define MIRTK_NiftiImageWriter_H
23 
24 #include "mirtk/ImageWriter.h"
25 
26 #include "mirtk/Memory.h"
27 #include "mirtk/Array.h"
28 
29 
30 namespace mirtk {
31 
32 
33 // Forward declaration of internal NIfTI-1 image wrapper
34 class NiftiImage;
35 
36 
37 /**
38  * Class for image to NIFTI file writer.
39  *
40  * This is a class which takes an image as input and produces an image file
41  * in NIFTI file format.
42  */
44 {
45  mirtkObjectMacro(NiftiImageWriter);
46 
47  /// NIfTI image
48  UniquePtr<NiftiImage> _Nifti;
49 
50 public:
51 
52  /// Constructor
54 
55  /// Destructor
56  virtual ~NiftiImageWriter();
57 
58  /// List of file name extensions
59  static Array<string> Extensions();
60 
61  /// Write image
62  virtual void Run();
63 
64 protected:
65 
66  /// Open file and write header
67  virtual void Initialize();
68 
69  /// Close file
70  virtual void Finalize();
71 
72 };
73 
74 
75 } // namespace mirtk
76 
77 #endif // MIRTK_NiftiImageWriter_H
NiftiImageWriter()
Constructor.
virtual void Initialize()
Open file and write header.
Definition: IOConfig.h:41
virtual void Run()
Write image.
virtual ~NiftiImageWriter()
Destructor.
virtual void Finalize()
Close file.
static Array< string > Extensions()
List of file name extensions.