X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FTestChangeHeader.cxx;h=89073f51e87fcf8228feb3bb07bdfde2bc29b6f2;hb=be54aab0103af7dee1a3bb5b8b3ee93b59ca9073;hp=708d82fc32b5a59c122b9c3caa9e2a3edefb8355;hpb=978f699b97794e209f9d20e2a33a72404bda54ef;p=gdcm.git diff --git a/Example/TestChangeHeader.cxx b/Example/TestChangeHeader.cxx index 708d82fc..89073f51 100644 --- a/Example/TestChangeHeader.cxx +++ b/Example/TestChangeHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestChangeHeader.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 04:26:18 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/01/24 16:44:53 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#include "gdcmHeader.h" #include "gdcmFile.h" +#include "gdcmFileHelper.h" // This examples read two images (could be the same). Try to modify // Acquisition Matrix and then write the image again @@ -27,29 +27,24 @@ int main(int argc, char* argv[]) { std::cerr << "usage :" << std::endl << argv[0] << " nomFichierPourEntete nomFichierPourDonnées" << -std::endl; + std::endl; return 1; } - gdcm::Header *h1 = new gdcm::Header( argv[1] ); - gdcm::File *f1 = new gdcm::File( h1 ); - gdcm::File *f2 = new gdcm::File( argv[2] ); + gdcm::File *h1 = new gdcm::File( argv[1] ); + gdcm::FileHelper *f1 = new gdcm::FileHelper( h1 ); + gdcm::FileHelper *f2 = new gdcm::FileHelper( argv[2] ); // 0018 1310 US ACQ Acquisition Matrix gdcm::DictEntry *dictEntry = - f2->GetHeader()->GetPubDict()->GetDictEntryByName( "Acquisition Matrix" ); + f2->GetFile()->GetPubDict()->GetEntry( 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->GetFile()->GetEntryValue(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->GetFile()->Insert( matrix, 0x0018, 0x1310); } f1->GetImageData();