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  itkOverrideGetNameOfClassMacro(UpsampleImageFilter);
55 
57  using OutputImageType = TOutputImage;
58  using InputImageType = TInputImage;
59  using OutputImagePointer = typename OutputImageType::Pointer;
60  using InputImagePointer = typename InputImageType::Pointer;
61  using InputImageConstPointer = typename InputImageType::ConstPointer;
62 
64  using OutputImageRegionType = typename TOutputImage::RegionType;
65 
67  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
68 
71  void
72  SetFactors(const unsigned int factors[]);
73 
76  void
77  SetFactor(unsigned int dimension, unsigned int factor);
78 
86  void
87  GenerateOutputInformation() override;
88 
94  void
95  GenerateInputRequestedRegion() override;
96 
102  itkSetMacro(Order, unsigned int);
103  itkGetMacro(Order, unsigned int);
105 
111  itkSetMacro(OutputSize, typename TOutputImage::SizeType);
112  itkGetMacro(OutputSize, typename TOutputImage::SizeType);
114 
121  itkSetMacro(OutputIndex, typename TOutputImage::IndexType);
122  itkGetMacro(OutputIndex, typename TOutputImage::IndexType);
124 
125 protected:
127  ~UpsampleImageFilter() override = default;
128 
139  void
140  ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
141  itk::ThreadIdType itkNotUsed(threadId)) override;
142 
143 private:
144  unsigned int m_Factors[ImageDimension];
145  unsigned int m_Order;
146  typename TOutputImage::SizeType m_OutputSize;
147  typename TOutputImage::IndexType m_OutputIndex;
148 
150  GetImageRegionSplitter() const override;
152 };
153 
154 
155 } // end namespace rtk
156 
157 #ifndef rtk_MANUAL_INSTANTIATION
158 # include "rtkUpsampleImageFilter.hxx"
159 #endif
160 
161 #endif
typename OutputImageType::Pointer OutputImagePointer
Upsamples an image by the given factor for each dimension.
#define itkSetMacro(name, type)
typename InputImageType::Pointer InputImagePointer
typename InputImageType::ConstPointer InputImageConstPointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage::SizeType m_OutputSize
itk::ImageRegionSplitterDirection::Pointer m_Splitter
TOutputImage OutputImageType
unsigned int ThreadIdType
TOutputImage::IndexType m_OutputIndex