comparison OrthancServer/Internals/DicomImageDecoder.cpp @ 859:610a9a1ed855 jpeg

ImageProcessing::Convert
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Jun 2014 18:12:31 +0200
parents ebc41566f742
children 80c7e53a69b5
comparison
equal deleted inserted replaced
858:ebc41566f742 859:610a9a1ed855
445 ImageProcessing::ShiftRight(targetAccessor, info.GetShift()); 445 ImageProcessing::ShiftRight(targetAccessor, info.GetShift());
446 fastVersionSuccess = true; 446 fastVersionSuccess = true;
447 } 447 }
448 catch (OrthancException&) 448 catch (OrthancException&)
449 { 449 {
450 // Unsupported conversion 450 // Unsupported conversion, use the slow version
451 } 451 }
452 } 452 }
453 453
454 454
455 /** 455 /**
456 * Loop over the DICOM buffer, storing its value into the target 456 * Slow version : loop over the DICOM buffer, storing its value
457 * image. 457 * into the target image.
458 **/ 458 **/
459 459
460 if (!fastVersionSuccess) 460 if (!fastVersionSuccess)
461 { 461 {
462 switch (target.GetFormat()) 462 switch (target.GetFormat())
531 { 531 {
532 throw OrthancException(ErrorCode_InternalError); 532 throw OrthancException(ErrorCode_InternalError);
533 } 533 }
534 } 534 }
535 #endif 535 #endif
536
536 537
537 538
538 539
539 bool DicomImageDecoder::Decode(ImageBuffer& target, 540 bool DicomImageDecoder::Decode(ImageBuffer& target,
540 DcmDataset& dataset, 541 DcmDataset& dataset,
583 } 584 }
584 } 585 }
585 586
586 return false; 587 return false;
587 } 588 }
589
590
591 bool DicomImageDecoder::Decode(ImageBuffer& target,
592 DcmDataset& dataset,
593 unsigned int frame,
594 PixelFormat format,
595 Mode mode)
596 {
597 // TODO OPTIMIZE THIS !!!
598
599 ImageBuffer tmp;
600 if (!Decode(tmp, dataset, frame))
601 {
602 return false;
603 }
604
605 target.SetFormat(format);
606 target.SetWidth(tmp.GetWidth());
607 target.SetHeight(tmp.GetHeight());
608
609 switch (mode)
610 {
611 case Mode_Truncate:
612 {
613 ImageAccessor a(target.GetAccessor());
614 ImageAccessor b(tmp.GetAccessor());
615 printf("IN\n");
616 ImageProcessing::Convert(a, b);
617 printf("OUT\n");
618 return true;
619 }
620
621 default:
622 throw OrthancException(ErrorCode_NotImplemented);
623 }
624
625 return false;
626 }
627
628
629
588 } 630 }