Mercurial > hg > orthanc
diff OrthancServer/Internals/DicomImageDecoder.cpp @ 861:a546b05a43da jpeg
fix PngWriter
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 07 Jun 2014 10:49:00 +0200 |
parents | 80c7e53a69b5 |
children | 3c0d0836f704 |
line wrap: on
line diff
--- a/OrthancServer/Internals/DicomImageDecoder.cpp Sat Jun 07 10:32:15 2014 +0200 +++ b/OrthancServer/Internals/DicomImageDecoder.cpp Sat Jun 07 10:49:00 2014 +0200 @@ -79,6 +79,7 @@ #include "../../Core/OrthancException.h" #include "../../Core/ImageFormats/ImageProcessing.h" +#include "../../Core/ImageFormats/PngWriter.h" // TODO REMOVE THIS #include "../../Core/DicomFormat/DicomIntegerPixelAccessor.h" #include "../ToDcmtkBridge.h" #include "../FromDcmtkBridge.h" @@ -589,7 +590,7 @@ PixelFormat format, Mode mode) { - // TODO OPTIMIZE THIS !!! + // TODO OPTIMIZE THIS (avoid unnecessary image copies) !!! ImageBuffer tmp; if (!Decode(tmp, dataset, frame)) @@ -597,6 +598,14 @@ return false; } + if (!IsUncompressedImage(dataset) && !IsJpegLossless(dataset)) + { + printf("ICI\n"); + PngWriter w; + ImageAccessor b(tmp.GetConstAccessor()); + w.WriteToFile("toto.png", b); + } + target.SetFormat(format); target.SetWidth(tmp.GetWidth()); target.SetHeight(tmp.GetHeight()); @@ -605,8 +614,12 @@ { case Mode_Truncate: { + if (!IsUncompressedImage(dataset) && !IsJpegLossless(dataset)) + { + printf("%d => %d\n", tmp.GetFormat(), target.GetFormat()); + } ImageAccessor a(target.GetAccessor()); - ImageAccessor b(tmp.GetAccessor()); + ImageAccessor b(tmp.GetConstAccessor()); ImageProcessing::Convert(a, b); return true; }