1 /*=========================================================================
4 Module: $RCSfile: TestPrintAllDocument.cxx,v $
6 Date: $Date: 2005/09/16 17:19:24 $
7 Version: $Revision: 1.7 $
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 // TODO : check what's *actually* usefull
21 #include "gdcmDictEntry.h"
23 #include "gdcmDictSet.h"
26 #include "gdcmCommon.h"
27 #include "gdcmBinEntry.h"
28 #include "gdcmDocEntry.h"
29 #include "gdcmDocEntrySet.h"
30 #include "gdcmDocument.h"
31 #include "gdcmElementSet.h"
32 #include "gdcmSeqEntry.h"
33 #include "gdcmSQItem.h"
34 #include "gdcmValEntry.h"
35 #include "gdcmOrientation.h"
38 #include <iomanip> // for std::ios::left, ...
41 #include "gdcmDataImages.h"
43 int TestPrintAllDocument(int, char *[])
45 //std::ostringstream s;
49 std::string pixelType, photomInterp;
51 l = strlen("PALETTE COLOR ");
52 while( gdcmDataImages[i] != 0 )
54 std::string filename = GDCM_DATA_ROOT;
55 filename += "/"; //doh!
56 filename += gdcmDataImages[i];
58 gdcm::File *f= new gdcm::File( );
59 f->SetFileName( filename );
64 // just to be able to grep the display result, for some usefull info
66 //s.setf(std::ios::left);
67 //s << std::setw(60-filename.length()) << " ";
68 //std::cout << s.str() << gdcmDataImages[i];
70 std::cout << gdcmDataImages[i];
72 unsigned int nbSpaces;
73 if (strlen(gdcmDataImages[i]) <= 60)
74 nbSpaces = 60-strlen(gdcmDataImages[i]);
77 for (j=0; j<nbSpaces; j++)
80 pixelType = f->GetPixelType();
81 std::cout << " pixelType=" << pixelType;
82 if ( pixelType == "8U" || pixelType == "8S" )
84 std::cout << " Smpl.P.Pix.=" << f->GetSamplesPerPixel()
85 << " Plan.Config.=" << f->GetPlanarConfiguration();
87 photomInterp = f->GetEntryValue(0x0028,0x0004);
88 std::cout << " Photom.Interp.=" << photomInterp;
89 for (j=0; j<l-photomInterp.length(); j++)
92 std::cout << " TransferSyntaxName= [" << f->GetTransferSyntaxName() << "]" ;
94 swapC = f->GetSwapCode();
96 std::cout << " SwapCode = " << f->GetSwapCode();
97 if ( f->CheckIfEntryExist(0x0088,0x0200) )
98 std::cout << " Icon Image Sequence";
100 std::cout << std::endl;
102 std::string strImageOrientationPatient =
103 f->GetEntryValue(0x0020,0x0037);
104 if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND )
107 double orient = o.TypeOrientation( f );
108 std::cout << " ---------------------- Orientation " << orient
112 if( f->IsReadable() )
114 std::cout <<filename << " is Readable"
115 << std::endl << std::endl;
119 std::cout << filename << " is NOT Readable"
120 << std::endl << std::endl;