1 /*=========================================================================
4 Module: $RCSfile: TestChangeHeader.cxx,v $
6 Date: $Date: 2005/02/02 14:26:30 $
7 Version: $Revision: 1.14 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmFileHelper.h"
21 // This examples read two images (could be the same). Try to modify
22 // Acquisition Matrix and then write the image again
24 int main(int argc, char *argv[])
28 std::cerr << "usage :" << std::endl <<
29 argv[0] << " fileNameForHeader fileNameForData" <<
34 gdcm::File *h1 = new gdcm::File( argv[1] );
35 gdcm::FileHelper *f1 = new gdcm::FileHelper( h1 );
36 gdcm::FileHelper *f2 = new gdcm::FileHelper( argv[2] );
38 // 0018 1310 US ACQ Acquisition Matrix
39 gdcm::DictEntry *dictEntry =
40 f2->GetFile()->GetPubDict()->GetEntry( 0x0018, 1310 );
41 std::cerr << std::hex << dictEntry->GetGroup() << "," << dictEntry->GetElement() << std::endl;
43 std::string matrix = f2->GetFile()->GetEntryValue(0x0018, 0x1310);
44 if(matrix != "gdcm::Unfound")
46 std::cerr << "Aquisition Matrix:" << matrix << std::endl;
47 f1->GetFile()->InsertValEntry( matrix, 0x0018, 0x1310);
54 f1->WriteDcmExplVR("output-matrix.dcm");