RTK  2.5.0
Reconstruction Toolkit
rtkCyclicDeformationImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef rtkCyclicDeformationImageFilter_h
20 #define rtkCyclicDeformationImageFilter_h
21 
22 #include <itkImageToImageFilter.h>
23 
24 #include "rtkConfiguration.h"
25 #include "rtkMacro.h"
26 
27 namespace rtk
28 {
29 
49 template <class TInputImage, class TOutputImage>
50 class ITK_TEMPLATE_EXPORT CyclicDeformationImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_MOVE(CyclicDeformationImageFilter);
54 
57  using InputImageType = TInputImage;
58  using OutputImageType = TOutputImage;
62  using OutputImageRegionType = typename OutputImageType::RegionType;
63 
65  itkNewMacro(Self);
66 
68 #ifdef itkOverrideGetNameOfClassMacro
69  itkOverrideGetNameOfClassMacro(CyclicDeformationImageFilter);
70 #else
72 #endif
73 
74 
77  itkGetMacro(SignalFilename, std::string);
78  virtual void
79  SetSignalFilename(const std::string _arg);
80  virtual void
81  SetSignalVector(std::vector<double> _arg);
83 
86  itkGetMacro(Frame, unsigned int);
87  itkSetMacro(Frame, unsigned int);
89 
90 protected:
91  CyclicDeformationImageFilter() = default;
92  ~CyclicDeformationImageFilter() override = default;
93 
94  void
95  GenerateOutputInformation() override;
96  void
97  GenerateInputRequestedRegion() override;
98  void
99  BeforeThreadedGenerateData() override;
100  void
101  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
102 
103  // Linear interpolation position and weights
104  unsigned int m_FrameInf;
105  unsigned int m_FrameSup;
106  double m_WeightInf;
107  double m_WeightSup;
108 
109 private:
110  unsigned int m_Frame{ 0 };
111 
112  std::string m_SignalFilename;
113  std::vector<double> m_Signal;
114 };
115 
116 } // end namespace rtk
117 
118 #ifndef ITK_MANUAL_INSTANTIATION
119 # include "rtkCyclicDeformationImageFilter.hxx"
120 #endif
121 
122 #endif
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
TInputImage InputImageType
#define itkSetMacro(name, type)
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType