Mercurial > hg > orthanc
comparison Core/Images/ImageAccessor.cpp @ 2103:a89ca69ec1d1
ImageAccessor::SetFormat
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 13 Oct 2016 11:42:30 +0200 |
parents | e2a3ff770b48 |
children | a3a65de1840f |
comparison
equal
deleted
inserted
replaced
2102:f0544ab9396b | 2103:a89ca69ec1d1 |
---|---|
273 } | 273 } |
274 | 274 |
275 return result; | 275 return result; |
276 } | 276 } |
277 | 277 |
278 | |
279 void ImageAccessor::SetFormat(PixelFormat format) | |
280 { | |
281 if (readOnly_) | |
282 { | |
283 #if ORTHANC_ENABLE_LOGGING == 1 | |
284 LOG(ERROR) << "Trying to modify the format of a read-only image"; | |
285 #endif | |
286 throw OrthancException(ErrorCode_ReadOnly); | |
287 } | |
288 | |
289 if (::Orthanc::GetBytesPerPixel(format) != ::Orthanc::GetBytesPerPixel(format_)) | |
290 { | |
291 throw OrthancException(ErrorCode_IncompatibleImageFormat); | |
292 } | |
293 | |
294 format_ = format; | |
295 } | |
278 } | 296 } |