Mercurial > hg > orthanc
comparison Core/DicomFormat/DicomIntegerPixelAccessor.cpp @ 465:7a966b440f19
signed images to PNG
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 12 Jul 2013 11:15:27 +0200 |
parents | 5987dd8e0776 |
children | 2890721b0f57 |
comparison
equal
deleted
inserted
replaced
464:5987dd8e0776 | 465:7a966b440f19 |
---|---|
243 v = v >> shift_; | 243 v = v >> shift_; |
244 | 244 |
245 if (v & signMask_) | 245 if (v & signMask_) |
246 { | 246 { |
247 // Signed value | 247 // Signed value |
248 return -static_cast<int32_t>(v & mask_); | 248 // http://en.wikipedia.org/wiki/Two%27s_complement#Subtraction_from_2N |
249 return -static_cast<int32_t>(mask_) + static_cast<int32_t>(v & mask_) - 1; | |
249 } | 250 } |
250 else | 251 else |
251 { | 252 { |
252 // Unsigned value | 253 // Unsigned value |
253 return static_cast<int32_t>(v & mask_); | 254 return static_cast<int32_t>(v & mask_); |