33#include <DGtal/base/Common.h>
34#include <DGtal/helpers/StdDefs.h>
36#include <DGtal/io/boards/Board2D.h>
42#include <DGtal/io/colormaps/HueShadeColorMap.h>
43#include <DGtal/images/ImageContainerBySTLVector.h>
44#include <DGtal/images/ArrayImageAdapter.h>
66 ArrayImageAdapter< Value*, Domain > image( data,
domain );
71 for (
auto it = image.begin(); it != image.end(); ++it )
73 *it = it.getPoint()[0];
78 ArrayImageAdapter< Value const*, Domain > cst_image( data,
domain, sub_domain );
83 for (
auto value : cst_image )
85 std::cout << value <<
" ";
87 std::cout << std::endl;
107 ArrayImageAdapter< Value*, Domain > image( data,
domain );
112 for (
auto & value : image )
117 Display2DFactory::drawImage<HueShadeDouble>(aBoard, image, 0,
domain.
size()-1);
118 aBoard.
saveSVG(
"ArrayImageAdapter_image.svg");
126 ArrayImageAdapter< Value const*, Domain > constSubImage( data,
domain, subDomain );
130 Display2DFactory::drawImage<HueShadeDouble>(aBoard, constSubImage, 0,
domain.
size()-1);
131 aBoard.
saveSVG(
"ArrayImageAdapter_subImage.svg");
138 ArrayImageAdapter< Value*, Domain > subImage( data,
domain, subDomain );
148 for (
auto point : subImage.domain() )
151 subImage.setValue( point, 25*(cos(coord)+1) );
156 Display2DFactory::drawImage<HueShadeDouble>(aBoard, image, 0,
domain.
size()-1);
157 aBoard.
saveSVG(
"ArrayImageAdapter_subImage_modifByDomain.svg");
163 for (
auto it = subImage.begin(), it_end = subImage.end(); it != it_end; ++it )
165 Value coord = (it.getPoint() -
Point(4,4)).norm();
166 *it = 25*(sin(coord)+1);
171 Display2DFactory::drawImage<HueShadeDouble>(aBoard, image, 0,
domain.
size()-1);
172 aBoard.
saveSVG(
"ArrayImageAdapter_subImage_modifByImage.svg");
179 for (
auto& value : anIterableImage)
185 ArrayImageAdapter< ImageContainerBySTLVector<Domain,Value>::Iterator,
Domain > subImageSTL( anIterableImage.begin(),
domain, subDomain );
197 std::copy( subImage.cbegin(), subImage.cend(), subImageSTL.begin() );
201 Display2DFactory::drawImage<HueShadeDouble>(aBoard, anIterableImage, 0,
domain.
size()-1);
202 aBoard.
saveSVG(
"ArrayImageAdapter_subImage_copyToImageSTL.svg");
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...
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 moduleImages_example()
void ArrayImageAdapter_example()
DGtal is the top-level namespace which contains all DGtal functions and types.
ArrayImageAdapter< TArrayIterator, TDomain > makeArrayImageAdapterFromIterator(TArrayIterator anArrayIterator, TDomain const &aFullDomain, TDomain const &aViewDomain)
ArrayImageAdapter< decltype(((TImage *) nullptr) ->begin()), TDomain > makeArrayImageAdapterFromImage(TImage &anImage, TDomain const &aViewDomain)