ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkTestingExtractSliceImageFilter.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 itkTestingExtractSliceImageFilter_h
19#define itkTestingExtractSliceImageFilter_h
20
21#include "itkSmartPointer.h"
22#include "itkImageSource.h"
24
25namespace itk::Testing
26{
45// Define how to print enumeration
46extern std::ostream &
48
102
103template <typename TInputImage, typename TOutputImage>
104class ITK_TEMPLATE_EXPORT ExtractSliceImageFilter : public ImageSource<TOutputImage>
105{
106public:
107 ITK_DISALLOW_COPY_AND_MOVE(ExtractSliceImageFilter);
108
114
116 itkNewMacro(Self);
117
119 itkOverrideGetNameOfClassMacro(ExtractSliceImageFilter);
120
122 using InputImageType = TInputImage;
123 using OutputImageType = TOutputImage;
124
126 using OutputImageRegionType = typename TOutputImage::RegionType;
127 using InputImageRegionType = typename TInputImage::RegionType;
128
130 using OutputImagePixelType = typename TOutputImage::PixelType;
131 using InputImagePixelType = typename TInputImage::PixelType;
132
134 using OutputImageIndexType = typename TOutputImage::IndexType;
135 using InputImageIndexType = typename TInputImage::IndexType;
136 using OutputImageSizeType = typename TOutputImage::SizeType;
137 using InputImageSizeType = typename TInputImage::SizeType;
138
144#if !defined(ITK_LEGACY_REMOVE)
145 // We need to expose the enum values at the class level
146 // for backwards compatibility
147 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOUNKOWN =
148 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOUNKOWN;
149 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOIDENTITY =
150 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOIDENTITY;
151 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOSUBMATRIX =
152 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOSUBMATRIX;
153 static constexpr DIRECTIONCOLLAPSESTRATEGY DIRECTIONCOLLAPSETOGUESS =
154 DIRECTIONCOLLAPSESTRATEGY::DIRECTIONCOLLAPSETOGUESS;
155#endif
156
181 void
183 {
184 switch (choosenStrategy)
185 {
186 case TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOGUESS:
187 case TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOIDENTITY:
188 case TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOSUBMATRIX:
189 break;
190 case TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOUNKOWN:
191 default:
192 itkExceptionMacro("Invalid Strategy Chosen for itk::ExtractSliceImageFilter");
193 }
194
195 this->m_DirectionCollaspeStrategy = choosenStrategy;
196 this->Modified();
197 }
198
203
207 [[nodiscard]] DIRECTIONCOLLAPSESTRATEGY
209 {
210 return this->m_DirectionCollaspeStrategy;
211 }
212
214 void
216 {
217 this->SetDirectionCollapseToStrategy(TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOGUESS);
218 }
219
221 void
223 {
224 this->SetDirectionCollapseToStrategy(TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOIDENTITY);
225 }
226
228 void
230 {
231 this->SetDirectionCollapseToStrategy(TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOSUBMATRIX);
232 }
233
234
236 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
237 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
238
241
247 void
249 itkGetConstMacro(ExtractionRegion, InputImageRegionType);
250
253 virtual void
254 SetInput(const TInputImage * input);
255 const TInputImage *
256 GetInput() const;
257
259
260protected:
262 ~ExtractSliceImageFilter() override = default;
263 void
264 PrintSelf(std::ostream & os, Indent indent) const override;
265
274 void
276
286 virtual void
288
297 void
298 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
299
301
303
304private:
306 TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOUNKOWN
307 };
308};
309} // namespace itk::Testing
310
311#ifndef ITK_MANUAL_INSTANTIATION
312# include "itkTestingExtractSliceImageFilter.hxx"
313#endif
314
315#endif
A special variation of ImageRegionCopier for when the output image has fewer dimensions than the inpu...
Control indentation during Print() invocation.
Definition itkIndent.h:50
virtual void Modified() const
virtual void SetInput(const DataObjectIdentifierType &key, DataObject *input)
Protected method for setting indexed and named inputs.
Implements transparent reference counting.
Contains all enum classes used by the ExtractSliceImageFilterEnums class.
~ExtractSliceImageFilter() override=default
ImageToImageFilterDetail::ExtractImageFilterRegionCopier< Self::InputImageDimension, Self::OutputImageDimension > ExtractSliceImageFilterRegionCopierType
void SetExtractionRegion(InputImageRegionType extractRegion)
TestExtractSliceImageFilterCollapseStrategyEnum DIRECTIONCOLLAPSESTRATEGY
void PrintSelf(std::ostream &os, Indent indent) const override
void SetDirectionCollapseToStrategy(const DIRECTIONCOLLAPSESTRATEGY choosenStrategy)
virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType &destRegion, const OutputImageRegionType &srcRegion)
ExtractSliceImageFilterEnums::TestExtractSliceImageFilterCollapseStrategy TestExtractSliceImageFilterCollapseStrategyEnum
virtual void SetInput(const TInputImage *input)
DIRECTIONCOLLAPSESTRATEGY GetDirectionCollapseToStrategy() const
typename TOutputImage::RegionType OutputImageRegionType
TestExtractSliceImageFilterCollapseStrategyEnum DirectionCollaspeStrategyEnum
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
const TInputImage * GetInput() const
#define itkConceptMacro(name, concept)
std::ostream & operator<<(std::ostream &out, const ExtractSliceImageFilterEnums::TestExtractSliceImageFilterCollapseStrategy value)