Resampling.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_Resampling_H
22 #define MIRTK_Resampling_H
23 
24 #include "mirtk/ImageToImage.h"
25 
26 
27 namespace mirtk {
28 
29 
30 // Interpolator base type
31 class InterpolateImageFunction;
32 
33 
34 /**
35  * Class for resampling of images
36  *
37  * This class defines and implements the resampling of images with arbitrary
38  * voxel dimensions. The new image intensity of the voxels is calculated by
39  * interpolation of the old image intensities. Possible interpolation schemes
40  * are nearest neighbor, linear, cubic spline and B-spline interpolation.
41  */
42 template <class TVoxel>
43 class Resampling : public ImageToImage<TVoxel>
44 {
45  mirtkImageFilterMacro(Resampling, TVoxel);
46 
47  // ---------------------------------------------------------------------------
48  // Attributes
49 
50  /// Size of output after resampling in x dimension
51  mirtkPublicAttributeMacro(int, X);
52 
53  /// Size of output after resampling in y dimension
54  mirtkPublicAttributeMacro(int, Y);
55 
56  /// Size of output after resampling in z dimension
57  mirtkPublicAttributeMacro(int, Z);
58 
59  /// Voxel size of output after resampling in x dimension
60  mirtkPublicAttributeMacro(double, XSize);
61 
62  /// Voxel size of output after resampling in y dimension
63  mirtkPublicAttributeMacro(double, YSize);
64 
65  /// Voxel size of output after resampling in z dimension
66  mirtkPublicAttributeMacro(double, ZSize);
67 
68  /// Image function used to interpolate/extrapolate input
69  mirtkPublicAggregateMacro(InterpolateImageFunction, Interpolator);
70 
71  // ---------------------------------------------------------------------------
72  // Construction/Destruction
73 
74 public:
75 
76  /// Constructor
77  Resampling(double, double, double);
78 
79  /// Constructor
80  Resampling(int, int, int);
81 
82  /// Constructor
83  Resampling(int, int, int, double, double, double);
84 
85  // ---------------------------------------------------------------------------
86  // Execution
87 
88  /// Run the resampling filter
89  virtual void Run();
90 
91 protected:
92 
93  /// Initialize the filter
94  virtual void Initialize();
95 
96  /// Initialize filter output
97  virtual void InitializeOutput();
98 
99 };
100 
101 
102 } // namespace mirtk
103 
104 #endif // MIRTK_Resampling_H
virtual void Run()
Run the resampling filter.
Definition: IOConfig.h:41
virtual void InitializeOutput()
Initialize filter output.
Resampling(double, double, double)
Constructor.
virtual void Initialize()
Initialize the filter.