X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestCopyRescaleDicom.cxx;h=975d91c8742ab1c2509e4f921db442976191ab9b;hb=5a0d183707a94e875a595036f64d0bd506faf618;hp=4f0eb9aa2c36a54213006aaba20bf20a0d7c338a;hpb=51e53b78f995e2dde4f75570a8bf3b0dac5209c2;p=gdcm.git diff --git a/Testing/TestCopyRescaleDicom.cxx b/Testing/TestCopyRescaleDicom.cxx index 4f0eb9aa..975d91c8 100644 --- a/Testing/TestCopyRescaleDicom.cxx +++ b/Testing/TestCopyRescaleDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyRescaleDicom.cxx,v $ Language: C++ - Date: $Date: 2004/12/08 11:37:15 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/01/14 11:28:29 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -56,15 +56,14 @@ int CopyRescaleDicom(std::string const & filename, //////////////// Step 2: std::cout << "2..."; - originalH->Initialize(); - gdcm::DocEntry* d = originalH->GetNextEntry(); - // Copy of the header content + originalH->InitTraversal(); + gdcm::DocEntry* d = originalH->GetNextEntry(); while(d) { if ( gdcm::BinEntry* b = dynamic_cast(d) ) { - copyH->ReplaceOrCreateByNumber( + copyH->ReplaceOrCreate( b->GetBinArea(), b->GetLength(), b->GetGroup(), @@ -73,7 +72,7 @@ int CopyRescaleDicom(std::string const & filename, } else if ( gdcm::ValEntry* v = dynamic_cast(d) ) { - copyH->ReplaceOrCreateByNumber( + copyH->ReplaceOrCreate( v->GetValue(), v->GetGroup(), v->GetElement(), @@ -95,14 +94,14 @@ int CopyRescaleDicom(std::string const & filename, size_t rescaleSize; uint8_t *rescaleImage; - const std::string & bitsStored = originalH->GetEntryByNumber(0x0028,0x0101); + const std::string & bitsStored = originalH->GetEntry(0x0028,0x0101); if( bitsStored == "16" ) { std::cout << "Rescale..."; - copyH->ReplaceOrCreateByNumber( "8", 0x0028, 0x0100); // BitsAllocated - copyH->ReplaceOrCreateByNumber( "8", 0x0028, 0x0101); // BitsStored - copyH->ReplaceOrCreateByNumber( "7", 0x0028, 0x0102); // HighBit - copyH->ReplaceOrCreateByNumber( "0", 0x0028, 0x0103); //Pixel Representation + copyH->ReplaceOrCreate( "8", 0x0028, 0x0100); // BitsAllocated + copyH->ReplaceOrCreate( "8", 0x0028, 0x0101); // BitsStored + copyH->ReplaceOrCreate( "7", 0x0028, 0x0102); // HighBit + copyH->ReplaceOrCreate( "0", 0x0028, 0x0103); //Pixel Representation // We assume the value were from 0 to uint16_t max rescaleSize = dataSize / 2;