DGtal  1.5.beta
test3DImageView.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/viewers/DrawWithViewer3DModifier.h"
#include "DGtal/io/Color.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/io/readers/PGMReader.h"
#include "DGtal/io/readers/GenericReader.h"
#include "DGtal/io/writers/GenericWriter.h"
#include "DGtal/io/colormaps/BasicColorToScalarFunctors.h"
#include "DGtal/math/BasicMathFunctions.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "ConfigTest.h"
#include <limits>
Include dependency graph for test3DImageView.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
2011/01/03

Functions for testing class Viewer3D.

This file is part of the DGtal library.

Definition in file test3DImageView.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 73 of file test3DImageView.cpp.

74 {
77 
78  QApplication application(argc,argv);
79  Viewer3D<> viewer;
80  viewer.setWindowTitle("simpleViewer");
81  viewer.show();
82  trace.beginBlock("Testing Viewer with 3D Image View ");
83 
84  Point p1( 0, 0, 0 );
85  Point p2( 125, 188, 0 );
86  Point p3( 30, 30, 30 );
87 
88  std::string filename = testPath + "samples/church-small.pgm";
89  std::string filename3 = testPath + "samples/color64.ppm";
90 
91  imageNG image = DGtal::PGMReader<imageNG>::importPGM(filename);
92  imageNG image2 = DGtal::GenericReader<imageNG>::import(filename);
93  imageCol image3 = DGtal::GenericReader<imageCol>::import(filename3);
94  hueFct huefct;
95  functors::Identity defaultfunctor;
96 
97  viewer << DGtal::AddTextureImage2DWithFunctor<imageNG, hueFct , Z3i::Space, Z3i::KSpace>(image2, huefct, Viewer3D<>::RGBMode );
98  viewer << image;
99  viewer << DGtal::AddTextureImage2DWithFunctor<imageCol, functors::Identity, Z3i::Space, Z3i::KSpace>(image3, defaultfunctor, Viewer3D<>::RGBMode );
100  viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(0, Viewer3D<>::xDirection, 50, 50, 50 );
101  viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(2, Viewer3D<>::yDirection, 0, 0, 0);
102 
103  viewer << SetMode3D( image.domain().className(), "BoundingBox" );
104  viewer << image.domain();
105  viewer << DGtal::Update2DDomainPosition<Z3i::Space, Z3i::KSpace>(0, Viewer3D<>::xDirection, 0, 0, 0);
106  for(unsigned int i= 0; i< 10; i++){
107  if(i%4==0){
108  viewer << SetMode3D( image.className(), "" );
109  }else if(i%4==1){
110  viewer << SetMode3D( image.className(), "BoundingBox" );
111  }else if(i%4==2){
112  viewer << SetMode3D( image.className(), "Grid" );
113  }else if(i%4==3){
114  viewer << SetMode3D( image.className(), "InterGrid" );
115  }
116  viewer << image;
117  viewer << DGtal::UpdateImageData<imageNG>(i+3, image, i*50, i*50, i*50);
118  }
119 
120 
121  viewer << p1 << p2 << p3;
122  viewer << Viewer3D<>::updateDisplay;
123 
124 
125  bool res = application.exec();
126  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
127  trace.endBlock();
128  return res ? 0 : 1;
129 
130 
131 }
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...
Trace trace
Definition: Common.h:153
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
static ImageContainer importPGM(const std::string &aFilename, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Aim: Define a simple default functor that just returns its argument.
Image image(domain)

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), image(), DGtal::GenericReader< TContainer, Tdim, TValue >::import(), DGtal::PGMReader< TImageContainer, TFunctor >::importPGM(), DGtal::Viewer3D< TSpace, TKSpace >::show(), and DGtal::trace.