RTK  2.0.1
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  * 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 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_EXPORT UpsampleImageFilter:
40  public itk::ImageToImageFilter<TInputImage,TOutputImage>
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_ASSIGN(UpsampleImageFilter);
44 
50 
52  itkNewMacro(Self);
53 
56 
58  using OutputImageType = TOutputImage;
59  using InputImageType = TInputImage;
60  using OutputImagePointer = typename OutputImageType::Pointer;
61  using InputImagePointer = typename InputImageType::Pointer;
62  using InputImageConstPointer = typename InputImageType::ConstPointer;
63 
65  using OutputImageRegionType = typename TOutputImage::RegionType;
66 
68  itkStaticConstMacro(ImageDimension, unsigned int,
69  TInputImage::ImageDimension );
70 
73  void SetFactors(unsigned int factors[]);
74 
77  void SetFactor(unsigned int dimension, unsigned int factor);
78 
86  void GenerateOutputInformation() override;
87 
93  void GenerateInputRequestedRegion() override;
94 
100  itkSetMacro(Order, unsigned int)
101  itkGetMacro(Order, unsigned int)
102 
103 
108  itkSetMacro(OutputSize, typename TOutputImage::SizeType)
109  itkGetMacro(OutputSize, typename TOutputImage::SizeType)
110 
117  itkSetMacro(OutputIndex, typename TOutputImage::IndexType)
118  itkGetMacro(OutputIndex, typename TOutputImage::IndexType)
119 
120 protected:
122  ~UpsampleImageFilter() override = default;
123 
134  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) override;
135 
136 private:
137  unsigned int m_Factors[ImageDimension];
138  unsigned int m_Order;
139  typename TOutputImage::SizeType m_OutputSize;
140  typename TOutputImage::IndexType m_OutputIndex;
141 
142  const itk::ImageRegionSplitterBase* GetImageRegionSplitter(void) const override;
144 };
145 
146 
147 } // end namespace rtk
148 
149 #ifndef rtk_MANUAL_INSTANTIATION
150 #include "rtkUpsampleImageFilter.hxx"
151 #endif
152 
153 #endif
Upsamples an image by the given factor for each dimension.
typename InputImageType::Pointer InputImagePointer
typename InputImageType::ConstPointer InputImageConstPointer
ImageBaseType::SizeType SizeType
ImageBaseType::IndexType IndexType
unsigned int ThreadIdType
typename OutputImageType::Pointer OutputImagePointer
typename TOutputImage::RegionType OutputImageRegionType
#define itkSetMacro(name, type)