SimpleITK  2.0.0
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 {
27  namespace simple {
28 
73  public:
75 
77  virtual ~ExtractImageFilter();
78 
82 
85 
93  SITK_RETURN_SELF_TYPE_HEADER SetSize ( std::vector<unsigned int> Size ) { this->m_Size = std::move(Size); return *this; }
94 
97  std::vector<unsigned int> GetSize() const { return this->m_Size; }
98 
103  SITK_RETURN_SELF_TYPE_HEADER SetIndex ( std::vector<int> Index ) { this->m_Index = std::move(Index); return *this; }
104 
107  std::vector<int> GetIndex() const { return this->m_Index; }
108 
109  typedef enum {DIRECTIONCOLLAPSETOUNKOWN,DIRECTIONCOLLAPSETOIDENTITY,DIRECTIONCOLLAPSETOSUBMATRIX,DIRECTIONCOLLAPSETOGUESS} DirectionCollapseToStrategyType;
110 
135  SITK_RETURN_SELF_TYPE_HEADER SetDirectionCollapseToStrategy ( DirectionCollapseToStrategyType DirectionCollapseToStrategy ) { this->m_DirectionCollapseToStrategy = DirectionCollapseToStrategy; return *this; }
136 
139  DirectionCollapseToStrategyType GetDirectionCollapseToStrategy() const { return this->m_DirectionCollapseToStrategy; }
140 
142  std::string GetName() const { return "ExtractImageFilter"; }
143 
145  std::string ToString() const;
146 
147 
149 #ifndef SWIG
150  Image Execute ( Image&& image1 );
151 #endif
152  Image Execute ( const Image& image1 );
153 
154  private:
155 
158  using MemberFunctionType = Image (Self::*)( const Image& image1 );
159  template <class TImageType> Image ExecuteInternal ( const Image& image1 );
160 
162 
163  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
164 
165 
166  template <class TImageType, unsigned int OutputDimension>
167  Image ExecuteInternal ( const TImageType *image1, unsigned int outputDimension, std::integral_constant<unsigned int, OutputDimension> meta );
168  template <class TImageType>
169  Image ExecuteInternal ( const TImageType *image1, unsigned int outputDimension, std::integral_constant<unsigned int, 1> meta );
170 
171 
172  std::vector<unsigned int> m_Size{std::vector<unsigned int>(SITK_MAX_DIMENSION, 1)};
173 
174  std::vector<int> m_Index{std::vector<int>(SITK_MAX_DIMENSION, 0)};
175 
177 
178 
179  bool m_InPlace{false};
180  };
181 
191 #ifndef SWIG
192  SITKBasicFilters_EXPORT 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 );
193 #endif
194  SITKBasicFilters_EXPORT Image Extract ( const 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 );
195 
197  }
198 }
199 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:75
sitkBasicFilters.h
itk::Index
itk::simple::ExtractImageFilter::SetDirectionCollapseToStrategy
Self & SetDirectionCollapseToStrategy(DirectionCollapseToStrategyType DirectionCollapseToStrategy)
Set the strategy to be used to collapse physical space dimensions.
Definition: sitkExtractImageFilter.h:135
itk::Size
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:32
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOUNKOWN
@ DIRECTIONCOLLAPSETOUNKOWN
Definition: sitkExtractImageFilter.h:109
itk::simple::NonLabelPixelIDTypeList
typelist::Append< typelist::Append< BasicPixelIDTypeList, ComplexPixelIDTypeList >::Type, VectorPixelIDTypeList >::Type NonLabelPixelIDTypeList
Definition: sitkPixelIDTypeLists.h:180
itk::simple::ExtractImageFilter::DirectionCollapseToStrategyType
DirectionCollapseToStrategyType
Definition: sitkExtractImageFilter.h:109
itk::simple::ExtractImageFilter::PixelIDTypeList
NonLabelPixelIDTypeList PixelIDTypeList
Definition: sitkExtractImageFilter.h:84
itk::simple::ExtractImageFilter::GetName
std::string GetName() const
Definition: sitkExtractImageFilter.h:142
sitkImageFilter.h
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::GetIndex
std::vector< int > GetIndex() const
Get the starting index to extract.
Definition: sitkExtractImageFilter.h:107
itk::simple::ExtractImageFilter::MemberFunctionType
Image(Self::*)(const Image &image1) MemberFunctionType
Definition: sitkExtractImageFilter.h:158
SITKBasicFilters_EXPORT
#define SITKBasicFilters_EXPORT
Definition: sitkBasicFilters.h:52
itk::simple::ExtractImageFilter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkExtractImageFilter.h:163
itk::simple::ExtractImageFilter::SetIndex
Self & SetIndex(std::vector< int > Index)
Set the starting index of the input image to extract.
Definition: sitkExtractImageFilter.h:103
itk::simple::ExtractImageFilter::GetDirectionCollapseToStrategy
DirectionCollapseToStrategyType GetDirectionCollapseToStrategy() const
Definition: sitkExtractImageFilter.h:139
itk::simple::ExtractImageFilter::SetSize
Self & SetSize(std::vector< unsigned int > Size)
Set the size of the region to extract.
Definition: sitkExtractImageFilter.h:93
itk
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOGUESS
@ DIRECTIONCOLLAPSETOGUESS
Definition: sitkExtractImageFilter.h:109
itk::simple::ImageFilter
The base interface for SimpleITK filters that take one input image.
Definition: sitkImageFilter.h:36
itk::Image
Definition: sitkPixelIDTypes.h:26
itk::simple::ExtractImageFilter::GetSize
std::vector< unsigned int > GetSize() const
Get the size of the region to extract.
Definition: sitkExtractImageFilter.h:97
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.