comparison OrthancServer/Internals/DicomImageDecoder.cpp @ 858:ebc41566f742 jpeg

removed unneeded check
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Jun 2014 15:25:31 +0200
parents ff530685e46a
children 610a9a1ed855
comparison
equal deleted inserted replaced
857:f53358c70c05 858:ebc41566f742
404 unsigned int frame) 404 unsigned int frame)
405 { 405 {
406 ImageSource source; 406 ImageSource source;
407 source.Setup(dataset, frame); 407 source.Setup(dataset, frame);
408 408
409
409 /** 410 /**
410 * Resize the target image, with some sanity checks. 411 * Resize the target image.
411 **/ 412 **/
412 413
413 SetupImageBuffer(target, dataset); 414 SetupImageBuffer(target, dataset);
414 415
415 if (source.GetWidth() != target.GetWidth() || 416 if (source.GetWidth() != target.GetWidth() ||
416 source.GetHeight() != target.GetHeight()) 417 source.GetHeight() != target.GetHeight())
417 {
418 throw OrthancException(ErrorCode_InternalError);
419 }
420
421 bool ok;
422 switch (target.GetFormat())
423 {
424 case PixelFormat_RGB24:
425 ok = source.GetChannelCount() == 3;
426 break;
427
428 case PixelFormat_RGBA32:
429 ok = source.GetChannelCount() == 4;
430 break;
431
432 case PixelFormat_Grayscale8:
433 case PixelFormat_Grayscale16:
434 case PixelFormat_SignedGrayscale16:
435 ok = source.GetChannelCount() == 1;
436 break;
437
438 default:
439 ok = false;
440 break;
441 }
442
443 if (!ok)
444 { 418 {
445 throw OrthancException(ErrorCode_InternalError); 419 throw OrthancException(ErrorCode_InternalError);
446 } 420 }
447 421
448 422