DGtal 2.1.0
Loading...
Searching...
No Matches
test3DImage3DView.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/viewers/PolyscopeViewer.h"
#include "DGtal/io/Color.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/math/BasicMathFunctions.h"
#include "DGtal/kernel/BasicPointFunctors.h"
#include "ConfigTest.h"
Include dependency graph for test3DImage3DView.cpp:

Go to the source code of this file.

Functions

int main ()
 

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/04/29

Functions for testing class PolyscopeViewer.

This file is part of the DGtal library.

Definition in file test3DImage3DView.cpp.

Function Documentation

◆ main()

int main ( void  )

Definition at line 53 of file test3DImage3DView.cpp.

54{
56
57 PolyscopeViewer viewer;
58 trace.beginBlock("Testing Viewer with display of 3D Image ");
59
60 Point p1( 0, 0, 0 );
61 Point p2( 125, 188, 0 );
62 Point p3( 30, 30, 30 );
63
64 std::string filename = testPath + "samples/lobsterCroped.vol";
65
66 Image3D image3d = VolReader<Image3D>::importVol(filename);
67
68 viewer << Color(255, 255, 200);
69 viewer << image3d;
70 // Extract some slice images:
71 // Get the 2D domain of the slice:
73 DGtal::Z2i::Domain domain2D(invFunctor(image3d.domain().lowerBound()),
74 invFunctor(image3d.domain().upperBound()));
75
77 Image3D::Value, functors::Identity > SliceImageAdapter;
79 functors::Projector<DGtal::Z3i::Space> aSliceFunctorZ(5); aSliceFunctorZ.initAddOneDim(2);
80
81 SliceImageAdapter sliceImageZ(image3d, domain2D, aSliceFunctorZ, idV);
82
83 std::string name = viewer.draw(sliceImageZ);
84 viewer.data[name].transform.translate(Eigen::Vector3d(0, 0, -10));
85
86 viewer << p1 << p2 << p3;
87
88 trace.emphase() << "Passed." << endl;
90 viewer.show();
91 return 0;
92
93
94}
Structure representing an RGB triple with alpha component.
Definition Color.h:77
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
std::string draw(const Point &p, const std::string &uname="Point_{i}")
std::map< std::string, DisplayData< RealPoint > > data
Definition Display3D.h:744
void show() override
Starts the event loop and display of elements.
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
double endBlock()
Trace trace
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Aim: Define a simple default functor that just returns its argument.
Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an ...
void initRemoveOneDim(const Dimension &dimRemoved)

References DGtal::Trace::beginBlock(), DGtal::Display3D< Space, KSpace >::data, DGtal::Display3D< Space, KSpace >::draw(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::VolReader< TImageContainer, TFunctor >::importVol(), DGtal::functors::Projector< S >::initAddOneDim(), DGtal::functors::Projector< S >::initRemoveOneDim(), DGtal::PolyscopeViewer< Space, KSpace >::show(), and DGtal::trace.