32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/io/readers/PointListReader.h"
40 #include "DGtal/geometry/curves/FreemanChain.h"
51 using namespace DGtal;
101 int main(
int argc,
char** argv )
107 std::string inputFileName;
108 bool oneline {
false};
111 app.description(
"Transform freeman chain into a Sequence of Discrete Points. Result is given to std output.\n Example:\n freeman2sdp ${DGtal}/tests/samples/contourS.fc > contourS.sdp \n");
112 app.add_option(
"-i,--input,1", inputFileName,
"Input freeman chain file name." )
114 ->check(CLI::ExistingFile);
115 app.add_flag(
"-o,--oneLine", oneline,
"output the digital contour in one line like: X0 Y0 X1 Y1 ... XN YN");
116 app.add_flag(
"--info", info,
"adds some info as comments at the beginning of the file.");
119 app.get_formatter()->column_width(40);
120 CLI11_PARSE(app, argc, argv);
128 for(
unsigned int i=0; i< vectFcs.size(); i++){
129 bool isClosed = vectFcs.at(i).isClosed();
130 std::cout <<
"# grid curve " << i+1 <<
"/" << vectFcs.size()
131 << ( (isClosed)?
" closed":
" open" ) << std::endl;
133 std::cout <<
"# SDP contour" << i+1<<
"/" << vectFcs.size() <<
" "
134 <<
"# size=" << vectFcs.at(i).size() << std::endl;
135 std::vector<Z2i::Point> vectPts;
137 for(
unsigned int k=0; k < vectPts.size(); k++){
138 std::cout << vectPts.at(k)[0] <<
" "<< vectPts.at(k)[1] ;
141 std::cout << std::endl;
149 std::cout << std::endl;
int main(int argc, char **argv)
static void getContourPoints(const FreemanChain &fc, std::vector< Point > &aVContour)