DGtal  0.9.3
Functions
exampleRigidtransformation2d.cpp File Reference
#include <iostream>
#include <cmath>
#include "DGtal/images/ImageSelector.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/images/ConstImageAdapter.h"
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/PGMReader.h"
#include "DGtal/io/writers/GenericWriter.h"
#include "DGtal/images/RigidTransformation2D.h"
Include dependency graph for exampleRigidtransformation2d.cpp:

Go to the source code of this file.

Functions

int main (int, char **)
 

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
Kacper Pluta (kacpe.nosp@m.r.pl.nosp@m.uta@e.nosp@m.siee.nosp@m..fr ) Laboratoire d'Informatique Gaspard-Monge - LIGM, France
Date
2014/06/28

An example file named rigidtransformation2d.

This file is part of the DGtal library.

Definition in file exampleRigidtransformation2d.cpp.

Function Documentation

◆ main()

int main ( int  ,
char **   
)

[def]

[def]

[trans]

[trans] [init_domain_helper]

[init_domain_helper]

[domain]

[domain]

[backward]

[backward]

[forward]

[forward]

Definition at line 61 of file exampleRigidtransformation2d.cpp.

References DGtal::Trace::beginBlock(), DGtal::Image< TImageContainer >::domain(), DGtal::Trace::endBlock(), DGtal::Image< TImageContainer >::setValue(), and DGtal::trace.

62 {
65  typedef ForwardRigidTransformation2D < Space > ForwardTrans;
66  typedef BackwardRigidTransformation2D < Space > BackwardTrans;
68  typedef DomainRigidTransformation2D < Domain, ForwardTrans > MyDomainTransformer;
69  typedef MyDomainTransformer::Bounds Bounds;
71  trace.beginBlock ( "Example rigidtransformation2d" );
73  ForwardTrans forwardTrans( RealPoint ( 5, 5 ), M_PI_4, RealVector( 3, -3 ) );
74  BackwardTrans backwardTrans( RealPoint ( 5, 5 ), M_PI_4, RealVector( 3, -3 ) );
77  MyDomainTransformer domainTransformer ( forwardTrans );
79  Identity idD;
80 
81  Image image = PGMReader<Image>::importPGM ( examplesPath + "samples/church.pgm" );
83  Bounds bounds = domainTransformer ( image.domain() );
84  Domain transformedDomain ( bounds.first, bounds.second );
86 
87  trace.beginBlock ( "Backward - Eulerian model" );
89  MyImageBackwardAdapter backwardImageAdapter ( image, transformedDomain , backwardTrans, idD );
91  backwardImageAdapter >> "backward_transform.pgm";
92  trace.endBlock();
93 
94  trace.beginBlock( "Forward - Lagrangian model" );
95  Image forwardTransformedImage ( transformedDomain );
97  for ( Domain::ConstIterator it = image.domain().begin(); it != image.domain().end(); ++it )
98  {
99  forwardTransformedImage.setValue ( forwardTrans ( *it ), image ( *it ) );
100  }
102  forwardTransformedImage >> "forward_transform.pgm";
103  trace.endBlock();
104  trace.endBlock();
105  return 0;
106 }
void beginBlock(const std::string &keyword="")
Aim: Automatically defines an adequate image type according to the hints given by the user...
Definition: ImageSelector.h:66
Trace trace
Definition: Common.h:137
Aim: Import a 2D or 3D using the Netpbm formats (ASCII mode).
Definition: PGMReader.h:96
double endBlock()
ImageContainerBySTLVector< Domain, Value > Image
const Domain & domain() const
Definition: Image.h:192
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Space::RealVector RealVector
Definition: StdDefs.h:98