147 unsigned int nbok = 0;
155 for (VImage::Iterator it = image.begin(); it != image.end(); ++it)
158 trace.
info() <<
"Original image: " << image << endl;
166 MyImageAdapter restimage(image,
domain, idD, idV);
167 trace.
info() <<
"Restricted Image: " << restimage <<
" " << restimage.domain() << std::endl;
168 nbok += (restimage(
Z2i::Point(3,3)) == 3) ? 1 : 0;
170 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
171 <<
" read access on restricted Image" << endl;
181 MyImageAdapter2 restimage2(image,
domain, idD_2, idV_2, idVm1_2);
185 nbok += (restimage2(
Z2i::Point(2,2)) ==
true) ? 1 : 0;
187 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
188 <<
" write on restricted Image 2" << endl;
195 trace.
warning()<<
"Restricted image with false at (2,2) = "<< (int)(restimage2)(
Z2i::Point(2,2)) << std::endl;
196 nbok += (restimage2(
Z2i::Point(2,2)) ==
true) ? 1 : 0;
198 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
199 <<
" write on restricted Image 2" << endl;
207 MyTransValueFunctor<Z2i::Point> idD_3(
Z2i::Point(2,2));
211 MyImageAdapter3 restimage3(image,
domain, idD_3, idV_3, idVm1_3);
214 nbok += (image(
Z2i::Point(4,4)) == 5) ? 1 : 0;
216 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
217 <<
" write on restricted Image 3" << endl;
230 unsigned int nbok = 0;
238 for (VImage::Iterator it = image.begin(); it != image.end(); ++it)
241 trace.
info() <<
"Original image: " << image << endl;
251 MyImageAdapter restimage(image,
domain, idD, idV, idVm1);
252 trace.
info() <<
"Restricted Image: " << restimage <<
" " << restimage.domain() << std::endl;
256 MyImageAdapter::Range::OutputIterator it = restimage.range().outputIterator();
257 for (
int i = 0; i < maximalValue; ++i)
261 MyImageAdapter::ConstRange r = restimage.constRange();
262 std::copy( r.begin(), r.end(), std::ostream_iterator<int>(cout,
", ") );
265 std::vector<int> to_vector(9);
266 std::copy(r.begin(), r.end(), to_vector.begin());
267 for (
int i = 0; i < 9; i++)
291 unsigned int nbok = 0;
299 string filename = testPath +
"samples/church-small.pgm";
301 trace.
info() <<
"Imported image: " << image << endl;
308 aBoard.
saveCairo(
"church.png", Board2D::CairoPNG);
321 MyImageAdapter bell_tower(image, domain_bell_tower, idbtD, idbtV, idbtVm1);
324 trace.
info() <<
"ImageAdapter: " << bell_tower <<
" " << bell_tower.domain() << std::endl;
326 nbok += bell_tower.isValid() ? 1 : 0;
331 aBoard.
saveSVG(
"bell_tower.svg");
333 aBoard.
saveCairo(
"bell_tower.png", Board2D::CairoPNG);
344 MyImageAdapter cars(image, domain_cars, idcD, idcV, idcVm1);
346 trace.
info() <<
"ImageAdapter: " << cars <<
" " << cars.domain() << std::endl;
348 nbok += cars.isValid() ? 1 : 0;
355 aBoard.
saveCairo(
"cars.png", Board2D::CairoPNG);
359 MyImageAdapter::Domain::ConstIterator bt_it = bell_tower.domain().begin();
360 MyImageAdapter::Domain::ConstIterator bt_itEnd = bell_tower.domain().end();
361 for (; bt_it != bt_itEnd; ++bt_it)
363 bell_tower.setValue(*bt_it, 255);
368 aBoard.
saveSVG(
"bell_tower_after_filling.svg");
370 aBoard.
saveCairo(
"bell_tower_after_filling.png", Board2D::CairoPNG);
374 MyImageAdapter::Domain::ConstIterator c_it = cars.domain().begin();
375 MyImageAdapter::Domain::ConstIterator c_itEnd = cars.domain().end();
376 for (; c_it != c_itEnd; ++c_it)
378 cars.setValue(*c_it, 55);
383 aBoard.
saveSVG(
"cars_after_filling.svg");
385 aBoard.
saveCairo(
"cars_after_filling.png", Board2D::CairoPNG);
399 it != domain_floor_lamp.
end();
414 MyImageAdapter2 floor_lamp(image, my_specific_domain_floor_lamp, idflD, idflV, idflVm1);
417 trace.
info() <<
"ImageAdapter: " << floor_lamp <<
" " << floor_lamp.domain() << std::endl;
419 nbok += floor_lamp.isValid() ? 1 : 0;
424 aBoard.
saveSVG(
"floor_lamp.svg");
426 aBoard.
saveCairo(
"floor_lamp.png", Board2D::CairoPNG);
429 MyImageAdapter2::Domain::ConstIterator f_it = floor_lamp.domain().begin();
430 MyImageAdapter2::Domain::ConstIterator f_itEnd = floor_lamp.domain().end();
431 for (; f_it != f_itEnd; ++f_it)
433 floor_lamp.setValue(*f_it, 0);
438 aBoard.
saveSVG(
"floor_lamp_after_filling.svg");
440 aBoard.
saveCairo(
"floor_lamp_after_filling.png", Board2D::CairoPNG);
445 aBoard.
saveSVG(
"church_after_filling.svg");
447 aBoard.
saveCairo(
"church_after_filling.png", Board2D::CairoPNG);
450 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
451 <<
"true == true" << endl;
Aim: Constructs a domain limited to the given digital set.
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const ConstIterator & end() const