RTK  2.6.0
Reconstruction Toolkit
rtkUpsampleImageFilter.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 rtkUpsampleImageFilter_h
20 #define rtkUpsampleImageFilter_h
21 
22 #include <itkImageToImageFilter.h>
24 
25 namespace rtk
26 {
27 
38 template <class TInputImage, class TOutputImage = TInputImage>
39 class ITK_TEMPLATE_EXPORT UpsampleImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(UpsampleImageFilter);
43 
49 
51  itkNewMacro(Self);
52 
54 #ifdef itkOverrideGetNameOfClassMacro
55  itkOverrideGetNameOfClassMacro(UpsampleImageFilter);
56 #else
58 #endif
59 
60 
62  using OutputImageType = TOutputImage;
63  using InputImageType = TInputImage;
64  using OutputImagePointer = typename OutputImageType::Pointer;
65  using InputImagePointer = typename InputImageType::Pointer;
66  using InputImageConstPointer = typename InputImageType::ConstPointer;
67 
69  using OutputImageRegionType = typename TOutputImage::RegionType;
70 
72  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
73 
76  void
77  SetFactors(const unsigned int factors[]);
78 
81  void
82  SetFactor(unsigned int dimension, unsigned int factor);
83 
91  void
92  GenerateOutputInformation() override;
93 
99  void
100  GenerateInputRequestedRegion() override;
101 
107  itkSetMacro(Order, unsigned int);
108  itkGetMacro(Order, unsigned int);
110 
116  itkSetMacro(OutputSize, typename TOutputImage::SizeType);
117  itkGetMacro(OutputSize, typename TOutputImage::SizeType);
119 
126  itkSetMacro(OutputIndex, typename TOutputImage::IndexType);
127  itkGetMacro(OutputIndex, typename TOutputImage::IndexType);
129 
130 protected:
132  ~UpsampleImageFilter() override = default;
133 
144  void
145  ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
146  itk::ThreadIdType itkNotUsed(threadId)) override;
147 
148 private:
149  unsigned int m_Factors[ImageDimension];
150  unsigned int m_Order;
151  typename TOutputImage::SizeType m_OutputSize;
152  typename TOutputImage::IndexType m_OutputIndex;
153 
155  GetImageRegionSplitter() const override;
157 };
158 
159 
160 } // end namespace rtk
161 
162 #ifndef rtk_MANUAL_INSTANTIATION
163 # include "rtkUpsampleImageFilter.hxx"
164 #endif
165 
166 #endif
typename OutputImageType::Pointer OutputImagePointer
Upsamples an image by the given factor for each dimension.
TInputImage InputImageType
#define itkSetMacro(name, type)
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage::SizeType m_OutputSize
itk::ImageRegionSplitterDirection::Pointer m_Splitter
TOutputImage OutputImageType
unsigned int ThreadIdType
TOutputImage::IndexType m_OutputIndex
typename InputImageType::ConstPointer InputImageConstPointer