]> Creatis software - gdcm.git/blob - Example/TestDcm2Acr.cxx
86a6ba7be3a5ffeeaa81ec0b4ceb1f7a87e98e63
[gdcm.git] / Example / TestDcm2Acr.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: TestDcm2Acr.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/12/03 20:16:55 $
7   Version:   $Revision: 1.5 $
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 "gdcmFile.h"
19 #include "gdcmHeader.h"
20
21 #include <iostream>
22
23 int main(int argc, char* argv[])
24 {  
25    std::string toto;
26    std::string zozo;
27
28    gdcm::File  * f1;
29
30    std::cout << " Before gdcmFile()" << std::endl;
31    std::cout << "\n\n---------------------------------------" << std::endl;
32
33    if (argc > 1)
34    {
35       toto = argv[1];
36       f1 = new gdcm::File(toto);
37    }
38    else
39    {
40       std::string filename = GDCM_DATA_ROOT;
41       filename += "/test.acr";
42       f1 = new gdcm::File(filename);
43    }
44    std::cout << " Sortie gdcmFile()" << std::endl;
45
46    //e1.PrintPubDict(std::cout);
47    f1->GetHeader()->Print();
48
49    //cle = gdcmDictEntry::TranslateToKey(0x0028,0x0008);
50
51    int dataSize = f1->GetImageDataSize();
52    std::cout << "dataSize:" << dataSize << std::endl;
53
54    // void* imageData= f1->GetHeader()->GetImageData();
55
56    // Ecriture d'un Raw File, a afficher avec affim filein= dim= nbit= signe=
57    //f1->WriteRawData("image.raw");
58
59    // ecriture d'un fichier DICOM à partir d'un dcmHeader correct.
60
61    //f1->WriteDcmImplVR("image.dcm");
62
63    // ecriture d'un fichier ACR à partir d'un dcmHeader correct.
64
65    zozo = toto + ".nema";
66    f1->WriteAcr(zozo);
67    std::cout << "\n\n---------------------------------------\n\n" << std::endl;
68
69    f1->GetHeader()->Print();
70    
71    return 0;
72 }