DGtal  0.9.3
Functions
viewer3D-8bis-2Dimages.cpp File Reference
#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"
Include dependency graph for viewer3D-8bis-2Dimages.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

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
Bertrand Kerautret (kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr ) LORIA (CNRS, UMR 7503), University of Nancy, France
Date
2013/11/18

An example file named viewer3D-8bis-2Dimages.

This file is part of the DGtal library.

Definition in file viewer3D-8bis-2Dimages.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

[ExampleViewer3D2DImagesExtractImagesNonSliceType]

[ExampleViewer3D2DImagesExtractImagesNonSliceType]

[ExampleViewer3D2DImagesExtractImagesNonSliceParam]

[ExampleViewer3D2DImagesExtractImagesNonSliceParam]

[ExampleViewer3D2DImagesExtractImagesNonSliceExtract]

[ExampleViewer3D2DImagesExtractImagesNonSliceExtract]

[ExampleViewer3D2DImagesExtractImagesNonSliceDisplay]

[ExampleViewer3D2DImagesExtractImagesNonSliceDisplay]

Definition at line 55 of file viewer3D-8bis-2Dimages.cpp.

References DGtal::Trace::endBlock(), IMAGE_PATCH_WIDTH, DGtal::Viewer3D< Space, KSpace >::show(), DGtal::trace, DGtal::Display3D< Space, KSpace >::updateDisplay, and DGtal::HyperRectDomain< TSpace >::upperBound().

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),
79  DGtal::Z2i::Point(IMAGE_PATCH_WIDTH, IMAGE_PATCH_WIDTH));
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::RealPoint(200.0*cos(alpha),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)),
100  embedder(Z2i::RealPoint(IMAGE_PATCH_WIDTH,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  trace.endBlock();
114  return 0;
115 }
Trace trace
Definition: Common.h:137
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
double endBlock()
Aim: Define a simple default functor that just returns its argument.
Aim: Functor that embeds a 2D point into a 3D space from two axis vectors and an origin point given i...
Aim: implements methods to read a "Vol" file format.
Definition: VolReader.h:89
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Space::RealPoint RealPoint
Definition: StdDefs.h:170
const int IMAGE_PATCH_WIDTH