DGtal 1.4.0
Loading...
Searching...
No Matches
exampleRigidtransformation3d.cpp
Go to the documentation of this file.
1
40#include <iostream>
41#include <cmath>
42#include "DGtal/images/ImageSelector.h"
43#include "DGtal/images/ImageContainerBySTLVector.h"
44#include "DGtal/images/ConstImageAdapter.h"
45#include "ConfigExamples.h"
46#include "DGtal/helpers/StdDefs.h"
47#include "DGtal/base/Common.h"
48#include "DGtal/io/readers/VolReader.h"
49#include "DGtal/io/writers/GenericWriter.h"
50#include "DGtal/kernel/BasicPointFunctors.h"
52#include "DGtal/images/RigidTransformation3D.h"
55
56using namespace std;
57using namespace DGtal;
58using namespace functors;
59using namespace Z3i;
60
62
63int main( int , char** )
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";
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}
108// //
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Aim: implements association bewteen points lying in a digital domain and values.
Definition Image.h:70
void setValue(const Point &aPoint, const Value &aValue)
Definition Image.h:247
void beginBlock(const std::string &keyword="")
double endBlock()
Space::RealVector RealVector
Definition StdDefs.h:171
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition Common.h:153
STL namespace.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Aim: Define a simple default functor that just returns its argument.
int main()
Definition testBits.cpp:56
ImageContainerBySTLVector< Domain, Value > Image