RTK  2.0.1
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  * http://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>
51  public itk::ImageToImageFilter<TInputImage, TOutputImage >
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_ASSIGN(CyclicDeformationImageFilter);
55 
58  using InputImageType = TInputImage;
59  using OutputImageType = TOutputImage;
63  using OutputImageRegionType = typename OutputImageType::RegionType;
64 
66  itkNewMacro(Self);
67 
70 
73  itkGetMacro(SignalFilename, std::string);
74  virtual void SetSignalFilename (const std::string _arg);
75  virtual void SetSignalVector (std::vector<double> _arg);
77 
80  itkGetMacro(Frame, unsigned int);
81  itkSetMacro(Frame, unsigned int);
83 
84 protected:
86  ~CyclicDeformationImageFilter() override = default;
87 
88  void GenerateOutputInformation() override;
89  void GenerateInputRequestedRegion() override;
90  void BeforeThreadedGenerateData() override;
91 #if ITK_VERSION_MAJOR<5
92  void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread,
93  ThreadIdType threadId ) override;
94 #else
95  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
96 #endif
97 
98  // Linear interpolation position and weights
99  unsigned int m_FrameInf;
100  unsigned int m_FrameSup;
101  double m_WeightInf;
102  double m_WeightSup;
103 
104 private:
105  unsigned int m_Frame{0};
106 
107  std::string m_SignalFilename;
108  std::vector<double> m_Signal;
109 };
110 
111 } // end namespace rtk
112 
113 #ifndef ITK_MANUAL_INSTANTIATION
114 #include "rtkCyclicDeformationImageFilter.hxx"
115 #endif
116 
117 #endif
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
typename OutputImageType::RegionType OutputImageRegionType
unsigned int ThreadIdType
#define itkSetMacro(name, type)