Example of 2D images extraction from 3D images and 3D visualisation.
#include <iostream>
#include <sstream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/images/ImageHelper.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/images/ImageSelector.h"
#include "DGtal/images/ConstImageAdapter.h"
#include "ConfigExamples.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/kernel/BasicPointFunctors.h"
int main(
int argc,
char** argv )
{
QApplication application(argc,argv);
viewer.setWindowTitle("simpleViewer");
typedef ImageSelector < Z3i::Domain, unsigned char>::Type Image3D;
typedef ImageSelector < Z2i::Domain, unsigned char>::Type Image2D;
std::string filename = examplesPath + "samples/lobster.vol";
invFunctor(image.domain().upperBound()));
trace.
beginBlock (
"Example extract2DImagesFrom3D" );
unsigned int pos=0;
for (unsigned int i=0; i<30; i+=5){
SliceImageAdapter sliceImageZ(image,
domain, aSliceFunctor, idV);
viewer << sliceImageZ;
viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(pos,
Viewer3D<>::zDirection, i*20, i*20, i*20 );
pos++;
}
ImageAdapterExtractor extractedImage(image, domainImage2D, embedder, idV);
viewer << extractedImage;
viewer << DGtal::UpdateImage3DEmbedding<Z3i::Space, Z3i::KSpace>(pos,
viewer << DGtal::Viewer3D<>::updateDisplay;
application.exec();
return 0;
}
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
const Point & upperBound() const
void beginBlock(const std::string &keyword="")
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: Functor that embeds a 2D point into a 3D space from two axis vectors and an origin point given i...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: implements methods to read a "Vol" file format.
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)