DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
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
45
using namespace
std
;
46
using namespace
DGtal
;
47
using namespace
Z3i
;
48
49
51
// Standard services - public :
52
53
int
main
()
54
{
55
typedef
DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char>
Image3D;
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:
72
DGtal::functors::Projector<DGtal::Z2i::Space>
invFunctor; invFunctor.
initRemoveOneDim
(2);
73
DGtal::Z2i::Domain
domain2D(invFunctor(image3d.domain().lowerBound()),
74
invFunctor(image3d.domain().upperBound()));
75
76
typedef
DGtal::ConstImageAdapter<Image3D, DGtal::Z2i::Domain, DGtal::functors::Projector< Z3i::Space>
,
77
Image3D::Value,
functors::Identity
> SliceImageAdapter;
78
functors::Identity
idV;
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
// //
DGtal::Color::Color
Color()
Definition
Color.h:139
DGtal::ConstImageAdapter
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Definition
ConstImageAdapter.h:106
DGtal::Display3D::draw
std::string draw(const Point &p, const std::string &uname="Point_{i}")
DGtal::Display3D::data
std::map< std::string, DisplayData< RealPoint > > data
Definition
Display3D.h:753
DGtal::ImageContainerBySTLVector
Definition
ImageContainerBySTLVector.h:127
DGtal::PolyscopeViewer
Definition
PolyscopeViewer.h:57
DGtal::PolyscopeViewer::show
void show() override
Starts the event loop and display of elements.
Definition
PolyscopeViewer.h:73
DGtal::Point
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::Trace::endBlock
double endBlock()
DGtal::Z2i::Domain
HyperRectDomain< Space > Domain
Definition
StdDefs.h:99
DGtal::Z3i
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
DGtal::VolReader::importVol
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
DGtal::functors::Identity
Aim: Define a simple default functor that just returns its argument.
Definition
BasicFunctors.h:288
DGtal::functors::Projector
Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an ...
Definition
BasicPointFunctors.h:107
DGtal::functors::Projector::initAddOneDim
void initAddOneDim(const Dimension &newDim)
DGtal::functors::Projector::initRemoveOneDim
void initRemoveOneDim(const Dimension &dimRemoved)
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
tests
io
viewers
test3DImage3DView.cpp
Generated on
for DGtal by
1.18.0