X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FWriteDicomAsJPEG2000.cxx;h=f66c7c30835d4d61fdcf2b6ef88571d3f3eca028;hb=28a3ba592eab9953ff1840d19357ae0db5e3e6a1;hp=f8bfa979e45c36e5deb359963a469bfc0d822a0d;hpb=5662af8ff8b57bb67a2dd89e965b84ff2ac7d5bf;p=gdcm.git diff --git a/Example/WriteDicomAsJPEG2000.cxx b/Example/WriteDicomAsJPEG2000.cxx index f8bfa979..f66c7c30 100644 --- a/Example/WriteDicomAsJPEG2000.cxx +++ b/Example/WriteDicomAsJPEG2000.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteDicomAsJPEG2000.cxx,v $ Language: C++ - Date: $Date: 2007/08/28 14:00:52 $ - Version: $Revision: 1.8 $ + Date: $Date: 2007/08/29 08:13:40 $ + Version: $Revision: 1.10 $ 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->SetWriteTypeToJPEG2000( ); //fileH->SetImageData(testedImageData, testedDataSize);