DGtal 2.1.0
Loading...
Searching...
No Matches
viewer3D-8bis-2Dimages.cpp
Go to the documentation of this file.
1
38#include "DGtal/base/Common.h"
39#include "DGtal/io/readers/VolReader.h"
40#include "DGtal/images/ImageHelper.h"
41#include "ConfigExamples.h"
42#include "DGtal/io/viewers/PolyscopeViewer.h"
43
45#include "DGtal/kernel/BasicPointFunctors.h"
47
49
50using namespace std;
51using namespace DGtal;
52
54
55int main()
56{
57
61 Image3D::Value, DGtal::functors::Identity > ImageAdapterExtractor;
62
64 polyscope::options::programName = "examples/io/viewers: viewer3D-8bis-2Dimages";
65 PolyscopeViewer viewer;
66
67
68
69 std::string inputFilename = examplesPath + "samples/lobster.vol";
70 Image3D imageVol = VolReader<Image3D>::importVol(inputFilename);
72
73
74
76 DGtal::Z3i::Point ptCenter(50, 62, 28);
77 const int IMAGE_PATCH_WIDTH = 30;
78 // Setting the image domain of the resulting image to be displayed in 3D:
79 DGtal::Z2i::Domain domainImage2D (DGtal::Z2i::Point(0,0),
82
83
84
85 unsigned int pos=0;
86 for (double alpha = 0; alpha< 1.54; alpha+= 0.01){
88 // Extracting images from 3D embeder
90 ptCenter+DGtal::Z3i::Point(static_cast<int>(200.0*cos(alpha)),
91 static_cast<int>(100.0*sin(alpha))),
92 DGtal::Z3i::RealPoint(cos(alpha),sin(alpha),cos(2.0*alpha)),
94 ImageAdapterExtractor extractedImage(imageVol, domainImage2D, embedder, idV);
96
98 //Display image and update its position
99 viewer << extractedImage;
101 pos++;
102 }
103
104
105
106 viewer.show();
107 return EXIT_SUCCESS;
108
109}
110// //
112
113
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
void show() override
Starts the event loop and display of elements.
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.