X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FWriteDicomAsJPEG.cxx;h=b8d52fbc2371ec7142346c44624329428eb244cd;hb=2e0fae6ec87d9ecb1b76b32d8242a4fba9afefd3;hp=a1e2c249c3f3a6bd1100b3188720730fed67147c;hpb=5662af8ff8b57bb67a2dd89e965b84ff2ac7d5bf;p=gdcm.git diff --git a/Example/WriteDicomAsJPEG.cxx b/Example/WriteDicomAsJPEG.cxx index a1e2c249..b8d52fbc 100644 --- a/Example/WriteDicomAsJPEG.cxx +++ b/Example/WriteDicomAsJPEG.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteDicomAsJPEG.cxx,v $ Language: C++ - Date: $Date: 2007/08/28 14:00:52 $ - Version: $Revision: 1.18 $ + Date: $Date: 2007/08/29 08:13:40 $ + Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -57,12 +57,13 @@ int main(int argc, char *argv[]) //tested->Print( std::cout ); int samplesPerPixel = f->GetSamplesPerPixel(); - size_t testedDataSize = tested->GetImageDataSize(); - uint8_t *testedImageData = tested->GetImageData(); + size_t testedDataSize = tested->GetImageDataRawSize(); // Raw : Don't convert gray pixels+LUT to RBG pixels + uint8_t *testedImageData = tested->GetImageDataRaw(); - if( GDCM_NAME_SPACE::Debug::GetDebugFlag() ) + if( GDCM_NAME_SPACE::Debug::GetDebugFlag() ) { tested->Print( std::cout ); - + std::cout << "-------------------------------------------------------------------------------" << std::endl; + } // Step 1 : Create the header of the new file GDCM_NAME_SPACE::File *fileToBuild = GDCM_NAME_SPACE::File::New(); std::ostringstream str; @@ -145,8 +146,11 @@ int main(int argc, char *argv[]) // Consider that pixels are unmodified fileH->SetContentType(GDCM_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE); - - assert( size == testedDataSize ); + std::cerr << "xsize " << xsize << " ysize " << ysize << " zsize " << zsize << " samplesPerPixel " << samplesPerPixel + << " bitsallocated " << bitsallocated << std::endl; + std::cerr << "size " << size << " testedDataSize " << testedDataSize << + std::endl; + assert(abs (size-testedDataSize) <= 1 ); fileH->SetWriteTypeToJPEG( ); //fileH->SetImageData(testedImageData, testedDataSize);