SimpleITK  1.2.4
sitkCastImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
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 sitkCastImageFilter_h
19 #define sitkCastImageFilter_h
20 
21 #include "sitkImageFilter.h"
22 #include "sitkPixelIDTokens.h"
24 
25 #include <memory>
26 
27 namespace itk
28 {
29 namespace simple
30 {
31 
42  : public ImageFilter<1>
43 {
44 public:
46 
48  SITK_RETURN_SELF_TYPE_HEADER SetOutputPixelType( PixelIDValueEnum pixelID );
49  PixelIDValueEnum GetOutputPixelType( void ) const;
50 
51  virtual ~CastImageFilter();
52 
58 
60  std::string GetName() const { return std::string ("CastImageFilter"); }
61 
62  // See super class for doxygen
63  std::string ToString() const;
64 
65  // See super class for doxygen
66  Image Execute ( const Image & );
67 
68 private:
69 
71 
81  template<typename TImageType, typename TOutputImageType>
82  Image ExecuteInternalCast( const Image& inImage );
83 
84  template<typename TImageType, typename TOutputImageType>
85  Image ExecuteInternalToVector( const Image& inImage );
86 
87  template<typename TImageType, typename TOutputImageType>
88  Image ExecuteInternalToLabel( const Image& inImage );
89 
90  template<typename TImageType, typename TOutputImageType>
91  Image ExecuteInternalLabelToImage( const Image& inImage );
94 // SWIG does not appear to process private classes correctly
95 #ifndef SWIG
96 
100  template < class TMemberFunctionPointer >
102  {
103  typedef typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType ObjectType;
104 
105  template< typename TImageType1, typename TImageType2 >
106  TMemberFunctionPointer operator() ( void ) const
107  {
108  return &ObjectType::template ExecuteInternalCast< TImageType1, TImageType2 >;
109  }
110  };
111 
115  template < class TMemberFunctionPointer >
117  {
118  typedef typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType ObjectType;
119 
120  template< typename TImageType1, typename TImageType2 >
121  TMemberFunctionPointer operator() ( void ) const
122  {
123  return &ObjectType::template ExecuteInternalToVector< TImageType1, TImageType2 >;
124  }
125  };
126 
130  template < class TMemberFunctionPointer >
132  {
133  typedef typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType ObjectType;
134 
135  template< typename TImageType1, typename TImageType2 >
136  TMemberFunctionPointer operator() ( void ) const
137  {
138  return &ObjectType::template ExecuteInternalToLabel< TImageType1, TImageType2 >;
139  }
140  };
141 
145  template < class TMemberFunctionPointer >
147  {
148  typedef typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType ObjectType;
149 
150  template< typename TImageType1, typename TImageType2 >
151  TMemberFunctionPointer operator() ( void ) const
152  {
153  return &ObjectType::template ExecuteInternalLabelToImage< TImageType1, TImageType2 >;
154  }
155  };
156 #endif
157 
164  void RegisterMemberFactory2();
165  void RegisterMemberFactory2v();
166  void RegisterMemberFactory2l();
167  void RegisterMemberFactory3();
168  void RegisterMemberFactory3v();
169  void RegisterMemberFactory3l();
172  typedef Image (Self::*MemberFunctionType)( const Image& );
173  nsstd::auto_ptr<detail::DualMemberFunctionFactory<MemberFunctionType> > m_DualMemberFactory;
174 
175 };
176 
177  SITKBasicFilters_EXPORT Image Cast ( const Image& image, PixelIDValueEnum pixelID );
178 
179 }
180 }
181 #endif
#define SITKBasicFilters_EXPORT
::detail::FunctionTraits< TMemberFunctionPointer >::ClassType ObjectType
PixelIDValueEnum
Enumerated values of pixelIDs.
Image Cast(const Image &image, PixelIDValueEnum pixelID)
::detail::FunctionTraits< TMemberFunctionPointer >::ClassType ObjectType
::detail::FunctionTraits< TMemberFunctionPointer >::ClassType ObjectType
The Image class for SimpleITK.
Definition: sitkImage.h:78
nsstd::auto_ptr< detail::DualMemberFunctionFactory< MemberFunctionType > > m_DualMemberFactory
A hybrid cast image filter to convert images to other types of images.
::detail::FunctionTraits< TMemberFunctionPointer >::ClassType ObjectType
The base interface for SimpleITK filters that take one input image.