DGtal 1.3.0
Loading...
Searching...
No Matches
Functions
test3DImageViewEmbedder.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/readers/GenericReader.h"
#include "DGtal/io/writers/GenericWriter.h"
#include "DGtal/kernel/BasicPointFunctors.h"
#include "DGtal/images/ConstImageAdapter.h"
#include "DGtal/io/viewers/DrawWithViewer3DModifier.h"
#include "ConfigTest.h"
#include <limits>

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/25

Functions for testing class Viewer3D.

This file is part of the DGtal library.

Definition in file test3DImageViewEmbedder.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file test3DImageViewEmbedder.cpp.

62{
63
66 Image3D::Value, DGtal::functors::Identity > ImageAdapterExtractor;
67
68 QApplication application(argc,argv);
69 Viewer3D<> viewer;
70 viewer.setWindowTitle("simpleViewer");
71 viewer.show();
72
73 trace.beginBlock("Testing Viewer with Image Embedder ");
74 Point pcenter( 10, 20, 20 );
75 Point pcenterImg( 10, 20, 20 );
76
77 std::string filename = testPath + "samples/cat10.pgm3d";
78 Image3D image = DGtal::GenericReader<Image3D>::import(filename);
79
80 const int IMAGE_PATCH_WIDTH = 80;
81 // Setting the image domain of the resulting image to be displayed in 3D:
82 DGtal::Z2i::Domain domainImage2D (DGtal::Z2i::Point(0,0),
84
86 pcenterImg, Z3i::RealPoint(1, 1, 1),
89 pcenterImg, Z3i::RealPoint(1, 0, 0),
92 pcenterImg, Z3i::RealPoint(0, 1, 0 ),
95 pcenterImg, Z3i::RealPoint(0, 0, 1 ),
97
99 ImageAdapterExtractor extractedImage(image, domainImage2D, embedder, idV);
100 ImageAdapterExtractor extractedImage2(image, domainImage2D, embedder2, idV);
101 ImageAdapterExtractor extractedImage3(image, domainImage2D, embedder3, idV);
102 ImageAdapterExtractor extractedImage4(image, domainImage2D, embedder4, idV);
103
104 viewer << extractedImage;
105 viewer << extractedImage2;
106 viewer << extractedImage3;
107 viewer << extractedImage4;
108 viewer << DGtal::UpdateImage3DEmbedding<Z3i::Space, Z3i::KSpace>(0,
109 embedder(Z2i::RealPoint(0,0),false),
110 embedder(Z2i::RealPoint(IMAGE_PATCH_WIDTH,0),false),
111 embedder(domainImage2D.upperBound(), false),
112 embedder(Z2i::RealPoint(0, IMAGE_PATCH_WIDTH), false));
113 viewer << DGtal::UpdateImage3DEmbedding<Z3i::Space, Z3i::KSpace>(1,
114 embedder2(Z2i::RealPoint(0,0),false),
115 embedder2(Z2i::RealPoint(IMAGE_PATCH_WIDTH,0),false),
116 embedder2(domainImage2D.upperBound(), false),
117 embedder2(Z2i::RealPoint(0, IMAGE_PATCH_WIDTH), false));
118 viewer << DGtal::UpdateImage3DEmbedding<Z3i::Space, Z3i::KSpace>(2,
119 embedder3(Z2i::RealPoint(0,0),false),
120 embedder3(Z2i::RealPoint(IMAGE_PATCH_WIDTH,0),false),
121 embedder3(domainImage2D.upperBound(), false),
122 embedder3(Z2i::RealPoint(0, IMAGE_PATCH_WIDTH), false));
123 viewer << DGtal::UpdateImage3DEmbedding<Z3i::Space, Z3i::KSpace>(3,
124 embedder4(Z2i::RealPoint(0,0),false),
125 embedder4(Z2i::RealPoint(IMAGE_PATCH_WIDTH,0),false),
126 embedder4(domainImage2D.upperBound(), false),
127 embedder4(Z2i::RealPoint(0, IMAGE_PATCH_WIDTH), false));
128 viewer.setFillColor(DGtal::Color(250,20,20,255));
129 viewer << pcenter;
130
131
132
133 viewer << Viewer3D<>::updateDisplay;
134
135
136 bool res = application.exec();
137 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
138 trace.endBlock();
139 return res ? 0 : 1;
140
141}
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
virtual void setFillColor(DGtal::Color aColor)
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
double endBlock()
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
Trace trace
Definition: Common.h:154
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
Aim: Define a simple default functor that just returns its argument.

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), IMAGE_PATCH_WIDTH, DGtal::GenericReader< TContainer, Tdim, TValue >::import(), DGtal::Display3D< Space, KSpace >::setFillColor(), DGtal::Viewer3D< TSpace, TKSpace >::show(), DGtal::trace, and DGtal::HyperRectDomain< TSpace >::upperBound().