DGtal  1.3.beta
Functions
testMagickReader.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/images/ImageSelector.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "DGtal/io/readers/MagickReader.h"
#include "DGtal/io/boards/Board2D.h"
#include "ConfigTest.h"
#include "DGtalCatch.h"
Include dependency graph for testMagickReader.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("Magick Reader")
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2018/01/30

Functions for testing class MagickReader.

This file is part of the DGtal library.

Definition in file testMagickReader.cpp.

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "Magick Reader"  )

Definition at line 59 of file testMagickReader.cpp.

60 {
61  SECTION("Color->grayscale")
62  {
63  //Default image selector = STLVector
65 
66  std::string filename = testPath + "samples/color64.png";
67 
68  trace.info()<<"Importing: "<<filename<<endl;
69 
71  Image img = reader.importImage( filename , Color2Gray());
72 
73  Board2D board;
74  typedef HueShadeColorMap<unsigned char,2> HueTwice;
75 
77  Display2DFactory::drawImage<HueTwice>(board, img, (unsigned char)0, (unsigned char)255);
78  board.saveSVG("testMagick-export.svg");
79 
80  REQUIRE(img.isValid());
81  REQUIRE(img.extent() == Z2i::Vector(64,64));
82  }
83 
84  SECTION("Color->Color")
85  {
86  typedef ImageSelector<Z2i::Domain, Color>::Type ImageColor;
87 
88  std::string filename = testPath + "samples/color64.png";
89 
90  trace.info()<<"Importing: "<<filename<<endl;
91 
93  ImageColor img = reader.importImage( filename );
94 
95  Color a = img( Z2i::Point(1,1));
96  CAPTURE( a );
97  img.setValue( Z2i::Point(1,1), Color(13,13,13));
98  a = img( Z2i::Point(1,1));
99  CAPTURE( a );
100 
101  REQUIRE(img.isValid());
102  REQUIRE(img.extent() == Z2i::Vector(64,64));
103  }
104 }

References CAPTURE(), DGtal::MagickReader< TImageContainer, TFunctor >::importImage(), DGtal::Trace::info(), REQUIRE(), LibBoard::Board::saveSVG(), SECTION(), LibBoard::Board::setUnit(), DGtal::trace, and LibBoard::Board::UCentimeter.

LibBoard::Board::setUnit
void setUnit(Unit unit)
Definition: Board.cpp:240
DGtal::ImageContainerBySTLVector
Definition: ImageContainerBySTLVector.h:126
LibBoard::Board::UCentimeter
@ UCentimeter
Definition: Board.h:43
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
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
DGtal::trace
Trace trace
Definition: Common.h:154
REQUIRE
REQUIRE(domain.isInside(aPoint))
CAPTURE
CAPTURE(thicknessHV)
DGtal::Trace::info
std::ostream & info()
DGtal::MagickReader
Aim: implements methods to read a 2D image using the ImageMagick library.
Definition: MagickReader.h:111
Image
ImageContainerBySTLVector< Domain, Value > Image
Definition: testSimpleRandomAccessRangeFromPoint.cpp:45
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
DGtal::MagickReader::importImage
static ImageContainer importImage(const std::string &filename, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
DGtal::Image
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
DGtal::PointVector< dim, Integer >
SECTION
SECTION("Testing constant forward iterators")
Definition: testSimpleRandomAccessRangeFromPoint.cpp:66