comparison Core/Images/ImageProcessing.cpp @ 2415:7e217a1cc63f

PixelFormat_Float32
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Oct 2017 22:02:05 +0200
parents e002430baa41
children 5a7c5c541a1d
comparison
equal deleted inserted replaced
2414:60950e4084ae 2415:7e217a1cc63f
411 ConvertGrayscaleToFloat<uint16_t>(target, source); 411 ConvertGrayscaleToFloat<uint16_t>(target, source);
412 return; 412 return;
413 } 413 }
414 414
415 if (target.GetFormat() == PixelFormat_Float32 && 415 if (target.GetFormat() == PixelFormat_Float32 &&
416 source.GetFormat() == PixelFormat_Grayscale32)
417 {
418 ConvertGrayscaleToFloat<uint32_t>(target, source);
419 return;
420 }
421
422 if (target.GetFormat() == PixelFormat_Float32 &&
416 source.GetFormat() == PixelFormat_SignedGrayscale16) 423 source.GetFormat() == PixelFormat_SignedGrayscale16)
417 { 424 {
418 ConvertGrayscaleToFloat<int16_t>(target, source); 425 ConvertGrayscaleToFloat<int16_t>(target, source);
419 return; 426 return;
420 } 427 }
575 SetInternal<uint8_t>(image, value); 582 SetInternal<uint8_t>(image, value);
576 return; 583 return;
577 584
578 case PixelFormat_Grayscale16: 585 case PixelFormat_Grayscale16:
579 SetInternal<uint16_t>(image, value); 586 SetInternal<uint16_t>(image, value);
587 return;
588
589 case PixelFormat_Grayscale32:
590 SetInternal<uint32_t>(image, value);
580 return; 591 return;
581 592
582 case PixelFormat_SignedGrayscale16: 593 case PixelFormat_SignedGrayscale16:
583 SetInternal<int16_t>(image, value); 594 SetInternal<int16_t>(image, value);
584 return; 595 return;
662 673
663 throw OrthancException(ErrorCode_NotImplemented); 674 throw OrthancException(ErrorCode_NotImplemented);
664 } 675 }
665 676
666 677
667 void ImageProcessing::GetMinMaxValue(int64_t& minValue, 678 void ImageProcessing::GetMinMaxIntegerValue(int64_t& minValue,
668 int64_t& maxValue, 679 int64_t& maxValue,
669 const ImageAccessor& image) 680 const ImageAccessor& image)
670 { 681 {
671 switch (image.GetFormat()) 682 switch (image.GetFormat())
672 { 683 {
673 case PixelFormat_Grayscale8: 684 case PixelFormat_Grayscale8:
674 { 685 {
686 minValue = a; 697 minValue = a;
687 maxValue = b; 698 maxValue = b;
688 break; 699 break;
689 } 700 }
690 701
702 case PixelFormat_Grayscale32:
703 {
704 uint32_t a, b;
705 GetMinMaxValueInternal<uint32_t>(a, b, image);
706 minValue = a;
707 maxValue = b;
708 break;
709 }
710
691 case PixelFormat_SignedGrayscale16: 711 case PixelFormat_SignedGrayscale16:
692 { 712 {
693 int16_t a, b; 713 int16_t a, b;
694 GetMinMaxValueInternal<int16_t>(a, b, image); 714 GetMinMaxValueInternal<int16_t>(a, b, image);
695 minValue = a; 715 minValue = a;
701 throw OrthancException(ErrorCode_NotImplemented); 721 throw OrthancException(ErrorCode_NotImplemented);
702 } 722 }
703 } 723 }
704 724
705 725
726 void ImageProcessing::GetMinMaxFloatValue(float& minValue,
727 float& maxValue,
728 const ImageAccessor& image)
729 {
730 switch (image.GetFormat())
731 {
732 case PixelFormat_Float32:
733 {
734 assert(sizeof(float) == 32);
735 float a, b;
736 GetMinMaxValueInternal<float>(a, b, image);
737 minValue = a;
738 maxValue = b;
739 break;
740 }
741
742 default:
743 throw OrthancException(ErrorCode_NotImplemented);
744 }
745 }
746
747
706 748
707 void ImageProcessing::AddConstant(ImageAccessor& image, 749 void ImageProcessing::AddConstant(ImageAccessor& image,
708 int64_t value) 750 int64_t value)
709 { 751 {
710 switch (image.GetFormat()) 752 switch (image.GetFormat())