DGtal  1.5.beta
DicomReader.h
1 
17 #pragma once
18 
31 #if defined(DicomReader_RECURSES)
32 #error Recursive header files inclusion detected in DicomReader.h
33 #else
35 #define DicomReader_RECURSES
36 
37 #if !defined DicomReader_h
39 #define DicomReader_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/CUnaryFunctor.h"
46 #include "DGtal/images/CImage.h"
47 #include "DGtal/images/ImageContainerByITKImage.h"
48 
50 
51 #ifdef _MSC_VER
52 #pragma warning(disable : 4290)
53 #endif
54 
55 namespace DGtal
56 {
57 
59 // class DicomReader
89  template <typename TImageContainer,
90  typename TFunctor = functors::Cast< typename TImageContainer::Value > >
91  struct DicomReader
92  {
93  // ----------------------- Standard services ------------------------------
94  public:
95 
97  typedef typename TImageContainer::Value Value;
98  typedef TFunctor Functor;
99  typedef int32_t PixelType;
100 
103  BOOST_STATIC_ASSERT(( TImageContainer::Domain::dimension == 3 ));
104 
116  static ImageContainer importDicom( const std::string & aFilename,
117  const Functor & aFunctor = Functor());
118 
130  static ImageContainer importDicomSeries( const std::vector<std::string> & filenames,
131  const Functor & aFunctor = Functor());
132 
133  private:
134 
135  template <typename Domain, typename PixelType>
137  importDicomFiles_( const std::vector<std::string> & filenames );
138 
139 
140  template <typename Image, typename Domain, typename OutPixelType,
141  typename PixelType>
142  struct Aux
143  {
144  static inline Image
145  importDicomFiles( const std::vector<std::string> & filenames,
146  const TFunctor & aFunctor );
147  };
148 
149  //specialization
150  template <typename Domain, typename OutPixelType, typename PixelType>
151  struct Aux<ImageContainerByITKImage<Domain, OutPixelType>, Domain,
152  OutPixelType, PixelType>
153  {
155  importDicomFiles( const std::vector<std::string> & filenames,
156  const TFunctor & aFunctor );
157  };
158 
159 
160  template <typename PixelType>
161  static inline TImageContainer
162  importDicomFiles(const std::vector<std::string> & filenames,
163  const TFunctor & aFunctor);
164 
165 
166  }; // end of class DicomReader
167 
168 
169 
170 } // namespace DGtal
171 
172 
174 // Includes inline functions.
175 #include "DGtal/io/readers/DicomReader.ih"
176 
177 
178 // //
180 
181 #endif // !defined DicomReader_h
182 
183 #undef DicomReader_RECURSES
184 #endif // else defined(DicomReader_RECURSES)
Aim: implements a model of CImageContainer using a ITK Image.
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
static ImageContainerByITKImage< Domain, OutPixelType > importDicomFiles(const std::vector< std::string > &filenames, const TFunctor &aFunctor)
static Image importDicomFiles(const std::vector< std::string > &filenames, const TFunctor &aFunctor)
Aim: Import a 3D DICOM image from file series.
Definition: DicomReader.h:92
static ImageContainerByITKImage< Domain, PixelType > importDicomFiles_(const std::vector< std::string > &filenames)
BOOST_CONCEPT_ASSERT((concepts::CImage< ImageContainer >))
BOOST_STATIC_ASSERT((TImageContainer::Domain::dimension==3))
TImageContainer::Value Value
Definition: DicomReader.h:97
TImageContainer ImageContainer
Definition: DicomReader.h:96
static ImageContainer importDicomSeries(const std::vector< std::string > &filenames, const Functor &aFunctor=Functor())
static TImageContainer importDicomFiles(const std::vector< std::string > &filenames, const TFunctor &aFunctor)
static ImageContainer importDicom(const std::string &aFilename, const Functor &aFunctor=Functor())
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< Functor, PixelType, Value >))
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:103
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90
ImageContainerBySTLVector< Domain, Value > Image
HyperRectDomain< Space > Domain
ImageContainerBySTLVector< HyperRectDomain< Z2i::Space >, std::unordered_set< Z2i::Point > > TImageContainer