SimpleITK  1.0.1
sitkImportImageFilter.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 sitkImportImageFilter_h
19 #define sitkImportImageFilter_h
20 
21 #include "sitkMacro.h"
22 #include "sitkImage.h"
23 #include "sitkImageReaderBase.h"
25 
26 namespace itk {
27  namespace simple {
28 
48  : public ImageReaderBase {
49  public:
51 
53 
55  virtual std::string ToString() const;
56 
58  virtual std::string GetName() const { return std::string("ImportImageFilter"); }
59 
60  SITK_RETURN_SELF_TYPE_HEADER SetSize( const std::vector< unsigned int > &size );
61  const std::vector< unsigned int > &GetSize( ) const;
62 
63  SITK_RETURN_SELF_TYPE_HEADER SetSpacing( const std::vector< double > &spacing );
64  const std::vector< double > &GetSpacing( ) const;
65 
66  SITK_RETURN_SELF_TYPE_HEADER SetOrigin( const std::vector< double > &origin );
67  const std::vector< double > &GetOrigin( ) const;
68 
69  SITK_RETURN_SELF_TYPE_HEADER SetDirection( const std::vector< double > &direction );
70  const std::vector< double > &GetDirection( ) const;
71 
72  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsInt8( int8_t * buffer, unsigned int numberOfComponents = 1 );
73  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt8( uint8_t * buffer, unsigned int numberOfComponents = 1 );
74  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsInt16( int16_t * buffer, unsigned int numberOfComponents = 1 );
75  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt16( uint16_t * buffer, unsigned int numberOfComponents = 1 );
76  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsInt32( int32_t * buffer, unsigned int numberOfComponents = 1 );
77  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt32( uint32_t * buffer, unsigned int numberOfComponents = 1 );
78  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsInt64( int64_t * buffer, unsigned int numberOfComponents = 1 );
79  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt64( uint64_t * buffer, unsigned int numberOfComponents = 1 );
80  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsFloat( float * buffer, unsigned int numberOfComponents = 1 );
81  SITK_RETURN_SELF_TYPE_HEADER SetBufferAsDouble( double * buffer, unsigned int numberOfComponents = 1 );
82 
83  Image Execute();
84 
85  protected:
86 
87  // Internal method called the the template dispatch system
88  template <class TImageType> Image ExecuteInternal ( void );
89 
90  // If the output image type is a VectorImage then the number of
91  // components per pixel needs to be set, otherwise the method
92  // does not exist. This is done with the EnableIf Idiom.
93  template <class TImageType>
95  SetNumberOfComponentsOnImage( TImageType* ) {}
96  template <class TImageType>
98  SetNumberOfComponentsOnImage( TImageType* );
99 
100  private:
101 
102  // function pointer type
103  typedef Image (Self::*MemberFunctionType)( void );
104 
105  // friend to get access to executeInternal member
106  friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
107  nsstd::auto_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
108 
111 
112  std::vector< double > m_Origin;
113  std::vector< double > m_Spacing;
114  std::vector< unsigned int > m_Size;
115  std::vector< double > m_Direction;
116 
117  void * m_Buffer;
118 
119  };
120 
122  int8_t * buffer,
123  const std::vector< unsigned int > &size,
124  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
125  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
126  const std::vector< double > &direction = std::vector< double >(),
127  unsigned int numberOfComponents = 1
128  );
129 
131  uint8_t * buffer,
132  const std::vector< unsigned int > &size,
133  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
134  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
135  const std::vector< double > &direction = std::vector< double >(),
136  unsigned int numberOfComponents = 1
137  );
138 
140  int16_t * buffer,
141  const std::vector< unsigned int > &size,
142  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
143  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
144  const std::vector< double > &direction = std::vector< double >(),
145  unsigned int numberOfComponents = 1
146  );
147 
149  uint16_t * buffer,
150  const std::vector< unsigned int > &size,
151  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
152  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
153  const std::vector< double > &direction = std::vector< double >(),
154  unsigned int numberOfComponents = 1
155  );
156 
158  int32_t * buffer,
159  const std::vector< unsigned int > &size,
160  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
161  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
162  const std::vector< double > &direction = std::vector< double >(),
163  unsigned int numberOfComponents = 1
164  );
165 
167  uint32_t * buffer,
168  const std::vector< unsigned int > &size,
169  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
170  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
171  const std::vector< double > &direction = std::vector< double >(),
172  unsigned int numberOfComponents = 1
173  );
174 
176  int64_t * buffer,
177  const std::vector< unsigned int > &size,
178  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
179  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
180  const std::vector< double > &direction = std::vector< double >(),
181  unsigned int numberOfComponents = 1
182  );
183 
185  uint64_t * buffer,
186  const std::vector< unsigned int > &size,
187  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
188  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
189  const std::vector< double > &direction = std::vector< double >(),
190  unsigned int numberOfComponents = 1
191  );
192 
194  float * buffer,
195  const std::vector< unsigned int > &size,
196  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
197  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
198  const std::vector< double > &direction = std::vector< double >(),
199  unsigned int numberOfComponents = 1
200  );
201 
203  double * buffer,
204  const std::vector< unsigned int > &size,
205  const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ),
206  const std::vector< double > &origin = std::vector< double >( 3, 0.0 ),
207  const std::vector< double > &direction = std::vector< double >(),
208  unsigned int numberOfComponents = 1
209  );
210 
211  }
212 }
213 
214 #endif
An abract base class for image readers.
Image SITKIO_EXPORT ImportAsFloat(float *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
Image SITKIO_EXPORT ImportAsDouble(double *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
Image SITKIO_EXPORT ImportAsInt8(int8_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
Image SITKIO_EXPORT ImportAsUInt8(uint8_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
Image SITKIO_EXPORT ImportAsInt64(int64_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
virtual std::string GetName() const
::uint8_t uint8_t
nsstd::auto_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Image SITKIO_EXPORT ImportAsInt16(int16_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
std::vector< unsigned int > m_Size
::uint16_t uint16_t
#define SITKIO_EXPORT
Definition: sitkIO.h:34
::uint32_t uint32_t
The main Image class for SimpleITK.
Definition: sitkImage.h:54
DisableIf< IsVector< TImageType >::Value >::Type SetNumberOfComponentsOnImage(TImageType *)
Image SITKIO_EXPORT ImportAsUInt16(uint16_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
::int64_t int64_t
Image SITKIO_EXPORT ImportAsInt32(int32_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
Image SITKIO_EXPORT ImportAsUInt32(uint32_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
Compose a 2D or 3D image and return a smart pointer to a SimpleITK image.
::int8_t int8_t
Image SITKIO_EXPORT ImportAsUInt64(uint64_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
::int32_t int32_t
::uint64_t uint64_t
::int16_t int16_t