X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=Example%2FTestChangeHeader.cxx;h=565bd046bc9a1786c2cb390edbcb20654444dff9;hb=c593dff0e402e9ea9e0d3823108de21f313c407f;hp=1ad0e782e7f090b5126cfdde3adf602d2d11c12c;hpb=1d69b92978803204089d270599133917d944c651;p=gdcm.git diff --git a/Example/TestChangeHeader.cxx b/Example/TestChangeHeader.cxx index 1ad0e782..565bd046 100644 --- a/Example/TestChangeHeader.cxx +++ b/Example/TestChangeHeader.cxx @@ -1,3 +1,20 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestChangeHeader.cxx,v $ + Language: C++ + Date: $Date: 2005/01/06 14:31:37 $ + 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 + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ #include "gdcmHeader.h" #include "gdcmFile.h" @@ -10,7 +27,7 @@ int main(int argc, char* argv[]) { std::cerr << "usage :" << std::endl << argv[0] << " nomFichierPourEntete nomFichierPourDonnées" << -std::endl; + std::endl; return 1; } @@ -20,19 +37,14 @@ std::endl; // 0018 1310 US ACQ Acquisition Matrix gdcm::DictEntry *dictEntry = - f2->GetHeader()->GetPubDict()->GetDictEntryByName( "Acquisition Matrix" ); + f2->GetHeader()->GetPubDict()->GetDictEntryByNumber( 0x0018, 1310 ); std::cerr << std::hex << dictEntry->GetGroup() << "," << dictEntry->GetElement() << std::endl; - // std::string matrix = f2->GetHeader()->GetEntryByNumber(0x0018, 0x1310); - // Or, strictly equivalent (a little bit longer at run-time !): - std::string matrix = f2->GetHeader()->GetEntryByName("Acquisition Matrix"); + std::string matrix = f2->GetHeader()->GetEntryByNumber(0x0018, 0x1310); if(matrix != "gdcm::Unfound") { std::cerr << "Aquisition Matrix:" << matrix << std::endl; - f1->GetHeader()->ReplaceOrCreateByNumber( matrix, 0x0018, 0x1310); - - //f1->GetHeader()->ReplaceOrCreateByNumber( matrix, dictEntry->GetGroup(), - // dictEntry->GetElement()); + f1->GetHeader()->ReplaceOrCreateByNumber( matrix, 0x0018, 0x1310); } f1->GetImageData();