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 SITK_RETURN_SELF_TYPE_HEADER
95 SetSize(std::vector<unsigned int> Size)
96 {
97 this->m_Size = std::move(Size);
98 return *this;
99 }
100
103 std::vector<unsigned int>
104 GetSize() const
105 {
106 return this->m_Size;
107 }
108
113 SITK_RETURN_SELF_TYPE_HEADER
114 SetIndex(std::vector<int> Index)
115 {
116 this->m_Index = std::move(Index);
117 return *this;
118 }
119
122 std::vector<int>
123 GetIndex() const
124 {
125 return this->m_Index;
126 }
127
135
160 SITK_RETURN_SELF_TYPE_HEADER
162 {
163 this->m_DirectionCollapseToStrategy = DirectionCollapseToStrategy;
164 return *this;
165 }
166
169 DirectionCollapseToStrategyType
174
176 std::string
177 GetName() const
178 {
179 return "ExtractImageFilter";
180 }
181
183 std::string
184 ToString() const;
185
186
188#ifndef SWIG
189 Image
190 Execute(Image && image1);
191#endif
192 Image
193 Execute(const Image & image1);
194
195private:
197
198 using MemberFunctionType = Image (Self::*)(const Image & image1);
199 template <class TImageType>
200 Image
201 ExecuteInternal(const Image & image1);
202
204
205 std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType>> m_MemberFactory;
206
207
208 template <class TImageType, unsigned int OutputDimension>
209 Image
210 ExecuteInternal(const TImageType * image1,
211 unsigned int outputDimension,
212 std::integral_constant<unsigned int, OutputDimension> meta);
213 template <class TImageType>
214 Image
215 ExecuteInternal(const TImageType * image1,
216 unsigned int outputDimension,
217 std::integral_constant<unsigned int, 1> meta);
218
219
220 std::vector<unsigned int> m_Size{ std::vector<unsigned int>(SITK_MAX_DIMENSION, 1) };
221
222 std::vector<int> m_Index{ std::vector<int>(SITK_MAX_DIMENSION, 0) };
223
227
228
229 bool m_InPlace{ false };
230};
231
241#ifndef SWIG
243Extract(Image && image1,
244 std::vector<unsigned int> size = std::vector<unsigned int>(SITK_MAX_DIMENSION, 1),
245 std::vector<int> index = std::vector<int>(SITK_MAX_DIMENSION, 0),
246 ExtractImageFilter::DirectionCollapseToStrategyType directionCollapseToStrategy =
248#endif
250Extract(const Image & image1,
251 std::vector<unsigned int> size = std::vector<unsigned int>(SITK_MAX_DIMENSION, 1),
252 std::vector<int> index = std::vector<int>(SITK_MAX_DIMENSION, 0),
253 ExtractImageFilter::DirectionCollapseToStrategyType directionCollapseToStrategy =
255
257} // namespace itk::simple
258#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)
Self & SetDirectionCollapseToStrategy(DirectionCollapseToStrategyType DirectionCollapseToStrategy)
Set the strategy to be used to collapse physical space dimensions.
DirectionCollapseToStrategyType GetDirectionCollapseToStrategy() const
Image(Self::*)(const Image &image1) MemberFunctionType
std::vector< int > GetIndex() const
Get the starting index to extract.
Image ExecuteInternal(const TImageType *image1, unsigned int outputDimension, std::integral_constant< unsigned int, OutputDimension > meta)
std::string ToString() const
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Self & SetIndex(std::vector< int > Index)
Set the starting index of the input image to extract.
DirectionCollapseToStrategyType m_DirectionCollapseToStrategy
Self & SetSize(std::vector< unsigned int > Size)
Set the size of the region to extract.
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
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