DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testCompressedVolWriter.cpp
Go to the documentation of this file.
1
16
29
31
#include <iostream>
32
#include "DGtal/base/Common.h"
33
#include "ConfigTest.h"
34
#include "DGtalCatch.h"
35
#include "DGtal/helpers/StdDefs.h"
36
#include "DGtal/io/writers/LongvolWriter.h"
37
#include "DGtal/io/readers/LongvolReader.h"
38
#include "DGtal/io/writers/VolWriter.h"
39
#include "DGtal/io/readers/VolReader.h"
40
#include "DGtal/images/ImageContainerBySTLVector.h"
42
using namespace
std
;
43
using namespace
DGtal
;
44
using namespace
Z3i
;
45
47
// Functions for testing class CompressedVolWriter.
49
50
template
<
typename
Image>
51
bool
checkImage(
const
Image
&a,
const
Image
&b)
52
{
53
for
(
auto
p: a.
domain
())
54
{
55
if
(a(p) != b(p))
56
{
57
trace
.
info
()<< p <<
" "
<< a(p) <<
" "
<<b(p)<<std::endl;
58
return
false
;
59
}
60
}
61
return
true
;
62
}
63
64
TEST_CASE
(
"Testing CompressedVolWriter"
)
65
{
66
Domain
domain
(
Point
(0,0,0),
Point
(10,10,10));
67
typedef
ImageContainerBySTLVector<Domain, unsigned char>
Image
;
68
Image
image
(
domain
);
69
image
.
setValue
(
Point
(5,5,5), 42);
70
71
SECTION
(
"Testing API of CompressedVol"
)
72
{
73
VolWriter< ImageContainerBySTLVector<Domain, unsigned char>
>::exportVol(
"test.vol"
,
image
,
false
);
74
VolWriter< ImageContainerBySTLVector<Domain, unsigned char>
>::exportVol(
"testz.vol"
,
image
);
75
REQUIRE
(
image
.
isValid
() );
76
}
77
78
SECTION
(
"Testing write/read of CompressedVolWriter"
)
79
{
80
Image
read =
VolReader<Image>::importVol
(
"test.vol"
);
81
trace
.
info
()<<read<<std::endl;
82
REQUIRE
( (checkImage(
image
,read) ==
true
)) ;
83
84
Image
readz =
VolReader<Image>::importVol
(
"testz.vol"
);
85
trace
.
info
()<<readz<<std::endl;
86
REQUIRE
( (checkImage(
image
,readz) ==
true
)) ;
87
}
88
}
89
90
TEST_CASE
(
"Testing CompressedLongvol"
)
91
{
92
Domain
domain
(
Point
(0,0,0),
Point
(2,2,2));
93
typedef
ImageContainerBySTLVector<Domain, DGtal::uint64_t>
Image
;
94
Image
image
(
domain
);
95
image
.
setValue
(
Point
(1,1,1), 0X8899AABBCCDDEEFFull);
96
97
SECTION
(
"Testing API of CompressedVolWriter"
)
98
{
99
LongvolWriter< ImageContainerBySTLVector<Domain, DGtal::uint64_t>
>::exportLongvol(
"test.lvol"
,
image
,
false
);
100
trace
.
info
()<<std::endl;
101
LongvolWriter< ImageContainerBySTLVector<Domain, DGtal::uint64_t>
>::exportLongvol(
"testz.lvol"
,
image
);
102
REQUIRE
(
image
.
isValid
() );
103
}
104
105
SECTION
(
"Testing write/read of CompressedVolWriter"
)
106
{
107
Image
read =
LongvolReader<Image>::importLongvol
(
"test.lvol"
);
108
REQUIRE
( (checkImage(
image
,read) ==
true
)) ;
109
110
Image
readz =
LongvolReader<Image>::importLongvol
(
"testz.lvol"
);
111
REQUIRE
( (checkImage(
image
,readz) ==
true
)) ;
112
}
113
}
114
DGtal::ImageContainerBySTLVector
Definition
ImageContainerBySTLVector.h:127
DGtal::Image
Aim: implements association between points lying in a digital domain and values.
Definition
Image.h:70
DGtal::Image::domain
const Domain & domain() const
Definition
Image.h:192
DGtal::Image::setValue
void setValue(const Point &aPoint, const Value &aValue)
Definition
Image.h:247
DGtal::Image::isValid
bool isValid() const
Definition
Image.h:266
DGtal::Point
DGtal::Trace::info
std::ostream & info()
DGtal::Domain
DGtal::Z3i
Z3i this namespace gathers the standard of types for 3D imagery.
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
Aim: Export a 3D Image using the Longvol formats (volumetric image with DGtal::uint64_t value type).
Definition
LongvolWriter.h:70
DGtal::VolReader::importVol
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
DGtal::VolWriter
Aim: Export a 3D Image using the Vol formats.
Definition
VolWriter.h:69
TEST_CASE
TEST_CASE("int container traits", "[int][traits]")
Definition
testContainerTraits.cpp:53
domain
Domain domain
Definition
testProjection.cpp:88
image
Image image(domain)
SECTION
SECTION("Testing constant forward iterators")
Definition
testSimpleRandomAccessRangeFromPoint.cpp:66
REQUIRE
REQUIRE(domain.isInside(aPoint))
tests
io
writers
testCompressedVolWriter.cpp
Generated on
for DGtal by
1.18.0