RTK  2.5.0
Reconstruction Toolkit
rtkAverageOutOfROIImageFilter.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 #ifndef rtkAverageOutOfROIImageFilter_h
19 #define rtkAverageOutOfROIImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
22 
24 
25 #include "rtkMacro.h"
26 
27 namespace rtk
28 {
50 template <class TInputImage, class TROI = itk::Image<typename TInputImage::PixelType, TInputImage::ImageDimension - 1>>
51 
52 class ITK_TEMPLATE_EXPORT AverageOutOfROIImageFilter : public itk::InPlaceImageFilter<TInputImage, TInputImage>
53 {
54 public:
55  ITK_DISALLOW_COPY_AND_MOVE(AverageOutOfROIImageFilter);
56 
61  using LowerDimImage = itk::Image<typename TInputImage::PixelType, TInputImage::ImageDimension - 1>;
62 
64  itkNewMacro(Self);
65 
67 #ifdef itkOverrideGetNameOfClassMacro
68  itkOverrideGetNameOfClassMacro(AverageOutOfROIImageFilter);
69 #else
71 #endif
72 
73 
75  void
76  SetROI(const TROI * Map);
77 
78 protected:
80  ~AverageOutOfROIImageFilter() override = default;
81 
82  typename TROI::Pointer
83  GetROI();
84 
85  void
86  GenerateOutputInformation() override;
87  void
88  GenerateInputRequestedRegion() override;
89 
91  void
92  ThreadedGenerateData(const typename TInputImage::RegionType & outputRegionForThread,
93  itk::ThreadIdType itkNotUsed(threadId)) override;
94 
97  GetImageRegionSplitter() const override;
99 };
100 } // namespace rtk
101 
102 
103 #ifndef ITK_MANUAL_INSTANTIATION
104 # include "rtkAverageOutOfROIImageFilter.hxx"
105 #endif
106 
107 #endif
itk::ImageRegionSplitterDirection::Pointer m_Splitter
unsigned int ThreadIdType
Averages along the last dimension if the pixel is outside ROI.