refactor(iterator): improve iterator to access values
What does this MR do?
- Update Image and Array iterators to allow to access values on const iterators.
- Refactor Image iterator to remove complicated format and only use simple struct.
- removed warnings when getting an iterator on a type different from the array type. It allows to iterate through a multiple value structure at the same time.
Now, to iterate through an Array or an Image, you can use a struct like:
struct RGBA{
std::uint8t r;
std::uint8t g;
std::uint8t b;
std::uint8t a;
}
Then:
::fwData::Image::sptr image = ::fwData::Image::New();
image->resize(125, 125, 12, ::fwTools::Type::s_UINT8, ::fwData::Image::RGBA);
auto itr = image->begin< RGBA >();
const auto itrEnd = image->end< RGBA >();
for (; itr != itrEnd ; ++itr)
{
itr->r = 12.0;
itr->g = 12.0;
itr->b = 12.0;
itr->a = 12.0;
}
How to test it?
Launch fwDataTest
and all the other tests.