DGtal  1.3.beta
io/viewers/viewer3D-8bis-2Dimages.cpp

Example of 2D image display in 3D by 3D embedding.

Illustration of multiple 2D image extraction and visualisation from 3D embedding
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/images/ImageHelper.h"
#include "ConfigExamples.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/kernel/BasicPointFunctors.h"
using namespace std;
using namespace DGtal;
int main( int argc, char** argv )
{
Image3D::Value, DGtal::functors::Identity > ImageAdapterExtractor;
QApplication application(argc,argv);
MyViewer viewer;
viewer.show();
std::string inputFilename = examplesPath + "samples/lobster.vol";
Image3D imageVol = VolReader<Image3D>::importVol(inputFilename);
DGtal::Z3i::Point ptCenter(50, 62, 28);
const int IMAGE_PATCH_WIDTH = 20;
// Setting the image domain of the resulting image to be displayed in 3D:
unsigned int pos=0;
for (double alpha = 0; alpha< 1.54; alpha+= 0.01){
// Extracting images from 3D embeder
ptCenter+DGtal::Z3i::Point(static_cast<int>(200.0*cos(alpha)),static_cast<int>(100.0*sin(alpha))),
DGtal::Z3i::RealPoint(cos(alpha),sin(alpha),cos(2.0*alpha)),
ImageAdapterExtractor extractedImage(imageVol, domainImage2D, embedder, idV);
//Display image and update its position with embeder
viewer << extractedImage;
viewer << DGtal::UpdateImage3DEmbedding<Z3i::Space, Z3i::KSpace>(pos,
embedder(Z2i::RealPoint(0,0)),
embedder(domainImage2D.upperBound()),
pos++;
}
return application.exec();
}
// //
DGtal::HyperRectDomain< Space >
DGtal::ImageContainerBySTLVector
Definition: ImageContainerBySTLVector.h:126
DGtal::HyperRectDomain::upperBound
const Point & upperBound() const
DGtal::Display3D::updateDisplay
@ updateDisplay
Definition: Display3D.h:249
DGtal::functors::Identity
Aim: Define a simple default functor that just returns its argument.
Definition: BasicFunctors.h:287
DGtal::ConstImageAdapter
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Definition: ConstImageAdapter.h:105
DGtal::Viewer3D
Definition: Viewer3D.h:135
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
main
int main(int argc, char **argv)
Definition: testArithmeticDSS-benchmark.cpp:147
DGtal::PointVector< dim, Integer >
DGtal::VolReader
Aim: implements methods to read a "Vol" file format.
Definition: VolReader.h:89
DGtal::Viewer3D::show
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
IMAGE_PATCH_WIDTH
const int IMAGE_PATCH_WIDTH
Definition: extract2DImagesFrom3D.cpp:59
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38
DGtal::functors::Point2DEmbedderIn3D
Aim: Functor that embeds a 2D point into a 3D space from two axis vectors and an origin point given i...
Definition: BasicPointFunctors.h:372