comparison Framework/ImageToolbox.cpp @ 323:429c4efa1fde

added option --force-openslide
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Oct 2024 19:36:01 +0200
parents 8ad12abde290
children
comparison
equal deleted inserted replaced
322:778e08291d52 323:429c4efa1fde
285 # warning You are using an old version of the Orthanc framework 285 # warning You are using an old version of the Orthanc framework
286 # endif 286 # endif
287 const unsigned int width = image.GetWidth(); 287 const unsigned int width = image.GetWidth();
288 const unsigned int height = image.GetHeight(); 288 const unsigned int height = image.GetHeight();
289 const unsigned int pitch = image.GetPitch(); 289 const unsigned int pitch = image.GetPitch();
290 uint8_t* buffer = reinterpret_cast<uint8_t*>(image.GetBuffer());
291 290
292 if (image.GetFormat() != Orthanc::PixelFormat_RGB24 || 291 if (image.GetFormat() != Orthanc::PixelFormat_RGB24 ||
293 pitch < 3 * width) 292 pitch < 3 * width)
294 { 293 {
295 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); 294 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat);
296 } 295 }
297 296
298 for (unsigned int y = 0; y < height; y++) 297 for (unsigned int y = 0; y < height; y++)
299 { 298 {
300 uint8_t* p = buffer + y * pitch; 299 uint8_t* p = reinterpret_cast<uint8_t*>(image.GetRow(y));
301 300
302 for (unsigned int x = 0; x < width; x++, p += 3) 301 for (unsigned int x = 0; x < width; x++, p += 3)
303 { 302 {
304 const float Y = p[0]; 303 const float Y = p[0];
305 const float Cb = p[1]; 304 const float Cb = p[1];