DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ITKReader.h
1
16
17
#pragma once
18
34
35
#if defined(ITKReader_RECURSES)
36
#error Recursive header files inclusion detected in ITKReader.h
37
#else
// defined(ITKReader_RECURSES)
39
#define ITKReader_RECURSES
40
41
#if !defined ITKReader_h
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
#include "DGtal/images/ImageContainerByITKImage.h"
51
#if defined(__GNUG__)
52
#pragma GCC diagnostic push
53
#pragma GCC diagnostic ignored "-Wpedantic"
54
#endif
55
#if defined(__clang__)
56
#pragma clang diagnostic push
57
#pragma clang diagnostic ignored "-Wdocumentation"
58
#endif
59
#include <itkImageFileReader.h>
60
#if defined(__clang__)
61
#pragma clang diagnostic pop
62
#endif
63
#if defined(__GNUG__)
64
#pragma GCC diagnostic pop
65
#endif
66
67
namespace
DGtal
68
{
69
78
template
<
typename
TImage>
79
struct
ITKReader
80
{
81
typedef
TImage
Image
;
82
typedef
typename
TImage::Value
Value
;
83
typedef
typename
ITKIOTrait<Value>::ValueOut
ValueOut
;
84
85
BOOST_CONCEPT_ASSERT
((
concepts::CImage<TImage>
));
86
BOOST_STATIC_ASSERT(( (TImage::Domain::dimension == 3)
87
|| (TImage::Domain::dimension == 2) ));
88
104
template
<
typename
TFunctor =
105
typename
ITKIOTrait<typename TImage::Value>::DefaultReadFunctor
>
106
static
Image
importITK
(
107
const
std::string & filename,
108
const
TFunctor & aFunctor = TFunctor(),
bool
shiftDomainUsingOrigin=
true
);
109
122
static
Image
importITK
(
const
std::string & filename,
bool
shiftDomainUsingOrigin);
123
124
132
static
itk::ImageIOBase::IOComponentType
133
getITKComponentType
(
const
std::string & filename );
134
135
private
:
136
137
template
<
typename
Domain,
typename
PixelType>
138
static
inline
ImageContainerByITKImage<Domain, PixelType>
139
readDGtalITKImage
(
const
std::string & filename,
bool
shiftDomainUsingOrigin=
true
);
140
141
142
template
<
typename
Image
,
typename
Domain
,
typename
OrigValue,
143
typename
TFunctor,
typename
Value
>
144
struct
Aux
145
{
146
static
inline
Image
147
readDGtalImageFromITKtypes
(
const
std::string & filename,
148
const
TFunctor & aFunctor,
bool
shiftDomainUsingOrigin=
true
);
149
};
150
151
//specialization
152
template
<
typename
Domain
,
typename
OrigValue,
typename
TFunctor,
153
typename
Value
>
154
struct
Aux
<
ImageContainerByITKImage
<
Domain
,
Value
>,
Domain
, OrigValue,
155
TFunctor,
Value
>
156
{
157
static
inline
ImageContainerByITKImage<Domain, Value>
158
readDGtalImageFromITKtypes
(
const
std::string & filename,
159
const
TFunctor & aFunctor,
bool
shiftDomainUsingOrigin=
true
);
160
};
161
162
174
template
<
typename
TypeDGtalImage,
typename
TFunctor>
175
static
Image
readDGtalImageFromITKtypes
(
176
const
std::string & filename,
177
const
TFunctor & aFunctor,
bool
shiftDomainUsingOrigin=
true
);
178
};
179
}
//namespace
180
182
// Includes inline functions.
183
#include "DGtal/io/readers/ITKReader.ih"
184
185
// //
187
188
#endif
// !defined ITKReader_h
189
190
#undef ITKReader_RECURSES
191
#endif
// else defined(ITKReader_RECURSES)
DGtal::ImageContainerByITKImage
Aim: implements a model of CImageContainer using a ITK Image.
Definition
ImageContainerByITKImage.h:94
DGtal::Domain
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::ITKIOTrait::DefaultReadFunctor
functors::Cast< Value > DefaultReadFunctor
Definition
ITKIOTrait.h:65
DGtal::ITKIOTrait::ValueOut
Value ValueOut
Definition
ITKIOTrait.h:63
DGtal::ITKReader::Aux< ImageContainerByITKImage< Domain, Value >, Domain, OrigValue, TFunctor, Value >::readDGtalImageFromITKtypes
static ImageContainerByITKImage< Domain, Value > readDGtalImageFromITKtypes(const std::string &filename, const TFunctor &aFunctor, bool shiftDomainUsingOrigin=true)
DGtal::ITKReader::Aux
Definition
ITKReader.h:145
DGtal::ITKReader::Aux::readDGtalImageFromITKtypes
static Image readDGtalImageFromITKtypes(const std::string &filename, const TFunctor &aFunctor, bool shiftDomainUsingOrigin=true)
DGtal::ITKReader
Aim: Import a 2D/3D Image using the ITK formats.
Definition
ITKReader.h:80
DGtal::ITKReader::importITK
static Image importITK(const std::string &filename, const TFunctor &aFunctor=TFunctor(), bool shiftDomainUsingOrigin=true)
DGtal::ITKReader::ValueOut
ITKIOTrait< Value >::ValueOut ValueOut
Definition
ITKReader.h:83
DGtal::ITKReader::readDGtalImageFromITKtypes
static Image readDGtalImageFromITKtypes(const std::string &filename, const TFunctor &aFunctor, bool shiftDomainUsingOrigin=true)
DGtal::ITKReader::getITKComponentType
static itk::ImageIOBase::IOComponentType getITKComponentType(const std::string &filename)
DGtal::ITKReader::Image
TImage Image
Definition
ITKReader.h:81
DGtal::ITKReader::importITK
static Image importITK(const std::string &filename, bool shiftDomainUsingOrigin)
DGtal::ITKReader::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
DGtal::ITKReader::readDGtalITKImage
static ImageContainerByITKImage< Domain, PixelType > readDGtalITKImage(const std::string &filename, bool shiftDomainUsingOrigin=true)
DGtal::ITKReader::Value
TImage::Value Value
Definition
ITKReader.h:82
DGtal::concepts::CImage
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition
CImage.h:103
src
DGtal
io
readers
ITKReader.h
Generated on
for DGtal by
1.18.0