#include <iostream>
#include <DGtal/base/Common.h>
#include "DGtal/io/readers/GenericReader.h"
#include "DGtal/io/writers/GenericWriter.h"
#include <DGtal/helpers/StdDefs.h>
#include <DGtal/images/ImageContainerBySTLVector.h>
#include <DGtal/images/ConstImageAdapter.h>
#include "DGtal/kernel/BasicPointFunctors.h"
using namespace std;
using namespace Z2i;
int main(
int argc,
char ** argv)
{
typedef ImageContainerBySTLVector<Z2i::Domain, unsigned char> Image2D;
typedef ImageContainerBySTLVector<Z3i::Domain, unsigned char> Image3D;
if(argc < 3)
{
trace.
error() <<
"You need to indicate the volumetric image name and slice number as parameters." << std::endl;
return 1;
}
std::string filename(argv[1]);
std::string outputFileName = "sliceImage.pgm";
unsigned int numSlice = atoi(argv[2]);
Image3D image3d = GenericReader< Image3D >::import ( filename );
functors::Identity id;
typedef ConstImageAdapter<Image3D, Image2D::Domain, functors::Projector<Z3i::Space>,
functors::Projector<Z2i::Space > proj(2);
Z2i::Domain domain2D(proj(image3d.domain().lowerBound()),
proj(image3d.domain().upperBound()));
SliceImageAdapter sliceImageZ(image3d, domain2D, aSliceFunctor, id);
sliceImageZ >> outputFileName;
return 0;
}
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
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)
int main(int argc, char **argv)
HyperRectDomain< Space > Domain