]> Creatis software - gdcm.git/blob - Example/FlatHashTablePrint.cxx
ENH: Add license to examples since they belong to gdcm
[gdcm.git] / Example / FlatHashTablePrint.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: FlatHashTablePrint.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/11/16 04:26:17 $
7   Version:   $Revision: 1.4 $
8                                                                                 
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.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18 #include "gdcmHeader.h"
19
20 // Iterate on all the Dicom entries encountered in the gdcmFile (given
21 // as line argument) and print them. This is an illustration of the
22 // usage of \ref gdcmDocument::BuildFlatHashTable().
23
24 int main(int argc, char* argv[])
25 {
26    if (argc < 2)
27    {
28       std::cerr << "Usage :" << std::endl << 
29       argv[0] << " input_dicom " << std::endl;
30       return 1;
31    }
32
33    gdcm::Header* header = new gdcm::Header( argv[1] );
34    gdcm::TagDocEntryHT* Ht = header->BuildFlatHashTable();
35    
36    for (gdcm::TagDocEntryHT::iterator tag = Ht->begin(); tag != Ht->end(); ++tag)
37    {
38       tag->second->Print(); 
39       std::cout << std::endl;
40    }
41
42    return 0;
43 }