ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkExtractImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 itkExtractImageFilter_h
19#define itkExtractImageFilter_h
20
22#include "itkSmartPointer.h"
25#include "ITKCommonExport.h"
26
27namespace itk
28{
29
91
92template <typename TInputImage, typename TOutputImage>
93class ITK_TEMPLATE_EXPORT ExtractImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
94{
95public:
96 ITK_DISALLOW_COPY_AND_MOVE(ExtractImageFilter);
97
103
105 itkNewMacro(Self);
106
108 itkOverrideGetNameOfClassMacro(ExtractImageFilter);
109
111 using InputImageType = TInputImage;
112 using OutputImageType = TOutputImage;
113
115 using OutputImageRegionType = typename TOutputImage::RegionType;
116 using InputImageRegionType = typename TInputImage::RegionType;
117
119 using OutputImagePixelType = typename TOutputImage::PixelType;
120 using InputImagePixelType = typename TInputImage::PixelType;
121
123 using OutputImageIndexType = typename TOutputImage::IndexType;
124 using InputImageIndexType = typename TInputImage::IndexType;
125 using OutputImageSizeType = typename TOutputImage::SizeType;
126 using InputImageSizeType = typename TInputImage::SizeType;
127
130#if !defined(ITK_LEGACY_REMOVE)
131 using DIRECTIONCOLLAPSESTRATEGY = DirectionCollapseStrategyEnum;
132 // We need to expose the enum values at the class level
133 // for backwards compatibility
134 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOUNKOWN =
135 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOUNKOWN;
136 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOIDENTITY =
137 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOIDENTITY;
138 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOSUBMATRIX =
139 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOSUBMATRIX;
140 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOGUESS =
141 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOGUESS;
142#endif
143
168 void
170 {
171 switch (choosenStrategy)
172 {
173 case DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOGUESS:
174 case DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOIDENTITY:
175 case DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOSUBMATRIX:
176 break;
177 case DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOUNKOWN:
178 default:
179 itkExceptionStringMacro("Invalid Strategy Chosen for itk::ExtractImageFilter");
180 }
181
182 this->m_DirectionCollapseStrategy = choosenStrategy;
183 this->Modified();
184 }
185
190
194 [[nodiscard]] DirectionCollapseStrategyEnum
196 {
197 return this->m_DirectionCollapseStrategy;
198 }
199
201 void
203 {
204 this->SetDirectionCollapseToStrategy(DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOGUESS);
205 }
206
208 void
210 {
211 this->SetDirectionCollapseToStrategy(DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOIDENTITY);
212 }
213
215 void
217 {
218 this->SetDirectionCollapseToStrategy(DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOSUBMATRIX);
219 }
220
221
223 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
224 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
225
228
235 void
237 itkGetConstMacro(ExtractionRegion, InputImageRegionType);
240
241protected:
243 ~ExtractImageFilter() override = default;
244 void
245 PrintSelf(std::ostream & os, Indent indent) const override;
246
255 void
257
268 void
270 const OutputImageRegionType & srcRegion) override;
271
281 void
282 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
283
286 void
287 GenerateData() override;
288
290
292
293private:
294 DirectionCollapseStrategyEnum m_DirectionCollapseStrategy{ DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOUNKOWN };
295};
296
297} // end namespace itk
298
299#ifndef ITK_MANUAL_INSTANTIATION
300# include "itkExtractImageFilter.hxx"
301#endif
302
303#endif
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void GenerateData() override
void CallCopyOutputRegionToInputRegion(InputImageRegionType &destRegion, const OutputImageRegionType &srcRegion) override
void SetDirectionCollapseToStrategy(const DirectionCollapseStrategyEnum choosenStrategy)
void PrintSelf(std::ostream &os, Indent indent) const override
DirectionCollapseStrategyEnum m_DirectionCollapseStrategy
typename TOutputImage::IndexType OutputImageIndexType
typename TInputImage::IndexType InputImageIndexType
typename TOutputImage::PixelType OutputImagePixelType
typename TOutputImage::SizeType OutputImageSizeType
void GenerateOutputInformation() override
typename TInputImage::SizeType InputImageSizeType
ImageToImageFilterDetail::ExtractImageFilterRegionCopier< Self::InputImageDimension, Self::OutputImageDimension > ExtractImageFilterRegionCopierType
typename TOutputImage::RegionType OutputImageRegionType
ExtractImageFilterEnums::DirectionCollapseStrategy DirectionCollapseStrategyEnum
DirectionCollapseStrategyEnum GetDirectionCollapseToStrategy() const
void SetExtractionRegion(InputImageRegionType extractRegion)
typename TInputImage::PixelType InputImagePixelType
typename TInputImage::RegionType InputImageRegionType
InPlaceImageFilter< TInputImage, TOutputImage > Superclass
~ExtractImageFilter() override=default
SmartPointer< const Self > ConstPointer
A special variation of ImageRegionCopier for when the output image has fewer dimensions than the inpu...
Control indentation during Print() invocation.
Definition itkIndent.h:53
virtual void Modified() const
Implements transparent reference counting.
#define itkConceptMacro(name, conceptType)
Compile-time check that a template argument satisfies an itk::Concept.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....