Example of TiledImage.
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/images/ImageFactoryFromImage.h"
#include "DGtal/images/TiledImage.h"
using namespace std;
{
Board2D aBoard;
typedef HueShadeColorMap<int> HueShade;
typedef ImageContainerBySTLVector<Z2i::Domain, int> VImage;
int i = 1;
for (VImage::Iterator it = image.begin(); it != image.end(); ++it)
*it = i++;
aBoard.clear();
Display2DFactory::drawImage<HueShade>(aBoard, image, (int)0, (int)255);
aBoard.saveSVG("tiledImage-image.svg");
#ifdef WITH_CAIRO
aBoard.saveCairo("tiledImage-image.png", Board2D::CairoPNG);
#endif
trace.
info() <<
"ORIGINAL image: " << image << endl;
typedef ImageFactoryFromImage<VImage> MyImageFactoryFromImage;
typedef MyImageFactoryFromImage::OutputImage OutputImage;
MyImageFactoryFromImage imageFactoryFromImage(image);
typedef ImageCacheReadPolicyFIFO<OutputImage, MyImageFactoryFromImage> MyImageCacheReadPolicyFIFO;
typedef ImageCacheWritePolicyWT<OutputImage, MyImageFactoryFromImage> MyImageCacheWritePolicyWT;
MyImageCacheReadPolicyFIFO imageCacheReadPolicyFIFO(imageFactoryFromImage, 2);
MyImageCacheWritePolicyWT imageCacheWritePolicyWT(imageFactoryFromImage);
typedef TiledImage<VImage, MyImageFactoryFromImage, MyImageCacheReadPolicyFIFO, MyImageCacheWritePolicyWT> MyTiledImage;
BOOST_CONCEPT_ASSERT(( concepts::CImage< MyTiledImage > ));
MyTiledImage tiledImage(imageFactoryFromImage, imageCacheReadPolicyFIFO, imageCacheWritePolicyWT, 4);
trace.
info() <<
"tiledImage image: " << tiledImage << endl;
typedef MyTiledImage::OutputImage OutputImage;
aValue = 1; tiledImage.setValue(
Z2i::Point(11,7), aValue);
trace.
info() <<
"Write value for Point 11,7: " << aValue << endl;
aValue = 128; tiledImage.setValue(
Z2i::Point(16,1), aValue);
trace.
info() <<
"Write value for Point 16,1: " << aValue << endl;
aBoard.clear();
Display2DFactory::drawImage<HueShade>(aBoard, image, (int)0, (int)255);
aBoard.saveSVG("tiledImage-image2.svg");
#ifdef WITH_CAIRO
aBoard.saveCairo("tiledImage-image2.png", Board2D::CairoPNG);
#endif
return 0;
}
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
HyperRectDomain< Space > Domain