DGtal  0.9.4.1
ITKReader.h
1 
17 #pragma once
18 
35 #if defined(ITKReader_RECURSES)
36 #error Recursive header files inclusion detected in ITKReader.h
37 #else // defined(ITKReader_RECURSES)
38 
39 #define ITKReader_RECURSES
40 
41 #if !defined ITKReader_h
42 
43 #define ITKReader_h
44 
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/CUnaryFunctor.h"
47 #include "DGtal/images/CImage.h"
48 #include "DGtal/base/BasicFunctors.h"
49 #include "DGtal/io/ITKIOTrait.h"
50 #include <itkImageFileReader.h>
51 
52 namespace DGtal
53 {
54 
63  template <typename TImage>
64  struct ITKReader
65  {
66  typedef TImage Image;
67  typedef typename TImage::Value Value;
69 
71  BOOST_STATIC_ASSERT(( (TImage::Domain::dimension == 3) || (TImage::Domain::dimension == 2) ));
72 
87  template <typename TFunctor =
89  static Image importITK(
90  const std::string & filename,
91  const TFunctor & aFunctor = TFunctor() );
92 
100  static itk::ImageIOBase::IOComponentType
101  getITKComponentType( const std::string & filename );
102 
103  private:
114  template <typename TypeDGtalImage, typename TFunctor>
116  const std::string & filename,
117  const TFunctor & aFunctor );
118  };
119 }//namespace
120 
122 // Includes inline functions.
123 #include "DGtal/io/readers/ITKReader.ih"
124 
125 // //
127 
128 #endif // !defined ITKReader_h
129 
130 #undef ITKReader_RECURSES
131 #endif // else defined(ITKReader_RECURSES)
static Image readDGtalImageFromITKtypes(const std::string &filename, const TFunctor &aFunctor)
Aim: Define a simple functor using the static cast operator.
static Image importITK(const std::string &filename, const TFunctor &aFunctor=TFunctor())
Aim: Import a 2D/3D Image using the ITK formats.
Definition: ITKReader.h:64
DGtal is the top-level namespace which contains all DGtal functions and types.
ITKIOTrait< Value >::ValueOut ValueOut
Definition: ITKReader.h:68
BOOST_STATIC_ASSERT(((TImage::Domain::dimension==3)||(TImage::Domain::dimension==2)))
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:102
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
static itk::ImageIOBase::IOComponentType getITKComponentType(const std::string &filename)
TImage::Value Value
Definition: ITKReader.h:67