32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/io/boards/Board2D.h"
35 #include "DGtal/io/readers/PPMReader.h"
36 #include "DGtal/io/readers/PGMReader.h"
37 #include "DGtal/images/ImageSelector.h"
38 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
39 #include "ConfigTest.h"
44 using namespace DGtal;
55 unsigned int nbok = 0;
60 std::string filename = testPath +
"samples/circleR10.pgm";
62 trace.
info() <<
"Loading filename: "<< filename<<std::endl;
71 board << image.domain() << set2d;
73 board.
saveEPS(
"testPNMReaderPGM.eps");
74 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
75 <<
"true == true" << std::endl;
81 std::string filenamePPM = testPath +
"samples/color64.ppm";
83 trace.
info() <<
"Loading filename: "<< filenamePPM <<std::endl;
92 boardPPM << imagePPM.domain() << set2dPPM;
94 boardPPM.
saveEPS(
"testPNMReaderPPM.eps");
95 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
96 <<
"true == true" << std::endl;
105 bool testPNM3DReader()
107 unsigned int nbok = 0;
110 nbok +=
true ? 1 : 0;
112 std::string filename = testPath +
"samples/simple.pgm3d";
114 trace.
info() <<
"Loading filename: "<< filename<<std::endl;
119 trace.
info() <<
"Image 3D = "<<image<<std::endl;
121 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
122 <<
"true == true" << std::endl;
127 bool testPNM3DASCIIReader()
129 unsigned int nbok = 0;
132 nbok +=
true ? 1 : 0;
134 std::string filename = testPath +
"samples/ascii_ball.pgm3d";
136 trace.
info() <<
"Loading filename: "<< filename<<std::endl;
141 trace.
info() <<
"Image 3D = "<<image<<std::endl;
143 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
144 <<
"true == true" << std::endl;
152 int main(
int argc,
char** argv )
156 for (
int i = 0; i < argc; ++i )
160 bool res = testPNMReader() && testPNM3DReader() && testPNM3DASCIIReader();
161 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
Aim: implements association bewteen points lying in a digital domain and values.
Aim: Import a 2D or 3D using the Netpbm formats (ASCII mode).
Aim: Import a 2D or 3D using the Netpbm formats (ASCII mode).
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: Define utilities to convert a digital set into an image.
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
const Domain & domain() const
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...