Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
860:80c7e53a69b5 | 861:a546b05a43da |
---|---|
77 | 77 |
78 | 78 |
79 | 79 |
80 #include "../../Core/OrthancException.h" | 80 #include "../../Core/OrthancException.h" |
81 #include "../../Core/ImageFormats/ImageProcessing.h" | 81 #include "../../Core/ImageFormats/ImageProcessing.h" |
82 #include "../../Core/ImageFormats/PngWriter.h" // TODO REMOVE THIS | |
82 #include "../../Core/DicomFormat/DicomIntegerPixelAccessor.h" | 83 #include "../../Core/DicomFormat/DicomIntegerPixelAccessor.h" |
83 #include "../ToDcmtkBridge.h" | 84 #include "../ToDcmtkBridge.h" |
84 #include "../FromDcmtkBridge.h" | 85 #include "../FromDcmtkBridge.h" |
85 | 86 |
86 #include <glog/logging.h> | 87 #include <glog/logging.h> |
587 DcmDataset& dataset, | 588 DcmDataset& dataset, |
588 unsigned int frame, | 589 unsigned int frame, |
589 PixelFormat format, | 590 PixelFormat format, |
590 Mode mode) | 591 Mode mode) |
591 { | 592 { |
592 // TODO OPTIMIZE THIS !!! | 593 // TODO OPTIMIZE THIS (avoid unnecessary image copies) !!! |
593 | 594 |
594 ImageBuffer tmp; | 595 ImageBuffer tmp; |
595 if (!Decode(tmp, dataset, frame)) | 596 if (!Decode(tmp, dataset, frame)) |
596 { | 597 { |
597 return false; | 598 return false; |
599 } | |
600 | |
601 if (!IsUncompressedImage(dataset) && !IsJpegLossless(dataset)) | |
602 { | |
603 printf("ICI\n"); | |
604 PngWriter w; | |
605 ImageAccessor b(tmp.GetConstAccessor()); | |
606 w.WriteToFile("toto.png", b); | |
598 } | 607 } |
599 | 608 |
600 target.SetFormat(format); | 609 target.SetFormat(format); |
601 target.SetWidth(tmp.GetWidth()); | 610 target.SetWidth(tmp.GetWidth()); |
602 target.SetHeight(tmp.GetHeight()); | 611 target.SetHeight(tmp.GetHeight()); |
603 | 612 |
604 switch (mode) | 613 switch (mode) |
605 { | 614 { |
606 case Mode_Truncate: | 615 case Mode_Truncate: |
607 { | 616 { |
617 if (!IsUncompressedImage(dataset) && !IsJpegLossless(dataset)) | |
618 { | |
619 printf("%d => %d\n", tmp.GetFormat(), target.GetFormat()); | |
620 } | |
608 ImageAccessor a(target.GetAccessor()); | 621 ImageAccessor a(target.GetAccessor()); |
609 ImageAccessor b(tmp.GetAccessor()); | 622 ImageAccessor b(tmp.GetConstAccessor()); |
610 ImageProcessing::Convert(a, b); | 623 ImageProcessing::Convert(a, b); |
611 return true; | 624 return true; |
612 } | 625 } |
613 | 626 |
614 default: | 627 default: |