DGtal 1.3.0
Loading...
Searching...
No Matches
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)
35#define ITKWriter_RECURSES
36
37#if !defined ITKWriter_h
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
48namespace 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
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
109template <typename TDomain, typename TValue, typename TFunctor >
110struct 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)
Aim: implements a model of CImageContainer using a ITK Image.
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
DGtal is the top-level namespace which contains all DGtal functions and types.
BOOST_STATIC_ASSERT(((Image::Domain::dimension==3)||(Image::Domain::dimension==2)))
static bool exportITK(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor())
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, ValueOut >))
Export a 2D/3D Image using the ITK formats.
Definition: ITKWriter.h:65
PointVector< dimension, double > SpacingType
Definition: ITKWriter.h:72
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TImage >))
ITKIOTrait< Value >::ValueOut ValueOut
Definition: ITKWriter.h:70
static const TImage::Domain::Dimension dimension
Definition: ITKWriter.h:66
itk::ImageBase< TImage::Domain::dimension >::SpacingValueType ITKSpacingType
Definition: ITKWriter.h:71
static bool exportITK(const std::string &filename, const Image &aImage, const SpacingType &anImgSpacing, const Functor &aFunctor=Functor())
TImage::Value Value
Definition: ITKWriter.h:69
BOOST_STATIC_ASSERT(((dimension==3)||(dimension==2)))
TFunctor Functor
Definition: ITKWriter.h:74
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, ValueOut >))
static bool exportITK(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor())
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:95
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90