DGtal  0.9.3
Functions
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/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 62 of file exampleRigidtransformation3d.cpp.

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

63 {
66  typedef ForwardRigidTransformation3D < Space > ForwardTrans;
67  typedef BackwardRigidTransformation3D < Space > BackwardTrans;
69  typedef DomainRigidTransformation3D < Domain, ForwardTrans > MyTransformedDomain;
70  typedef MyTransformedDomain::Bounds Bounds;
72  trace.beginBlock ( "Example rigidtransformation3d" );
74  ForwardTrans forwardTrans( Point ( 5, 5, 5 ), RealVector ( 1, 0, 1 ), M_PI_4, RealVector( 3, -3, 3 ) );
75  BackwardTrans backwardTrans( Point ( 5, 5, 5 ), RealVector ( 1, 0, 1 ), M_PI_4, RealVector( 3, -3, 3 ) );
78  MyTransformedDomain domainForwardTrans ( forwardTrans );
80  Identity idD;
81 
82  Image image = VolReader<Image>::importVol ( examplesPath + "samples/cat10.vol" );
84  Bounds bounds = domainForwardTrans ( image.domain() );
85  Domain transformedDomain ( bounds.first, bounds.second );
87  trace.beginBlock ( "Backward - Eulerian model" );
89  MyImageBackwardAdapter adapter ( image, transformedDomain, backwardTrans, idD );
91  adapter >> "backward_transform.pgm3d";
92  trace.endBlock();
93 
94  trace.beginBlock( "Forward - Lagrangian model" );
95  Image transformed ( transformedDomain );
97  for ( Domain::ConstIterator it = image.domain().begin(); it != image.domain().end(); ++it )
98  {
99  transformed.setValue ( forwardTrans ( *it ), image ( *it ) );
100  }
102  transformed >> "forward_transform.pgm3d";
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
double endBlock()
Aim: implements methods to read a "Vol" file format.
Definition: VolReader.h:89
MyPointD Point
Definition: testClone2.cpp:383
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