Mercurial > hg > orthanc
comparison Core/DicomParsing/Internals/DicomImageDecoder.cpp @ 2954:d924f9bb61cc
taking advantage of details in OrthancException
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Dec 2018 14:35:34 +0100 |
parents | 52217dc47a4e |
children | 4e43e67f8ecf |
comparison
equal
deleted
inserted
replaced
2953:210d5afd8f2b | 2954:d924f9bb61cc |
---|---|
631 !codec.decodeFrame(&representationParameter, | 631 !codec.decodeFrame(&representationParameter, |
632 pixelSequence, ¶meters, | 632 pixelSequence, ¶meters, |
633 &dataset, frame, startFragment, &uncompressed[0], | 633 &dataset, frame, startFragment, &uncompressed[0], |
634 uncompressed.size(), decompressedColorModel).good()) | 634 uncompressed.size(), decompressedColorModel).good()) |
635 { | 635 { |
636 LOG(ERROR) << "Cannot decode a palette image"; | 636 throw OrthancException(ErrorCode_BadFileFormat, |
637 throw OrthancException(ErrorCode_BadFileFormat); | 637 "Cannot decode a palette image"); |
638 } | 638 } |
639 | 639 |
640 return DecodeLookupTable(target, info, dataset, | 640 return DecodeLookupTable(target, info, dataset, |
641 reinterpret_cast<const uint8_t*>(uncompressed.c_str()), | 641 reinterpret_cast<const uint8_t*>(uncompressed.c_str()), |
642 uncompressed.size()); | 642 uncompressed.size()); |
646 if (!codec.decodeFrame(&representationParameter, | 646 if (!codec.decodeFrame(&representationParameter, |
647 pixelSequence, ¶meters, | 647 pixelSequence, ¶meters, |
648 &dataset, frame, startFragment, target->GetBuffer(), | 648 &dataset, frame, startFragment, target->GetBuffer(), |
649 target->GetSize(), decompressedColorModel).good()) | 649 target->GetSize(), decompressedColorModel).good()) |
650 { | 650 { |
651 LOG(ERROR) << "Cannot decode a non-palette image"; | 651 throw OrthancException(ErrorCode_BadFileFormat, |
652 throw OrthancException(ErrorCode_BadFileFormat); | 652 "Cannot decode a non-palette image"); |
653 } | 653 } |
654 | 654 |
655 return target.release(); | 655 return target.release(); |
656 } | 656 } |
657 } | 657 } |
804 { | 804 { |
805 return DecodeUncompressedImage(*converted, frame); | 805 return DecodeUncompressedImage(*converted, frame); |
806 } | 806 } |
807 } | 807 } |
808 | 808 |
809 LOG(ERROR) << "Cannot decode a DICOM image with the built-in decoder"; | 809 throw OrthancException(ErrorCode_BadFileFormat, |
810 throw OrthancException(ErrorCode_BadFileFormat); | 810 "Cannot decode a DICOM image with the built-in decoder"); |
811 } | 811 } |
812 | 812 |
813 | 813 |
814 static bool IsColorImage(PixelFormat format) | 814 static bool IsColorImage(PixelFormat format) |
815 { | 815 { |