DGtal 1.3.0
Loading...
Searching...
No Matches
viewer3D-8bis-2Dimages.cpp
Go to the documentation of this file.
1
38#include <iostream>
39#include "DGtal/base/Common.h"
40#include "DGtal/io/readers/VolReader.h"
41#include "DGtal/images/ImageHelper.h"
42#include "ConfigExamples.h"
43#include "DGtal/io/viewers/Viewer3D.h"
45#include "DGtal/kernel/BasicPointFunctors.h"
47
49
50using namespace std;
51using namespace DGtal;
52
54
55int main( int argc, char** argv )
56{
57
61 Image3D::Value, DGtal::functors::Identity > ImageAdapterExtractor;
62
64 QApplication application(argc,argv);
65 typedef Viewer3D<> MyViewer;
66 MyViewer viewer;
67 viewer.show();
68 std::string inputFilename = examplesPath + "samples/lobster.vol";
69 Image3D imageVol = VolReader<Image3D>::importVol(inputFilename);
71
72
73
75 DGtal::Z3i::Point ptCenter(50, 62, 28);
76 const int IMAGE_PATCH_WIDTH = 20;
77 // Setting the image domain of the resulting image to be displayed in 3D:
78 DGtal::Z2i::Domain domainImage2D (DGtal::Z2i::Point(0,0),
81
82
83
84 unsigned int pos=0;
85 for (double alpha = 0; alpha< 1.54; alpha+= 0.01){
87 // Extracting images from 3D embeder
89 ptCenter+DGtal::Z3i::Point(static_cast<int>(200.0*cos(alpha)),static_cast<int>(100.0*sin(alpha))),
90 DGtal::Z3i::RealPoint(cos(alpha),sin(alpha),cos(2.0*alpha)),
92 ImageAdapterExtractor extractedImage(imageVol, domainImage2D, embedder, idV);
94
96 //Display image and update its position with embeder
97 viewer << extractedImage;
98 viewer << DGtal::UpdateImage3DEmbedding<Z3i::Space, Z3i::KSpace>(pos,
99 embedder(Z2i::RealPoint(0,0)),
101 embedder(domainImage2D.upperBound()),
102 embedder(Z2i::RealPoint(0, IMAGE_PATCH_WIDTH)));
104 pos++;
105 }
106
107
108 viewer << MyViewer::updateDisplay;
109
110
111 return application.exec();
112}
113// //
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
const Point & upperBound() const
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: Functor that embeds a 2D point into a 3D space from two axis vectors and an origin point given i...
const int IMAGE_PATCH_WIDTH
DGtal is the top-level namespace which contains all DGtal functions and types.
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