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"
{
int i = 1;
for (VImage::Iterator it = image.begin(); it != image.end(); ++it)
*it = i++;
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 MyImageFactoryFromImage::OutputImage OutputImage;
MyImageFactoryFromImage imageFactoryFromImage(image);
MyImageCacheReadPolicyFIFO imageCacheReadPolicyFIFO(imageFactoryFromImage, 2);
MyImageCacheWritePolicyWT imageCacheWritePolicyWT(imageFactoryFromImage);
MyTiledImage tiledImage(imageFactoryFromImage, imageCacheReadPolicyFIFO, imageCacheWritePolicyWT, 4);
trace.
info() <<
"tiledImage image: " << tiledImage << endl;
typedef MyTiledImage::OutputImage OutputImage;
OutputImage::Value aValue;
trace.
beginBlock(
"read and write on MyTiledImage");
trace.
info() <<
"Read value for Point 4,2: " << tiledImage(
Z2i::Point(4,2)) << endl;
trace.
info() <<
"Read value for Point 10,6: " << tiledImage(
Z2i::Point(10,6)) << endl;
aValue = 1; tiledImage.setValue(
Z2i::Point(11,7), aValue);
trace.
info() <<
"Write value for Point 11,7: " << aValue << endl;
trace.
info() <<
"Read value for Point 2,3: " << tiledImage(
Z2i::Point(2,3)) << endl;
trace.
info() <<
"Read value for Point 16,1: " << tiledImage(
Z2i::Point(16,1)) << endl;
aValue = 128; tiledImage.setValue(
Z2i::Point(16,1), aValue);
trace.
info() <<
"Write value for Point 16,1: " << aValue << endl;
trace.
info() <<
" Point 16,1 on ORIGINAL image, value: " << image(
Z2i::Point(16,1)) << endl;
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;
}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: implements a 'FIFO' read policy cache.
Aim: implements a 'WT (Write-through)' write policy cache.
Aim: implements a factory to produce images from a "bigger/original" one according to a given domain.
Aim: implements a tiled image from a "bigger/original" one from an ImageFactory.
void beginBlock(const std::string &keyword="")
void clear(const DGtal::Color &color=DGtal::Color::None)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Defines the concept describing a read/write image, having an output iterator.