Mercurial > hg > orthanc
comparison OrthancServer/Internals/DicomImageDecoder.cpp @ 860:80c7e53a69b5 jpeg
bugfix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 07 Jun 2014 10:32:15 +0200 |
parents | 610a9a1ed855 |
children | a546b05a43da |
comparison
equal
deleted
inserted
replaced
859:610a9a1ed855 | 860:80c7e53a69b5 |
---|---|
167 { | 167 { |
168 assert(slowAccessor_.get() != NULL); | 168 assert(slowAccessor_.get() != NULL); |
169 return slowAccessor_->GetInformation().GetHeight(); | 169 return slowAccessor_->GetInformation().GetHeight(); |
170 } | 170 } |
171 | 171 |
172 unsigned int GetBytesPerPixel() const | |
173 { | |
174 assert(slowAccessor_.get() != NULL); | |
175 return slowAccessor_->GetInformation().GetBytesPerPixel(); | |
176 } | |
177 | |
178 unsigned int GetChannelCount() const | 172 unsigned int GetChannelCount() const |
179 { | 173 { |
180 assert(slowAccessor_.get() != NULL); | 174 assert(slowAccessor_.get() != NULL); |
181 return slowAccessor_->GetInformation().GetChannelCount(); | 175 return slowAccessor_->GetInformation().GetChannelCount(); |
182 } | 176 } |
322 | 316 |
323 if (!info.ExtractPixelFormat(format)) | 317 if (!info.ExtractPixelFormat(format)) |
324 { | 318 { |
325 LOG(WARNING) << "Unsupported DICOM image: " << info.GetBitsStored() | 319 LOG(WARNING) << "Unsupported DICOM image: " << info.GetBitsStored() |
326 << "bpp, " << info.GetChannelCount() << " channels, " | 320 << "bpp, " << info.GetChannelCount() << " channels, " |
327 << (info.IsSigned() ? "signed" : "unsigned"); | 321 << (info.IsSigned() ? "signed" : "unsigned") |
322 << (info.IsPlanar() ? ", planar" : ", non-planar"); | |
328 throw OrthancException(ErrorCode_NotImplemented); | 323 throw OrthancException(ErrorCode_NotImplemented); |
329 } | 324 } |
330 | 325 |
331 target.SetHeight(info.GetHeight()); | 326 target.SetHeight(info.GetHeight()); |
332 target.SetWidth(info.GetWidth()); | 327 target.SetWidth(info.GetWidth()); |
436 { | 431 { |
437 ImageAccessor sourceImage; | 432 ImageAccessor sourceImage; |
438 sourceImage.AssignReadOnly(sourceFormat, | 433 sourceImage.AssignReadOnly(sourceFormat, |
439 info.GetWidth(), | 434 info.GetWidth(), |
440 info.GetHeight(), | 435 info.GetHeight(), |
441 info.GetWidth() * info.GetBytesPerPixel(), | 436 info.GetWidth() * GetBytesPerPixel(sourceFormat), |
442 source.GetAccessor().GetPixelData()); | 437 source.GetAccessor().GetPixelData()); |
443 | 438 |
444 ImageProcessing::Convert(targetAccessor, sourceImage); | 439 ImageProcessing::Convert(targetAccessor, sourceImage); |
445 ImageProcessing::ShiftRight(targetAccessor, info.GetShift()); | 440 ImageProcessing::ShiftRight(targetAccessor, info.GetShift()); |
446 fastVersionSuccess = true; | 441 fastVersionSuccess = true; |
464 case PixelFormat_RGB24: | 459 case PixelFormat_RGB24: |
465 case PixelFormat_RGBA32: | 460 case PixelFormat_RGBA32: |
466 case PixelFormat_Grayscale8: | 461 case PixelFormat_Grayscale8: |
467 CopyPixels<uint8_t>(targetAccessor, source.GetAccessor()); | 462 CopyPixels<uint8_t>(targetAccessor, source.GetAccessor()); |
468 break; | 463 break; |
469 | 464 |
470 case PixelFormat_Grayscale16: | 465 case PixelFormat_Grayscale16: |
471 CopyPixels<uint16_t>(targetAccessor, source.GetAccessor()); | 466 CopyPixels<uint16_t>(targetAccessor, source.GetAccessor()); |
472 break; | 467 break; |
473 | 468 |
474 case PixelFormat_SignedGrayscale16: | 469 case PixelFormat_SignedGrayscale16: |
610 { | 605 { |
611 case Mode_Truncate: | 606 case Mode_Truncate: |
612 { | 607 { |
613 ImageAccessor a(target.GetAccessor()); | 608 ImageAccessor a(target.GetAccessor()); |
614 ImageAccessor b(tmp.GetAccessor()); | 609 ImageAccessor b(tmp.GetAccessor()); |
615 printf("IN\n"); | |
616 ImageProcessing::Convert(a, b); | 610 ImageProcessing::Convert(a, b); |
617 printf("OUT\n"); | |
618 return true; | 611 return true; |
619 } | 612 } |
620 | 613 |
621 default: | 614 default: |
622 throw OrthancException(ErrorCode_NotImplemented); | 615 throw OrthancException(ErrorCode_NotImplemented); |