DGtal  1.5.beta
testPreimage.cpp File Reference
#include <cstdio>
#include <cmath>
#include <fstream>
#include <vector>
#include <iostream>
#include <sstream>
#include <iterator>
#include "DGtal/base/Common.h"
#include "DGtal/base/Exceptions.h"
#include "DGtal/kernel/SpaceND.h"
#include "DGtal/kernel/domains/DomainPredicate.h"
#include "DGtal/kernel/domains/HyperRectDomain.h"
#include "DGtal/topology/KhalimskySpaceND.h"
#include "DGtal/geometry/curves/GridCurve.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/shapes/fromPoints/StraightLineFrom2Points.h"
#include "DGtal/geometry/tools/Preimage2D.h"
#include "ConfigTest.h"
Include dependency graph for testPreimage.cpp:

Go to the source code of this file.


int main ()

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/.

Tristan Roussillon (trist.nosp@m.an.r.nosp@m.oussi.nosp@m.llon.nosp@m.@liri.nosp@m.s.cn.nosp@m.rs.fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France

This file is part of the DGtal library

Definition in file testPreimage.cpp.

Function Documentation

◆ main()

int main ( void  )

Definition at line 64 of file testPreimage.cpp.

65 {
67  std::string filename = testPath + "samples/DSS.dat";
68  std::ifstream instream; // input stream
69  instream.open (filename.c_str(), std::ifstream::in);
72  GridCurve<KSpace> c; //grid curve
73  c.initFromVectorStream(instream);
76  trace.beginBlock("Simple preimage test");
79  StraightLine aStraightLine; //instance of straight line
82  GridCurve<KSpace>::IncidentPointsRange r = c.getIncidentPointsRange(); //range
86  //preimage computation
87  Preimage2D thePreimage(it->first, it->second, aStraightLine);
88  ++it;
89  while ( (it != itEnd) &&
90  (thePreimage.addBack(it->first, it->second)) )
91  {
92  trace.info() << (it - r.rbegin()) << std::endl << thePreimage << std::endl;
93  ++it;
94  }
96  trace.endBlock();
98  return 0;
99 }
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition: GridCurve.h:173
bool initFromVectorStream(std::istream &in)
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Aim: Computes the preimage of the 2D Euclidean shapes crossing a sequence of n straigth segments in O...
Definition: Preimage2D.h:94
This class adapts any bidirectional iterator so that operator++ calls operator-- and vice versa.
Aim: Represents a straight line uniquely defined by two 2D points and that is able to return for any ...
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
Trace trace
Definition: Common.h:153

References DGtal::Preimage2D< Shape >::addBack(), DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), DGtal::GridCurve< TKSpace >::initFromVectorStream(), and DGtal::trace.