Mercurial > hg > orthanc
changeset 2865:0f07bdae0805
ImageAccessor::GetWriteableAccessor() and GetReadOnlyAccessor()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 05 Oct 2018 17:56:55 +0200 |
parents | 7cac2bc1986e |
children | 437e6ba20a5e |
files | Core/Images/ImageAccessor.cpp Core/Images/ImageAccessor.h |
diffstat | 2 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/Images/ImageAccessor.cpp Fri Oct 05 17:51:10 2018 +0200 +++ b/Core/Images/ImageAccessor.cpp Fri Oct 05 17:56:55 2018 +0200 @@ -204,6 +204,19 @@ } + void ImageAccessor::GetWriteableAccessor(ImageAccessor& target) const + { + if (readOnly_) + { + throw OrthancException(ErrorCode_ReadOnly); + } + else + { + target.AssignWritable(format_, width_, height_, pitch_, buffer_); + } + } + + void ImageAccessor::ToMatlabString(std::string& target) const { ChunkedBuffer buffer;
--- a/Core/Images/ImageAccessor.h Fri Oct 05 17:51:10 2018 +0200 +++ b/Core/Images/ImageAccessor.h Fri Oct 05 17:56:55 2018 +0200 @@ -135,12 +135,19 @@ unsigned int pitch, const void *buffer); + void GetReadOnlyAccessor(ImageAccessor& target) const + { + target.AssignReadOnly(format_, width_, height_, pitch_, buffer_); + } + void AssignWritable(PixelFormat format, unsigned int width, unsigned int height, unsigned int pitch, void *buffer); + void GetWriteableAccessor(ImageAccessor& target) const; + void ToMatlabString(std::string& target) const; void GetRegion(ImageAccessor& accessor,