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 
72  public:
74 
76  virtual ~ExtractImageFilter();
77 
81 
84 
92  SITK_RETURN_SELF_TYPE_HEADER SetSize ( std::vector<unsigned int> Size ) { this->m_Size = std::move(Size); return *this; }
93 
96  std::vector<unsigned int> GetSize() const { return this->m_Size; }
97 
102  SITK_RETURN_SELF_TYPE_HEADER SetIndex ( std::vector<int> Index ) { this->m_Index = std::move(Index); return *this; }
103 
106  std::vector<int> GetIndex() const { return this->m_Index; }
107 
108  typedef enum {DIRECTIONCOLLAPSETOUNKOWN,DIRECTIONCOLLAPSETOIDENTITY,DIRECTIONCOLLAPSETOSUBMATRIX,DIRECTIONCOLLAPSETOGUESS} DirectionCollapseToStrategyType;
109 
134  SITK_RETURN_SELF_TYPE_HEADER SetDirectionCollapseToStrategy ( DirectionCollapseToStrategyType DirectionCollapseToStrategy ) { this->m_DirectionCollapseToStrategy = DirectionCollapseToStrategy; return *this; }
135 
138  DirectionCollapseToStrategyType GetDirectionCollapseToStrategy() const { return this->m_DirectionCollapseToStrategy; }
139 
141  std::string GetName() const { return "ExtractImageFilter"; }
142 
144  std::string ToString() const;
145 
146 
148 #ifndef SWIG
149  Image Execute ( Image&& image1 );
150 #endif
151  Image Execute ( const Image& image1 );
152 
153  private:
154 
157  using MemberFunctionType = Image (Self::*)( const Image& image1 );
158  template <class TImageType> Image ExecuteInternal ( const Image& image1 );
159 
161 
162  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
163 
164 
165  template <class TImageType, unsigned int OutputDimension>
166  Image ExecuteInternal ( const TImageType *image1, unsigned int outputDimension, std::integral_constant<unsigned int, OutputDimension> meta );
167  template <class TImageType>
168  Image ExecuteInternal ( const TImageType *image1, unsigned int outputDimension, std::integral_constant<unsigned int, 1> meta );
169 
170 
171  std::vector<unsigned int> m_Size{std::vector<unsigned int>(SITK_MAX_DIMENSION, 1)};
172 
173  std::vector<int> m_Index{std::vector<int>(SITK_MAX_DIMENSION, 0)};
174 
176 
177 
178  bool m_InPlace{false};
179  };
180 
190 #ifndef SWIG
191  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 );
192 #endif
193  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 );
194 
196  }
197 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
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:134
itk::Size
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:28
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOUNKOWN
@ DIRECTIONCOLLAPSETOUNKOWN
Definition: sitkExtractImageFilter.h:108
itk::simple::ExtractImageFilter::DirectionCollapseToStrategyType
DirectionCollapseToStrategyType
Definition: sitkExtractImageFilter.h:108
itk::simple::ExtractImageFilter::PixelIDTypeList
NonLabelPixelIDTypeList PixelIDTypeList
Definition: sitkExtractImageFilter.h:83
itk::simple::ExtractImageFilter::GetName
std::string GetName() const
Definition: sitkExtractImageFilter.h:141
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:71
itk::simple::ExtractImageFilter::GetIndex
std::vector< int > GetIndex() const
Get the starting index to extract.
Definition: sitkExtractImageFilter.h:106
itk::simple::ExtractImageFilter::MemberFunctionType
Image(Self::*)(const Image &image1) MemberFunctionType
Definition: sitkExtractImageFilter.h:157
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:162
itk::simple::ExtractImageFilter::SetIndex
Self & SetIndex(std::vector< int > Index)
Set the starting index of the input image to extract.
Definition: sitkExtractImageFilter.h:102
itk::simple::ExtractImageFilter::GetDirectionCollapseToStrategy
DirectionCollapseToStrategyType GetDirectionCollapseToStrategy() const
Definition: sitkExtractImageFilter.h:138
itk::simple::ExtractImageFilter::SetSize
Self & SetSize(std::vector< unsigned int > Size)
Set the size of the region to extract.
Definition: sitkExtractImageFilter.h:92
itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOGUESS
@ DIRECTIONCOLLAPSETOGUESS
Definition: sitkExtractImageFilter.h:108
itk::simple::ImageFilter
The base interface for SimpleITK filters that take one input image.
Definition: sitkImageFilter.h:34
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:96
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