Mercurial > hg > orthanc
diff OrthancServer/Internals/DicomImageDecoder.cpp @ 859:610a9a1ed855 jpeg
ImageProcessing::Convert
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 06 Jun 2014 18:12:31 +0200 |
parents | ebc41566f742 |
children | 80c7e53a69b5 |
line wrap: on
line diff
--- a/OrthancServer/Internals/DicomImageDecoder.cpp Fri Jun 06 15:25:31 2014 +0200 +++ b/OrthancServer/Internals/DicomImageDecoder.cpp Fri Jun 06 18:12:31 2014 +0200 @@ -447,14 +447,14 @@ } catch (OrthancException&) { - // Unsupported conversion + // Unsupported conversion, use the slow version } } /** - * Loop over the DICOM buffer, storing its value into the target - * image. + * Slow version : loop over the DICOM buffer, storing its value + * into the target image. **/ if (!fastVersionSuccess) @@ -536,6 +536,7 @@ + bool DicomImageDecoder::Decode(ImageBuffer& target, DcmDataset& dataset, unsigned int frame) @@ -585,4 +586,45 @@ return false; } + + + bool DicomImageDecoder::Decode(ImageBuffer& target, + DcmDataset& dataset, + unsigned int frame, + PixelFormat format, + Mode mode) + { + // TODO OPTIMIZE THIS !!! + + ImageBuffer tmp; + if (!Decode(tmp, dataset, frame)) + { + return false; + } + + target.SetFormat(format); + target.SetWidth(tmp.GetWidth()); + target.SetHeight(tmp.GetHeight()); + + switch (mode) + { + case Mode_Truncate: + { + ImageAccessor a(target.GetAccessor()); + ImageAccessor b(tmp.GetAccessor()); + printf("IN\n"); + ImageProcessing::Convert(a, b); + printf("OUT\n"); + return true; + } + + default: + throw OrthancException(ErrorCode_NotImplemented); + } + + return false; + } + + + }