DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testLongvol.cpp
Go to the documentation of this file.
1
16
29
31
#include <iostream>
32
#include "DGtal/base/Common.h"
33
#include "DGtal/helpers/StdDefs.h"
34
#include "DGtal/images/ImageSelector.h"
35
#include "DGtal/images/ImageContainerBySTLVector.h"
36
#include "DGtal/io/writers/LongvolWriter.h"
37
#include "DGtal/io/readers/LongvolReader.h"
38
40
using namespace
std
;
41
using namespace
DGtal
;
42
44
// Functions for testing class Longvol.
46
50
bool
testLongvol
()
51
{
52
unsigned
int
nbok = 0;
53
unsigned
int
nb = 0;
54
55
trace
.
beginBlock
(
"Testing Longvol writer ..."
);
56
57
Z3i::Point
a(0,0,0);
58
Z3i::Point
b(15,15,15);
59
Z3i::Point
c(7,7,7);
60
61
typedef
ImageContainerBySTLVector<Z3i::Domain, DGtal::uint64_t>
Image
;
62
Image
image
(
Z3i::Domain
(a,b));
63
64
image
.
setValue
(c,0X8899AABBCCDDEEFFull);
65
66
LongvolWriter<Image>::exportLongvol
(
"export-longvol.longvol"
,
image
);
67
68
Image
image2 =
LongvolReader<Image>::importLongvol
(
"export-longvol.longvol"
);
69
70
bool
allFine=
true
;
71
Image::ConstIterator
ito =
image
.begin();
72
for
(
Image::ConstIterator
it = image2.begin(), itend=image2.end();
73
it != itend; ++it, ++ito)
74
allFine &= (*it) == (*ito);
75
76
nbok += allFine ? 1 : 0;
77
nb++;
78
trace
.
info
() <<
"("
<< nbok <<
"/"
<< nb <<
") "
79
<<
"true == true"
<< std::endl;
80
trace
.
endBlock
();
81
82
return
nbok == nb;
83
}
84
86
// Standard services - public :
87
88
int
main
(
int
argc,
char
** argv )
89
{
90
trace
.
beginBlock
(
"Testing class Longvol"
);
91
trace
.
info
() <<
"Args:"
;
92
for
(
int
i = 0; i < argc; ++i )
93
trace
.
info
() <<
" "
<< argv[ i ];
94
trace
.
info
() << endl;
95
96
bool
res =
testLongvol
();
// && ... other tests
97
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
98
trace
.
endBlock
();
99
return
res ? 0 : 1;
100
}
101
// //
DGtal::ImageContainerBySTLVector
Definition
ImageContainerBySTLVector.h:127
DGtal::ImageContainerBySTLVector< Domain, Value >::ConstIterator
std::vector< Value >::const_iterator ConstIterator
Definition
ImageContainerBySTLVector.h:265
DGtal::Image
Aim: implements association between points lying in a digital domain and values.
Definition
Image.h:70
DGtal::Image::setValue
void setValue(const Point &aPoint, const Value &aValue)
Definition
Image.h:247
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::Trace::info
std::ostream & info()
DGtal::Trace::endBlock
double endBlock()
DGtal::Z3i::Domain
HyperRectDomain< Space > Domain
Definition
StdDefs.h:172
DGtal::Z3i::Point
Space::Point Point
Definition
StdDefs.h:168
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
DGtal::LongvolReader::importLongvol
static ImageContainer importLongvol(const std::string &filename, const Functor &aFunctor=Functor())
DGtal::LongvolWriter::exportLongvol
static bool exportLongvol(const std::string &filename, const Image &aImage, const bool compressed=true, const Functor &aFunctor=Functor())
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
testLongvol
bool testLongvol()
Definition
testLongvol.cpp:50
image
Image image(domain)
tests
io
testLongvol.cpp
Generated on
for DGtal by
1.18.0