DGtal  1.0.0
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 #if defined(__GNUG__)
51 #pragma GCC diagnostic push
52 #pragma GCC diagnostic ignored "-Wpedantic"
53 #endif
54 #if defined(__clang__)
55 #pragma clang diagnostic push
56 #pragma clang diagnostic ignored "-Wdocumentation"
57 #endif
58 #include <itkImageFileReader.h>
59 #if defined(__clang__)
60 #pragma clang diagnostic pop
61 #endif
62 #if defined(__GNUG__)
63 #pragma GCC diagnostic pop
64 #endif
65 
66 namespace DGtal
67 {
68 
77  template <typename TImage>
78  struct ITKReader
79  {
80  typedef TImage Image;
81  typedef typename TImage::Value Value;
83 
85  BOOST_STATIC_ASSERT(( (TImage::Domain::dimension == 3) || (TImage::Domain::dimension == 2) ));
86 
101  template <typename TFunctor =
103  static Image importITK(
104  const std::string & filename,
105  const TFunctor & aFunctor = TFunctor() );
106 
114  static itk::ImageIOBase::IOComponentType
115  getITKComponentType( const std::string & filename );
116 
117  private:
128  template <typename TypeDGtalImage, typename TFunctor>
130  const std::string & filename,
131  const TFunctor & aFunctor );
132  };
133 }//namespace
134 
136 // Includes inline functions.
137 #include "DGtal/io/readers/ITKReader.ih"
138 
139 // //
141 
142 #endif // !defined ITKReader_h
143 
144 #undef ITKReader_RECURSES
145 #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:78
DGtal is the top-level namespace which contains all DGtal functions and types.
ITKIOTrait< Value >::ValueOut ValueOut
Definition: ITKReader.h:82
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:81