1 /*=========================================================================
4 Module: $RCSfile: exPrintWritePrint.cxx,v $
6 Date: $Date: 2005/05/03 11:06:22 $
7 Version: $Revision: 1.1 $
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"
20 #include "gdcmValEntry.h"
21 #include "gdcmBinEntry.h"
24 int main(int argc, char *argv[])
28 std::string fileNameToWrite;
32 std::cout << " This program allows to see at a glance" << std::endl;
33 std::cout << " if the gdcm::File remains unimpaired" << std::endl;
34 std::cout << " after a Write" << std::endl;
35 std::cout << " In a future step, we could move it to" << std::endl;
36 std::cout << " gdcm Testing, for a systematic checking"<< std::endl;
37 std::cout << " of the entire dataset" << std::endl;
38 std::cout << " Later ..." << std::endl;
42 std::cerr << "usage: " << std::endl
43 << argv[0] << " OriginalFileName writtingMode "
45 << " a : ACR, produces a file named OriginalFileName.ACR"
46 << " x : DICOM Explicit VR, produces a file named OriginalFileName.XDCM"
47 << " d : DICOM Implicit VR, produces a file named OriginalFileName.DCM"
48 << " WARNING : bugggggggg on shadow SQ with endianness change !"
49 << " r : RAW, produces a file named OriginalFileName.RAW"
54 std::cout << std::endl
55 << "--------------------- file :" << argv[1]
58 std::string fileName = argv[1];
59 std::string mode = argv[2];
61 e1 = new gdcm::File( );
62 e1->SetLoadMode( NO_SEQ );
63 e1->Load( fileName.c_str() );
65 if (!e1->IsReadable())
67 std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
71 f1 = new gdcm::FileHelper(e1);
76 imageData= f1->GetImageData();
77 dataSize = f1->GetImageDataSize();
79 f1->SetWriteModeToRGB();
84 // ecriture d'un fichier ACR
85 // à partir d'un dcmFile correct.
87 fileNameToWrite = fileName + ".ACR";
88 std::cout << "WriteACR" << std::endl;
89 f1->WriteAcr(fileNameToWrite);
94 // ecriture d'un fichier DICOM Implicit VR
95 // à partir d'un dcmFile correct.
97 fileNameToWrite = fileName + ".DCM";
98 std::cout << "WriteDCM Implicit VR" << std::endl;
99 f1->WriteDcmImplVR(fileNameToWrite);
103 // ecriture d'un fichier DICOM Explicit VR
104 // à partir d'un dcmFile correct.
106 fileNameToWrite = fileName + ".XDCM";
107 std::cout << "WriteDCM Explicit VR" << std::endl;
108 f1->WriteDcmExplVR(fileNameToWrite);
112 // Ecriture d'un Raw File, a afficher avec
113 // affim filein= dimx= dimy= nbit= signe=
115 fileNameToWrite = fileName + ".RAW";
116 std::cout << "WriteRaw" << std::endl;
117 f1->WriteRawData(fileNameToWrite);
121 std::cout << "-----------------------------------------------------------------"