Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
test3DImage3DView.cpp
Go to the documentation of this file.
1
16
29
31#include <iostream>
32#include "DGtal/base/Common.h"
33#include "DGtal/io/viewers/PolyscopeViewer.h"
34#include "DGtal/io/Color.h"
35#include "DGtal/io/readers/VolReader.h"
36#include "DGtal/helpers/StdDefs.h"
37#include "DGtal/shapes/Shapes.h"
38#include "DGtal/math/BasicMathFunctions.h"
39#include "DGtal/kernel/BasicPointFunctors.h"
40#include "ConfigTest.h"
41
42
44
45using namespace std;
46using namespace DGtal;
47using namespace Z3i;
48
49
51// Standard services - public :
52
53int main( int argc, char** argv )
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;
89 trace.endBlock();
90 viewer.show();
91 return 0;
92
93
94}
95// //
97
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:734
void show() override
Starts the event loop and display of elements.
HyperRectDomain< Space > Domain
Definition StdDefs.h:99
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
STL namespace.
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 initAddOneDim(const Dimension &newDim)
void initRemoveOneDim(const Dimension &dimRemoved)
int main()
Definition testBits.cpp:56