comparison Core/Images/ImageProcessing.cpp @ 1994:4d099fee5eca

ImageProcessing::Set for float images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 May 2016 15:45:49 +0200
parents e2a3ff770b48
children 7a969f235adf
comparison
equal deleted inserted replaced
1993:e2a3ff770b48 1994:4d099fee5eca
77 77
78 template <typename SourceType> 78 template <typename SourceType>
79 static void ConvertGrayscaleToFloat(ImageAccessor& target, 79 static void ConvertGrayscaleToFloat(ImageAccessor& target,
80 const ImageAccessor& source) 80 const ImageAccessor& source)
81 { 81 {
82 assert(sizeof(float) == 4);
83
82 for (unsigned int y = 0; y < source.GetHeight(); y++) 84 for (unsigned int y = 0; y < source.GetHeight(); y++)
83 { 85 {
84 float* t = reinterpret_cast<float*>(target.GetRow(y)); 86 float* t = reinterpret_cast<float*>(target.GetRow(y));
85 const SourceType* s = reinterpret_cast<const SourceType*>(source.GetConstRow(y)); 87 const SourceType* s = reinterpret_cast<const SourceType*>(source.GetConstRow(y));
86 88
537 539
538 case PixelFormat_SignedGrayscale16: 540 case PixelFormat_SignedGrayscale16:
539 SetInternal<int16_t>(image, value); 541 SetInternal<int16_t>(image, value);
540 return; 542 return;
541 543
544 case PixelFormat_Float32:
545 assert(sizeof(float) == 4);
546 SetInternal<float>(image, value);
547 return;
548
542 default: 549 default:
543 throw OrthancException(ErrorCode_NotImplemented); 550 throw OrthancException(ErrorCode_NotImplemented);
544 } 551 }
545 } 552 }
546 553