DGtal  1.3.beta
ITKWriter.h
1 
17 #pragma once
18 
31 #if defined(ITKWriter_RECURSES)
32 #error Recursive header files inclusion detected in ITKWriter.h
33 #else // defined(ITKWriter_RECURSES)
34 
35 #define ITKWriter_RECURSES
36 
37 #if !defined ITKWriter_h
38 
39 #define ITKWriter_h
40 
41 #include "DGtal/images/CConstImage.h"
42 #include "DGtal/images/ImageContainerByITKImage.h"
43 #include "DGtal/base/Common.h"
44 #include "DGtal/base/CUnaryFunctor.h"
45 #include "DGtal/base/BasicFunctors.h"
46 #include "DGtal/io/ITKIOTrait.h"
47 
48 namespace DGtal
49 {
50 
63  template <typename TImage, typename TFunctor = typename ITKIOTrait<typename TImage::Value>::DefaultWriteFunctor >
64  struct ITKWriter
65  {
66  static const typename TImage::Domain::Dimension dimension = TImage::Domain::dimension;
67 
68  typedef TImage Image;
69  typedef typename TImage::Value Value;
71  typedef typename itk::ImageBase<TImage::Domain::dimension>::SpacingValueType ITKSpacingType;
73 
74  typedef TFunctor Functor;
75 
78  BOOST_STATIC_ASSERT(( (dimension == 3) || (dimension == 2) ));
79 
88  static bool exportITK(const std::string & filename, const Image &aImage,
89  const Functor & aFunctor = Functor() );
99  static bool exportITK(const std::string & filename, const Image &aImage,
100  const SpacingType &anImgSpacing, const Functor & aFunctor = Functor() );
101  };
102 
103 
104 
109 template <typename TDomain, typename TValue, typename TFunctor >
110 struct ITKWriter<ImageContainerByITKImage<TDomain, TValue>, TFunctor >
111 {
113  typedef TValue Value;
115  typedef TFunctor Functor;
116 
118  BOOST_STATIC_ASSERT(( (Image::Domain::dimension == 3) || (Image::Domain::dimension == 2) ));
127  static bool exportITK(const std::string & filename, const Image &aImage,
128  const Functor & aFunctor = Functor());
129 };
130 
131 }//namespace
132 
134 // Includes inline functions.
135 #include "DGtal/io/writers/ITKWriter.ih"
136 
137 // //
139 
140 #endif // !defined ITKWriter_h
141 
142 #undef ITKWriter_RECURSES
143 #endif // else defined(ITKWriter_RECURSES)
DGtal::ITKWriter::exportITK
static bool exportITK(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor())
DGtal::ITKWriter< ImageContainerByITKImage< TDomain, TValue >, TFunctor >::Functor
TFunctor Functor
Definition: ITKWriter.h:115
DGtal::ImageContainerByITKImage
Aim: implements a model of CImageContainer using a ITK Image.
Definition: ImageContainerByITKImage.h:93
DGtal::ITKWriter::Functor
TFunctor Functor
Definition: ITKWriter.h:74
DGtal::ITKWriter< ImageContainerByITKImage< TDomain, TValue >, TFunctor >::Value
TValue Value
Definition: ITKWriter.h:113
DGtal::ITKWriter
Export a 2D/3D Image using the ITK formats.
Definition: ITKWriter.h:64
DGtal::ITKWriter::dimension
static const TImage::Domain::Dimension dimension
Definition: ITKWriter.h:66
DGtal::ITKWriter::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TImage >))
DGtal::ITKWriter< ImageContainerByITKImage< TDomain, TValue >, TFunctor >::ValueOut
ITKIOTrait< Value >::ValueOut ValueOut
Definition: ITKWriter.h:114
DGtal::ITKIOTrait::ValueOut
Value ValueOut
Definition: ITKIOTrait.h:62
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::ITKWriter::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(((dimension==3)||(dimension==2)))
DGtal::ITKWriter::SpacingType
PointVector< dimension, double > SpacingType
Definition: ITKWriter.h:72
DGtal::ITKWriter::ITKSpacingType
itk::ImageBase< TImage::Domain::dimension >::SpacingValueType ITKSpacingType
Definition: ITKWriter.h:71
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::ITKWriter< ImageContainerByITKImage< TDomain, TValue >, TFunctor >::Image
ImageContainerByITKImage< TDomain, TValue > Image
Definition: ITKWriter.h:112
DGtal::ITKWriter::Image
TImage Image
Definition: ITKWriter.h:68
DGtal::concepts::CUnaryFunctor
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
DGtal::concepts::CConstImage
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:94
DGtal::ITKWriter::ValueOut
ITKIOTrait< Value >::ValueOut ValueOut
Definition: ITKWriter.h:70
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38
DGtal::ITKWriter::Value
TImage::Value Value
Definition: ITKWriter.h:69