7 #ifndef __FWDATATOOLS_IMAGEDIFF_HPP__ 8 #define __FWDATATOOLS_IMAGEDIFF_HPP__ 10 #include "fwDataTools/config.hpp" 11 #include "fwDataTools/helper/Image.hpp" 13 #include <fwData/Image.hpp> 27 ::fwData::Image::IndexType m_index;
28 ::fwData::Image::BufferType* m_oldValue;
29 ::fwData::Image::BufferType* m_newValue;
33 FWDATATOOLS_API
ImageDiff(
const size_t imageElementSize = 0,
const size_t reservedElements = 0);
36 FWDATATOOLS_API ~ImageDiff();
39 FWDATATOOLS_API ImageDiff(
const ImageDiff& other);
42 FWDATATOOLS_API ImageDiff(ImageDiff&& other);
45 FWDATATOOLS_API ImageDiff& operator= (
const ImageDiff& other);
48 FWDATATOOLS_API ImageDiff& operator= (ImageDiff&& other);
51 FWDATATOOLS_API
void addDiff(
const ImageDiff& diff);
54 FWDATATOOLS_API
void addDiff(const ::fwData::Image::IndexType index, const ::fwData::Image::BufferType* oldValue,
55 const ::fwData::Image::BufferType* newValue);
58 FWDATATOOLS_API
void applyDiff(const ::fwData::Image::sptr& img)
const;
61 FWDATATOOLS_API
void revertDiff(const ::fwData::Image::sptr& img)
const;
64 FWDATATOOLS_API
size_t getSize()
const;
67 FWDATATOOLS_API
size_t getNumberOfElements()
const;
70 FWDATATOOLS_API
void clear();
73 FWDATATOOLS_API
void shrink();
76 FWDATATOOLS_API
ElementType getElement(
size_t index)
const;
79 inline ::fwData::Image::IndexType getElementDiffIndex(
size_t eltIndex)
const;
87 void revertDiffElt(
helper::Image& img,
size_t eltIndex)
const;
99 size_t m_reservedSize;
102 std::uint8_t* m_buffer;
109 std::uint8_t* eltPtr = m_buffer + eltIndex * m_eltSize;
110 return *
reinterpret_cast< ::fwData::Image::IndexType*
>(eltPtr);
115 #endif // __FWDATATOOLS_IMAGEDIFF_HPP__