1 /*=========================================================================
4 Module: $RCSfile: exPrintWritePrint.cxx,v $
6 Date: $Date: 2005/08/30 15:13:06 $
7 Version: $Revision: 1.4 $
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 f = new gdcm::File( );
62 f->SetLoadMode( gdcm::LD_NOSEQ );
63 f->SetFileName( fileName );
68 std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
72 fh = new gdcm::FileHelper(f);
77 imageData= fh->GetImageData();
78 dataSize = fh->GetImageDataSize();
80 fh->SetWriteModeToRGB();
85 // ecriture d'un fichier ACR
86 // à partir d'un dcmFile correct.
88 fileNameToWrite = fileName + ".ACR";
89 std::cout << "WriteACR" << std::endl;
90 fh->WriteAcr(fileNameToWrite);
95 // ecriture d'un fichier DICOM Implicit VR
96 // à partir d'un dcmFile correct.
98 fileNameToWrite = fileName + ".DCM";
99 std::cout << "WriteDCM Implicit VR" << std::endl;
100 fh->WriteDcmImplVR(fileNameToWrite);
104 // ecriture d'un fichier DICOM Explicit VR
105 // à partir d'un dcmFile correct.
107 fileNameToWrite = fileName + ".XDCM";
108 std::cout << "WriteDCM Explicit VR" << std::endl;
109 fh->WriteDcmExplVR(fileNameToWrite);
113 // Ecriture d'un Raw File, a afficher avec
114 // affim filein= dimx= dimy= nbit= signe=
116 fileNameToWrite = fileName + ".RAW";
117 std::cout << "WriteRaw" << std::endl;
118 fh->WriteRawData(fileNameToWrite);
122 std::cout << "-----------------------------------------------------------------"