Mercurial > hg > orthanc
diff OrthancServer/FromDcmtkBridge.cpp @ 874:87791ebc1f50
download matlab images
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 11 Jun 2014 12:23:02 +0200 |
parents | 2c545bb20dd3 |
children | e57e08ed510f 766a57997121 |
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp Wed Jun 11 09:18:07 2014 +0200 +++ b/OrthancServer/FromDcmtkBridge.cpp Wed Jun 11 12:23:02 2014 +0200 @@ -428,71 +428,6 @@ } - void FromDcmtkBridge::ExtractPngImage(std::string& result, - DcmDataset& dataset, - unsigned int frame, - ImageExtractionMode mode) - { - ImageBuffer tmp; - bool ok = false; - - switch (mode) - { - case ImageExtractionMode_UInt8: - ok = DicomImageDecoder::DecodeAndTruncate(tmp, dataset, frame, PixelFormat_Grayscale8); - break; - - case ImageExtractionMode_UInt16: - ok = DicomImageDecoder::DecodeAndTruncate(tmp, dataset, frame, PixelFormat_Grayscale16); - break; - - case ImageExtractionMode_Int16: - ok = DicomImageDecoder::DecodeAndTruncate(tmp, dataset, frame, PixelFormat_SignedGrayscale16); - break; - - case ImageExtractionMode_Preview: - ok = DicomImageDecoder::DecodePreview(tmp, dataset, frame); - break; - - default: - throw OrthancException(ErrorCode_ParameterOutOfRange); - } - - if (!ok) - { - throw OrthancException(ErrorCode_BadFileFormat); - } - - ImageAccessor accessor(tmp.GetAccessor()); - PngWriter writer; - writer.WriteToMemory(result, accessor); - } - - - void FromDcmtkBridge::ExtractPngImage(std::string& result, - const std::string& dicomContent, - unsigned int frame, - ImageExtractionMode mode) - { - DcmInputBufferStream is; - if (dicomContent.size() > 0) - { - is.setBuffer(&dicomContent[0], dicomContent.size()); - } - is.setEos(); - - DcmFileFormat dicom; - if (dicom.read(is).good()) - { - ExtractPngImage(result, *dicom.getDataset(), frame, mode); - } - else - { - throw OrthancException(ErrorCode_BadFileFormat); - } - } - - std::string FromDcmtkBridge::GetName(const DicomTag& t) {