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> 50 using namespace DGtal;
65 ArrayImageAdapter< Value*, Domain >
image( data,
domain );
70 for (
auto it = image.begin(); it != image.end(); ++it )
72 *it = it.getPoint()[0];
76 const Domain sub_domain{ {1, 1}, {3, 2} };
77 ArrayImageAdapter< Value const*, Domain > cst_image( data,
domain, sub_domain );
82 for (
auto value : cst_image )
84 std::cout << value <<
" ";
86 std::cout << std::endl;
106 ArrayImageAdapter< Value*, Domain >
image( data, domain );
111 for (
auto & value : image )
116 Display2DFactory::drawImage<HueShadeDouble>(aBoard,
image, 0, domain.
size()-1);
117 aBoard.saveSVG(
"ArrayImageAdapter_image.svg");
125 ArrayImageAdapter< Value const*, Domain > constSubImage( data, domain, subDomain );
129 Display2DFactory::drawImage<HueShadeDouble>(aBoard, constSubImage, 0, domain.
size()-1);
130 aBoard.saveSVG(
"ArrayImageAdapter_subImage.svg");
137 ArrayImageAdapter< Value*, Domain > subImage( data, domain, subDomain );
147 for (
auto point : subImage.domain() )
150 subImage.setValue( point, 25*(cos(coord)+1) );
155 Display2DFactory::drawImage<HueShadeDouble>(aBoard,
image, 0, domain.
size()-1);
156 aBoard.saveSVG(
"ArrayImageAdapter_subImage_modifByDomain.svg");
162 for (
auto it = subImage.begin(), it_end = subImage.end(); it != it_end; ++it )
164 Value coord = (it.getPoint() -
Point(4,4)).norm();
165 *it = 25*(sin(coord)+1);
170 Display2DFactory::drawImage<HueShadeDouble>(aBoard,
image, 0, domain.
size()-1);
171 aBoard.saveSVG(
"ArrayImageAdapter_subImage_modifByImage.svg");
178 for (
auto& value : anIterableImage)
184 ArrayImageAdapter< ImageContainerBySTLVector<Domain,Value>::Iterator,
Domain > subImageSTL( anIterableImage.begin(),
domain, subDomain );
196 std::copy( subImage.cbegin(), subImage.cend(), subImageSTL.begin() );
200 Display2DFactory::drawImage<HueShadeDouble>(aBoard, anIterableImage, 0, domain.
size()-1);
201 aBoard.saveSVG(
"ArrayImageAdapter_subImage_copyToImageSTL.svg");
void beginBlock(const std::string &keyword="")
void ArrayImageAdapter_example()
const Domain domain(Point(1, 2), Point(6, 5))
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
ArrayImageAdapter< TArrayIterator, TDomain > makeArrayImageAdapterFromIterator(TArrayIterator anArrayIterator, TDomain const &aFullDomain, TDomain const &aViewDomain)
ArrayImageAdapter< decltype(((TImage *) nullptr) ->begin()), TDomain > makeArrayImageAdapterFromImage(TImage &anImage, TDomain const &aViewDomain)
void clear(const DGtal::Color &color=DGtal::Color::None)
DGtal is the top-level namespace which contains all DGtal functions and types.
void moduleImages_example()
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...