RTK  2.5.0
Reconstruction Toolkit
rtkSubSelectImageFilter.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 rtkSubSelectImageFilter_h
19 #define rtkSubSelectImageFilter_h
20 
21 #include <itkPasteImageFilter.h>
22 #include <itkExtractImageFilter.h>
23 #include "rtkConstantImageSource.h"
25 
26 namespace rtk
27 {
28 
63 template <typename ProjectionStackType>
64 class ITK_TEMPLATE_EXPORT SubSelectImageFilter
65  : public itk::ImageToImageFilter<ProjectionStackType, ProjectionStackType>
66 {
67 public:
68  ITK_DISALLOW_COPY_AND_MOVE(SubSelectImageFilter);
69 
74 
76 #ifdef itkOverrideGetNameOfClassMacro
77  itkOverrideGetNameOfClassMacro(SubSelectImageFilter);
78 #else
80 #endif
81 
82 
84  void
85  SetInputProjectionStack(const ProjectionStackType * Projections);
86  typename ProjectionStackType::ConstPointer
87  GetInputProjectionStack();
89 
94 
95  itkSetObjectMacro(InputGeometry, GeometryType);
96  itkGetModifiableObjectMacro(InputGeometry, GeometryType);
97 
98  itkGetMacro(SelectedProjections, std::vector<bool>);
99 
101  GetOutputGeometry();
102 
103 protected:
105  ~SubSelectImageFilter() override = default;
106 
108  void
109  VerifyPreconditions() ITKv5_CONST override;
110 
111  void
112  GenerateInputRequestedRegion() override;
113 
114  void
115  GenerateOutputInformation() override;
116 
118  void
119  GenerateData() override;
120 
122  GeometryType::Pointer m_InputGeometry;
123  GeometryType::Pointer m_OutputGeometry;
124  std::vector<bool> m_SelectedProjections;
125  int m_NbSelectedProjs;
126 
127 private:
128  typename EmptyProjectionStackSourceType::Pointer m_EmptyProjectionStackSource;
129  typename ExtractFilterType::Pointer m_ExtractFilter;
130  typename PasteFilterType::Pointer m_PasteFilter;
131 };
132 } // namespace rtk
133 
134 
135 #ifndef ITK_MANUAL_INSTANTIATION
136 # include "rtkSubSelectImageFilter.hxx"
137 #endif
138 
139 #endif
Generate an n-dimensional image with constant pixel values.
Subselects projections from a stack of projections.
STL namespace.
Projection geometry for a source and a 2-D flat panel.