DGtal
1.3.beta
tests
io
writers
testMagickWriter.cpp
Go to the documentation of this file.
1
30
#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/MagickWriter.h"
37
#include "DGtal/images/ImageContainerBySTLVector.h"
38
#include "DGtal/io/colormaps/HueShadeColorMap.h"
40
41
using namespace
std;
42
using namespace
DGtal
;
43
using namespace
Z2i;
45
// Functions for testing class MagickWriter.
47
48
TEST_CASE
(
"Testing MagickWriter"
)
49
{
50
//Create an image
51
Domain
domain
(
Point
(0,0),
Point
(64,48));
52
typedef
ImageContainerBySTLVector<Domain, unsigned char>
Image
;
53
Image
image
(
domain
);
54
unsigned
char
t=0;
55
for
(
auto
p: image.domain())
56
{
57
image.setValue(p, t);
58
t = ((int)t + 1)%255;
59
}
60
HueShadeColorMap<unsigned char,2>
cmap(0,255);
61
62
SECTION
(
"Testing feature io/writers/ of MagickWriter"
)
63
{
64
REQUIRE
((
MagickWriter
<
Image
,
HueShadeColorMap<unsigned char,2>
>::exportMagick(
"magickwriter.png"
, image, cmap ) ));
65
REQUIRE
((
MagickWriter
<
Image
,
HueShadeColorMap<unsigned char,2>
>::exportMagick(
"magickwriter.jpg"
, image, cmap ) ));
66
REQUIRE
((
MagickWriter
<
Image
,
HueShadeColorMap<unsigned char,2>
>::exportMagick(
"magickwriter.gif"
, image, cmap ) ));
67
REQUIRE
((
MagickWriter
<
Image
,
HueShadeColorMap<unsigned char,2>
>::exportMagick(
"magickwriter.bmp"
, image, cmap ) ));
68
}
69
}
70
TEST_CASE
TEST_CASE("Testing MagickWriter")
Definition:
testMagickWriter.cpp:48
image
Image image(domain)
DGtal::HyperRectDomain< Space >
DGtal::ImageContainerBySTLVector
Definition:
ImageContainerBySTLVector.h:126
DGtal::HueShadeColorMap
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Definition:
HueShadeColorMap.h:90
REQUIRE
REQUIRE(domain.isInside(aPoint))
Image
ImageContainerBySTLVector< Domain, Value > Image
Definition:
testSimpleRandomAccessRangeFromPoint.cpp:45
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::MagickWriter
Aim: Export image using Imagemagick backend.
Definition:
MagickWriter.h:93
DGtal::Image
Aim: implements association bewteen points lying in a digital domain and values.
Definition:
Image.h:69
domain
Domain domain
Definition:
testProjection.cpp:88
SECTION
SECTION("Testing constant forward iterators")
Definition:
testSimpleRandomAccessRangeFromPoint.cpp:66
Point
MyPointD Point
Definition:
testClone2.cpp:383
Generated on Wed Dec 8 2021 06:01:14 for DGtal by
1.8.17