DGtal  1.5.beta
viewer3D-9-3Dimages.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/GenericReader.h"
#include "DGtal/images/ImageHelper.h"
#include "DGtal/images/Image.h"
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "DGtal/io/Color.h"
Include dependency graph for viewer3D-9-3Dimages.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/05/19

An example file named viewer3D-8-2Dimages.

This file is part of the DGtal library.

Definition in file viewer3D-9-3Dimages.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

[ExampleViewer3D3DImagesDisplayImagesColor]

[ExampleViewer3D3DImagesDisplayImagesColor]

Definition at line 75 of file viewer3D-9-3Dimages.cpp.

76 {
77 
79  QApplication application(argc,argv);
80  typedef Viewer3D<> MyViewer ;
81  MyViewer viewer;
82 
83  viewer.show();
84  std::string inputFilename = examplesPath + "samples/lobster.vol";
85  Image3D imageVol = GenericReader<Image3D>::import(inputFilename);
86 
87  Z3i::Point ptLow (100, 100, 20);
88  Z3i::Point ptUpp (200, 200, 40);
89  Z3i::Domain subDomain(ptLow, ptUpp);
90 
91  Z3i::Point ptLow2 (220, 50, 10);
92  Z3i::Point ptUpp2 (260, 100, 20);
93  Z3i::Domain subDomain2(ptLow2, ptUpp2);
94 
95  Image3D imageCrop(subDomain);
96  Image3D imageCrop2(subDomain2);
97 
98  for(Z3i::Domain::ConstIterator it= imageVol.domain().begin(), itend = imageVol.domain().end(); it != itend; ++it){
99  if(imageVol(*it)>140)
100  viewer << *it;
101  Z3i::Point pt = *it;
102  if(pt[0]>=ptLow[0] && pt[1] >= ptLow[1] && pt[2] >= ptLow[2] &&
103  pt[0]<=ptUpp[0] && pt[1] <= ptUpp[1] && pt[2] <= ptUpp[2]){
104  imageCrop.setValue(*it, imageVol(*it));
105  }
106 
107  if(pt[0]>=ptLow2[0] && pt[1] >= ptLow2[1] && pt[2] >= ptLow2[2] &&
108  pt[0]<=ptUpp2[0] && pt[1] <= ptUpp2[1] && pt[2] <= ptUpp2[2]){
109  imageCrop2.setValue(*it, imageVol(*it));
110  }
111  }
112  viewer << imageCrop;
113  viewer << SetMode3D(imageCrop.className(), "BoundingBox");
115  viewer << AddTextureImage3DWithFunctor<Image3D, hueFct, Z3i::Space, Z3i::KSpace> (imageCrop2, hueFct(), MyViewer::RGBMode);
116  viewer << MyViewer::updateDisplay;
118 
119  return application.exec();
120 }
Iterator for HyperRectDomain.
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: Provide a mechanism to load with the bestloader according to an image (2D or 3D) filename (by pa...
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....

References DGtal::Viewer3D< TSpace, TKSpace >::show().