#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/images/ImageHelper.h"
#include "ConfigExamples.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/viewers/DrawWithViewer3DModifier.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "DGtal/io/Color.h"
using namespace std;
struct hueFct{
inline
unsigned int operator() (unsigned char aVal) const
{
HueShadeColorMap<unsigned char> hueShade(0,255);
Color col = hueShade((unsigned char)aVal);
return (((unsigned int) col.red()) << 16)| (((unsigned int) col.green()) << 8)|((unsigned int) col.blue());
}
};
int main(
int argc,
char** argv )
{
QApplication application(argc,argv);
typedef Viewer3D<> MyViewer;
MyViewer viewer;
viewer.show();
std::string inputFilename = examplesPath + "samples/lobster.vol";
Image3D imageVol = VolReader<Image3D>::importVol(inputFilename);
transTo2DdomainFunctorZ(imageVol.domain().upperBound()));
MySliceImageAdapter aSliceImageZ(imageVol, domain2DZ, aSliceFunctorZ, identityFunctor );
transTo2DdomainFunctorY(imageVol.domain().upperBound()));
MySliceImageAdapter aSliceImageY(imageVol, domain2DY, aSliceFunctorY, identityFunctor );
viewer << SetMode3D(aSliceImageZ.className(), "BoundingBox");
viewer << MyViewer::updateDisplay;
viewer << aSliceImageZ;
viewer << aSliceImageY;
viewer << SetMode3D(aSliceImageZ.className(), "");
viewer << AddTextureImage2DWithFunctor<MySliceImageAdapter, hueFct, Z3i::Space, Z3i::KSpace> (aSliceImageZ, hueFct(), Viewer3D<Z3i::Space, Z3i::KSpace>::RGBMode);
viewer << AddTextureImage2DWithFunctor<MySliceImageAdapter, hueFct, Z3i::Space, Z3i::KSpace> (aSliceImageY, hueFct(), Viewer3D<Z3i::Space, Z3i::KSpace>::RGBMode);
viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(1, MyViewer::yDirection, 0.0, 50.0, 0.0);
viewer << DGtal::UpdateImageData<MySliceImageAdapter>(0, aSliceImageZ, 0, 0, 10);
viewer << MyViewer::updateDisplay;
viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(3, MyViewer::yDirection, 500.0, 50.0, 0.0);
viewer << DGtal::UpdateImageData<MySliceImageAdapter, hueFct>(2, aSliceImageZ, 500, 0, 10, 0.0, MyViewer::zDirection, hueFct());
viewer << MyViewer::updateDisplay;
return application.exec();
}
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
DGtal is the top-level namespace which contains all DGtal functions and types.
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)
int main(int argc, char **argv)