DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
tests
io
readers
testRawReader.cpp
1
30
31
#include <iostream>
32
#include "DGtal/base/Common.h"
33
34
#include "DGtal/kernel/SpaceND.h"
35
#include "DGtal/kernel/domains/HyperRectDomain.h"
36
#include "DGtal/images/ImageSelector.h"
37
#include "DGtal/io/writers/PGMWriter.h"
38
#include "DGtal/io/readers/RawReader.h"
39
40
#include "ConfigTest.h"
41
42
44
45
using namespace
std;
46
using namespace
DGtal;
47
49
// Functions for testing class RawReader.
51
55
bool
testRawReader2D()
56
{
57
unsigned
int
nbok = 0;
58
unsigned
int
nb = 0;
59
60
trace
.
beginBlock
(
"Testing Raw reader ..."
);
61
62
typedef
SpaceND<2>
Space2;
63
typedef
HyperRectDomain<Space2>
TDomain;
64
typedef
TDomain::Vector Vector;
65
66
//Default image selector = STLVector
67
typedef
ImageSelector<TDomain, unsigned char>::Type
Image
;
68
69
std::string filename = testPath +
"samples/raw2D-64x64.raw"
;
70
71
Vector ext(16,16);
72
73
Image image =
RawReader<Image>::importRaw8
( filename , ext);
74
76
trace
.
info
() << image <<endl;
77
78
//export
79
PGMWriter<Image>::exportPGM
(
"export-raw-reader.pgm"
,image);
80
82
83
nbok +=
true
? 1 : 0;
84
nb++;
85
trace
.
info
() <<
"("
<< nbok <<
"/"
<< nb <<
") "
86
<<
"true == true"
<< std::endl;
87
trace
.
endBlock
();
88
89
return
nbok == nb;
90
}
91
93
// Standard services - public :
94
95
int
main(
int
argc,
char
** argv )
96
{
97
trace
.
beginBlock
(
"Testing class RawReader"
);
98
trace
.
info
() <<
"Args:"
;
99
for
(
int
i = 0; i < argc; ++i )
100
trace
.
info
() <<
" "
<< argv[ i ];
101
trace
.
info
() << endl;
102
103
bool
res = testRawReader2D();
// && ... other tests
104
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
105
trace
.
endBlock
();
106
return
res ? 0 : 1;
107
}
108
// //
Generated on Wed Dec 19 2012 19:10:41 for DGtal by
1.8.1.1