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 
26 namespace itk::simple
27 {
28 
73 {
74 public:
76 
78  virtual ~ExtractImageFilter();
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 
128  typedef enum
129  {
134  } DirectionCollapseToStrategyType;
135 
160  SITK_RETURN_SELF_TYPE_HEADER
162  {
163  this->m_DirectionCollapseToStrategy = DirectionCollapseToStrategy;
164  return *this;
165  }
166 
169  DirectionCollapseToStrategyType
171  {
172  return this->m_DirectionCollapseToStrategy;
173  }
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 
195 private:
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 
224  DirectionCollapseToStrategyType m_DirectionCollapseToStrategy{
226  };
227 
228 
229  bool m_InPlace{ false };
230 };
231 
241 #ifndef SWIG
243 Extract(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
250 Extract(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
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
sitkBasicFilters.h
itk::Index
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOSUBMATRIX
@ DIRECTIONCOLLAPSETOSUBMATRIX
Definition: sitkExtractImageFilter.h:132
itk::simple::ExtractImageFilter::SetDirectionCollapseToStrategy
Self & SetDirectionCollapseToStrategy(DirectionCollapseToStrategyType DirectionCollapseToStrategy)
Set the strategy to be used to collapse physical space dimensions.
Definition: sitkExtractImageFilter.h:161
itk::Size
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:29
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOUNKOWN
@ DIRECTIONCOLLAPSETOUNKOWN
Definition: sitkExtractImageFilter.h:130
itk::simple::ExtractImageFilter::DirectionCollapseToStrategyType
DirectionCollapseToStrategyType
Definition: sitkExtractImageFilter.h:128
itk::simple::ExtractImageFilter::PixelIDTypeList
NonLabelPixelIDTypeList PixelIDTypeList
Definition: sitkExtractImageFilter.h:85
itk::simple::ExtractImageFilter::GetName
std::string GetName() const
Definition: sitkExtractImageFilter.h:177
sitkImageFilter.h
DirectionCollapseStrategy::DIRECTIONCOLLAPSETOGUESS
@ DIRECTIONCOLLAPSETOGUESS
SITK_MAX_DIMENSION
#define SITK_MAX_DIMENSION
Definition: sitkConfigure.h:30
itk::simple::ExtractImageFilter
Decrease the image size by cropping the image to the selected region bounds.
Definition: sitkExtractImageFilter.h:72
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOIDENTITY
@ DIRECTIONCOLLAPSETOIDENTITY
Definition: sitkExtractImageFilter.h:131
itk::simple::ExtractImageFilter::GetIndex
std::vector< int > GetIndex() const
Get the starting index to extract.
Definition: sitkExtractImageFilter.h:123
SITKBasicFilters_EXPORT
#define SITKBasicFilters_EXPORT
Definition: sitkBasicFilters.h:52
itk::simple::NonLabelPixelIDTypeList
typelist2::append< BasicPixelIDTypeList, ComplexPixelIDTypeList, VectorPixelIDTypeList >::type NonLabelPixelIDTypeList
Definition: sitkPixelIDTypeLists.h:180
itk::simple::ExtractImageFilter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkExtractImageFilter.h:205
itk::simple::ExtractImageFilter::SetIndex
Self & SetIndex(std::vector< int > Index)
Set the starting index of the input image to extract.
Definition: sitkExtractImageFilter.h:114
itk::simple::ExtractImageFilter::GetDirectionCollapseToStrategy
DirectionCollapseToStrategyType GetDirectionCollapseToStrategy() const
Definition: sitkExtractImageFilter.h:170
itk::simple::ExtractImageFilter::MemberFunctionType
Image(Self::*)(const Image &image1) MemberFunctionType
Definition: sitkExtractImageFilter.h:198
itk::simple::ExtractImageFilter::SetSize
Self & SetSize(std::vector< unsigned int > Size)
Set the size of the region to extract.
Definition: sitkExtractImageFilter.h:95
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOGUESS
@ DIRECTIONCOLLAPSETOGUESS
Definition: sitkExtractImageFilter.h:133
itk::simple::ImageFilter
The base interface for SimpleITK filters that take one input image.
Definition: sitkImageFilter.h:35
itk::Image
Definition: sitkPixelIDTypes.h:28
itk::simple::ExtractImageFilter::GetSize
std::vector< unsigned int > GetSize() const
Get the size of the region to extract.
Definition: sitkExtractImageFilter.h:104
itk::simple::Extract
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.
itk::simple
Definition: sitkAdditionalProcedures.h:28