SimpleITK  
sitkExtractImageFilter.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 * 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#ifndef sitkExtractImageFilter_h
19#define sitkExtractImageFilter_h
20
21#include <memory>
22
23#include "sitkBasicFilters.h"
24#include "sitkImageFilter.h"
25
26namespace itk::simple
27{
28
73{
74public:
76
79
83
86
94 void
95 SetSize(std::vector<unsigned int> Size)
96 {
97 this->m_Size = std::move(Size);
98 }
99
102 std::vector<unsigned int>
103 GetSize() const
104 {
105 return this->m_Size;
106 }
107
112 void
113 SetIndex(std::vector<int> Index)
114 {
115 this->m_Index = std::move(Index);
116 }
117
120 std::vector<int>
121 GetIndex() const
122 {
123 return this->m_Index;
124 }
125
133
158 void
160 {
161 this->m_DirectionCollapseToStrategy = DirectionCollapseToStrategy;
162 }
163
166 DirectionCollapseToStrategyType
171
173 std::string
174 GetName() const
175 {
176 return "ExtractImageFilter";
177 }
178
180 std::string
181 ToString() const;
182
183
185#ifndef SWIG
186 Image
187 Execute(Image && image1);
188#endif
189 Image
190 Execute(const Image & image1);
191
192private:
194
195 using MemberFunctionType = Image (Self::*)(const Image & image1);
196 template <class TImageType>
197 Image
198 ExecuteInternal(const Image & image1);
199
201
204
205 template <class TImageType, unsigned int OutputDimension>
206 Image
207 ExecuteInternal(const TImageType * image1,
208 unsigned int outputDimension,
209 std::integral_constant<unsigned int, OutputDimension> meta);
210 template <class TImageType>
211 Image
212 ExecuteInternal(const TImageType * image1,
213 unsigned int outputDimension,
214 std::integral_constant<unsigned int, 1> meta);
215
216
217 std::vector<unsigned int> m_Size{ std::vector<unsigned int>(SITK_MAX_DIMENSION, 1) };
218
219 std::vector<int> m_Index{ std::vector<int>(SITK_MAX_DIMENSION, 0) };
220
224
225
226 bool m_InPlace{ false };
227};
228
238#ifndef SWIG
240Extract(Image && image1,
241 std::vector<unsigned int> size = std::vector<unsigned int>(SITK_MAX_DIMENSION, 1),
242 std::vector<int> index = std::vector<int>(SITK_MAX_DIMENSION, 0),
243 ExtractImageFilter::DirectionCollapseToStrategyType directionCollapseToStrategy =
245#endif
247Extract(const Image & image1,
248 std::vector<unsigned int> size = std::vector<unsigned int>(SITK_MAX_DIMENSION, 1),
249 std::vector<int> index = std::vector<int>(SITK_MAX_DIMENSION, 0),
250 ExtractImageFilter::DirectionCollapseToStrategyType directionCollapseToStrategy =
252
254} // namespace itk::simple
255#endif
NonLabelPixelIDTypeList PixelIDTypeList
std::vector< unsigned int > GetSize() const
Get the size of the region to extract.
Image Execute(const Image &image1)
Image ExecuteInternal(const Image &image1)
Image Execute(Image &&image1)
DirectionCollapseToStrategyType GetDirectionCollapseToStrategy() const
void SetSize(std::vector< unsigned int > Size)
Set the size of the region to extract.
Image(Self::*)(const Image &image1) MemberFunctionType
std::vector< int > GetIndex() const
Get the starting index to extract.
void SetIndex(std::vector< int > Index)
Set the starting index of the input image to extract.
Image ExecuteInternal(const TImageType *image1, unsigned int outputDimension, std::integral_constant< unsigned int, OutputDimension > meta)
static const detail::MemberFunctionFactory< MemberFunctionType > & GetMemberFunctionFactory()
std::string ToString() const
DirectionCollapseToStrategyType m_DirectionCollapseToStrategy
void SetDirectionCollapseToStrategy(DirectionCollapseToStrategyType DirectionCollapseToStrategy)
Set the strategy to be used to collapse physical space dimensions.
Image ExecuteInternal(const TImageType *image1, unsigned int outputDimension, std::integral_constant< unsigned int, 1 > meta)
std::vector< unsigned int > m_Size
The Image class for SimpleITK.
Definition sitkImage.h:77
A class used to instantiate and generate function object to templated member functions.
typelist2::append< BasicPixelIDTypeList, ComplexPixelIDTypeList, VectorPixelIDTypeList >::type NonLabelPixelIDTypeList
Image Extract(Image &&image1, std::vector< unsigned int > size=std::vector< unsigned int >(SITK_MAX_DIMENSION, 1), std::vector< int > index=std::vector< int >(SITK_MAX_DIMENSION, 0), ExtractImageFilter::DirectionCollapseToStrategyType directionCollapseToStrategy=itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOGUESS)
Decrease the image size by cropping the image to the selected region bounds.
#define SITKBasicFilters_EXPORT
#define SITK_MAX_DIMENSION