DGtal  1.5.beta
exampleRigidtransformation3d.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/VolReader.h"
#include "DGtal/io/writers/GenericWriter.h"
#include "DGtal/kernel/BasicPointFunctors.h"
#include "DGtal/images/RigidTransformation3D.h"
Include dependency graph for exampleRigidtransformation3d.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 rigidtransformation3d.

This file is part of the DGtal library.

Definition in file exampleRigidtransformation3d.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 63 of file exampleRigidtransformation3d.cpp.

64 {
67  typedef ForwardRigidTransformation3D < Space > ForwardTrans;
68  typedef BackwardRigidTransformation3D < Space > BackwardTrans;
70  typedef DomainRigidTransformation3D < Domain, ForwardTrans > MyTransformedDomain;
71  typedef MyTransformedDomain::Bounds Bounds;
73  trace.beginBlock ( "Example rigidtransformation3d" );
75  ForwardTrans forwardTrans( Point ( 5, 5, 5 ), RealVector ( 1, 0, 1 ), M_PI_4, RealVector( 3, -3, 3 ) );
76  BackwardTrans backwardTrans( Point ( 5, 5, 5 ), RealVector ( 1, 0, 1 ), M_PI_4, RealVector( 3, -3, 3 ) );
79  MyTransformedDomain domainForwardTrans ( forwardTrans );
81  Identity idD;
82 
83  Image image = VolReader<Image>::importVol ( examplesPath + "samples/cat10.vol" );
85  Bounds bounds = domainForwardTrans ( image.domain() );
86  Domain transformedDomain ( bounds.first, bounds.second );
88  trace.beginBlock ( "Backward - Eulerian model" );
90  MyImageBackwardAdapter adapter ( image, transformedDomain, backwardTrans, idD );
92  adapter >> "backward_transform.pgm3d";
93  trace.endBlock();
94 
95  trace.beginBlock( "Forward - Lagrangian model" );
96  Image transformed ( transformedDomain );
98  for ( Domain::ConstIterator it = image.domain().begin(); it != image.domain().end(); ++it )
99  {
100  transformed.setValue ( forwardTrans ( *it ), image ( *it ) );
101  }
103  transformed >> "forward_transform.pgm3d";
104  trace.endBlock();
105  trace.endBlock();
106  return 0;
107 }
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Iterator for HyperRectDomain.
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
void beginBlock(const std::string &keyword="")
double endBlock()
Space::RealVector RealVector
Trace trace
Definition: Common.h:153
Aim: Automatically defines an adequate image type according to the hints given by the user.
Definition: ImageSelector.h:70
Aim: implements methods to read a "Vol" file format.
Definition: VolReader.h:90
Aim: Define a simple default functor that just returns its argument.
ImageContainerBySTLVector< Domain, Value > Image

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