Mercurial > hg > orthanc
changeset 848:703e8d5b03fd jpeg
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 05 Jun 2014 18:16:40 +0200 |
parents | 03ea55da7429 |
children | dcd8a3e4d298 |
files | UnitTestsSources/JpegLossless.cpp |
diffstat | 1 files changed, 16 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/UnitTestsSources/JpegLossless.cpp Thu Jun 05 18:14:16 2014 +0200 +++ b/UnitTestsSources/JpegLossless.cpp Thu Jun 05 18:16:40 2014 +0200 @@ -80,32 +80,30 @@ #else DcmFileFormat fileformat; //if (fileformat.loadFile("IM-0001-1001-0001.dcm").good()) - if (fileformat.loadFile("tata.dcm").good()) - { - DcmDataset& dataset = *fileformat.getDataset(); + ASSERT_TRUE(fileformat.loadFile("tata.dcm").good()); - ASSERT_TRUE(DicomImageDecoder::IsJpegLossless(dataset)); + DcmDataset& dataset = *fileformat.getDataset(); - ImageBuffer image; - //DicomImageDecoder::DecodeJpegLossless(image, dataset, 0); - DicomImageDecoder::Decode(image, dataset, 0); + ASSERT_TRUE(DicomImageDecoder::IsJpegLossless(dataset)); - ImageAccessor accessor(image.GetAccessor()); + ImageBuffer image; + //DicomImageDecoder::DecodeJpegLossless(image, dataset, 0); + DicomImageDecoder::Decode(image, dataset, 0); - for (unsigned int y = 0; y < accessor.GetHeight(); y++) + ImageAccessor accessor(image.GetAccessor()); + + for (unsigned int y = 0; y < accessor.GetHeight(); y++) + { + int16_t *p = reinterpret_cast<int16_t*>(accessor.GetRow(y)); + for (unsigned int x = 0; x < accessor.GetWidth(); x++, p ++) { - int16_t *p = reinterpret_cast<int16_t*>(accessor.GetRow(y)); - for (unsigned int x = 0; x < accessor.GetWidth(); x++, p ++) - { - if (*p < 0) - *p = 0; - } + if (*p < 0) + *p = 0; } - - PngWriter w; - w.WriteToFile("tata.png", accessor); } + PngWriter w; + w.WriteToFile("tata.png", accessor); #endif }