DGtal  1.5.beta
ITKDicomReader.h
1 
17 #pragma once
18 
31 #if defined(ITKDicomReader_RECURSES)
32 #error Recursive header files inclusion detected in ITKDicomReader.h
33 #else // defined(ITKDicomReader_RECURSES)
35 #define ITKDicomReader_RECURSES
36 
37 #if !defined ITKDicomReader_h
39 #define ITKDicomReader_h
40 
41 #include "DGtal/base/Common.h"
42 #include "DGtal/base/CUnaryFunctor.h"
43 #include "DGtal/images/CImage.h"
44 #include "DGtal/io/ITKIOTrait.h"
45 #include "DGtal/images/ImageContainerByITKImage.h"
46 #if defined(__GNUG__)
47 #pragma GCC diagnostic push
48 #pragma GCC diagnostic ignored "-Wpedantic"
49 #endif
50 #if defined(__clang__)
51 #pragma clang diagnostic push
52 #pragma clang diagnostic ignored "-Wdocumentation"
53 #endif
54 #include <itkImageFileReader.h>
55 #if defined(__clang__)
56 #pragma clang diagnostic pop
57 #endif
58 #if defined(__GNUG__)
59 #pragma GCC diagnostic pop
60 #endif
61 
62 namespace DGtal
63 {
64 
80  template <typename TImage>
82  {
83  typedef TImage Image;
84  typedef typename TImage::Value Value;
86 
88  BOOST_STATIC_ASSERT(( (TImage::Domain::dimension == 3)
89  || (TImage::Domain::dimension == 2) ));
90 
106  template <typename TFunctor =
108  static Image importDICOM( const std::vector<std::string> & filenames,
109  const TFunctor & aFunctor = TFunctor() );
110 
111 
112  private:
113 
114  template <typename Domain, typename PixelType>
115  static inline
117  importDicomFiles( const std::vector<std::string> & filenames );
118 
119 
120 
121  template <typename Image, typename Domain, typename OrigValue,
122  typename TFunctor, typename Value>
123  struct Aux
124  {
125  static inline Image
126  readDGtalImageFromITKtypes( const std::vector<std::string> & filenames,
127  const TFunctor & aFunctor );
128  };
129 
130  //specialization
131  template <typename Domain, typename OrigValue, typename TFunctor,
132  typename Value>
134  TFunctor, Value>
135  {
137  readDGtalImageFromITKtypes( const std::vector<std::string> & filenames,
138  const TFunctor & aFunctor );
139  };
140 
141 
153  template <typename TypeDGtalImage, typename TFunctor>
154  static Image
155  readDGtalImageFromITKtypes( const std::vector<std::string> & filenames,
156  const TFunctor & aFunctor );
157  };
158 }//namespace
159 
161 // Includes inline functions.
162 #include "DGtal/io/readers/ITKDicomReader.ih"
163 
164 // //
166 
167 #endif // !defined ITKDicomReader_h
168 
169 #undef ITKDicomReader_RECURSES
170 #endif // else defined(ITKDicomReader_RECURSES)
Aim: implements a model of CImageContainer using a ITK Image.
DGtal is the top-level namespace which contains all DGtal functions and types.
static ImageContainerByITKImage< Domain, Value > readDGtalImageFromITKtypes(const std::vector< std::string > &filenames, const TFunctor &aFunctor)
static Image readDGtalImageFromITKtypes(const std::vector< std::string > &filenames, const TFunctor &aFunctor)
Aim: Import a 2D/3D DICOM Image from file series.
static Image readDGtalImageFromITKtypes(const std::vector< std::string > &filenames, const TFunctor &aFunctor)
static ImageContainerByITKImage< Domain, PixelType > importDicomFiles(const std::vector< std::string > &filenames)
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
static Image importDICOM(const std::vector< std::string > &filenames, const TFunctor &aFunctor=TFunctor())
ITKIOTrait< Value >::ValueOut ValueOut
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:103
Aim: Define a simple functor using the static cast operator.
HyperRectDomain< Space > Domain