1 /*=========================================================================
4 Module: $RCSfile: TestPrintAllDocument.cxx,v $
6 Date: $Date: 2005/10/25 14:52:31 $
7 Version: $Revision: 1.10 $
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 "gdcmDocEntry.h"
28 #include "gdcmDocEntrySet.h"
29 #include "gdcmDocument.h"
30 #include "gdcmElementSet.h"
31 #include "gdcmSeqEntry.h"
32 #include "gdcmSQItem.h"
33 #include "gdcmOrientation.h"
36 #include <iomanip> // for std::ios::left, ...
39 #include "gdcmDataImages.h"
41 int TestPrintAllDocument(int, char *[])
43 //std::ostringstream s;
47 std::string pixelType, photomInterp;
49 l = strlen("PALETTE COLOR ");
50 while( gdcmDataImages[i] != 0 )
52 std::string filename = GDCM_DATA_ROOT;
53 filename += "/"; //doh!
54 filename += gdcmDataImages[i];
56 gdcm::File *f= gdcm::File::New( );
57 f->SetFileName( filename );
62 // just to be able to grep the display result, for some usefull info
64 //s.setf(std::ios::left);
65 //s << std::setw(60-filename.length()) << " ";
66 //std::cout << s.str() << gdcmDataImages[i];
68 std::cout << gdcmDataImages[i];
70 unsigned int nbSpaces;
71 if (strlen(gdcmDataImages[i]) <= 60)
72 nbSpaces = 60-strlen(gdcmDataImages[i]);
75 for (j=0; j<nbSpaces; j++)
78 pixelType = f->GetPixelType();
79 std::cout << " pixelType=" << pixelType;
80 if ( pixelType == "8U" || pixelType == "8S" )
82 std::cout << " Smpl.P.Pix.=" << f->GetSamplesPerPixel()
83 << " Plan.Config.=" << f->GetPlanarConfiguration();
85 photomInterp = f->GetEntryString(0x0028,0x0004);
86 std::cout << " Photom.Interp.=" << photomInterp;
87 for (j=0; j<l-photomInterp.length(); j++)
90 std::cout << " TransferSyntaxName= [" << f->GetTransferSyntaxName() << "]" ;
92 swapC = f->GetSwapCode();
94 std::cout << " SwapCode = " << f->GetSwapCode();
95 if ( f->CheckIfEntryExist(0x0088,0x0200) )
96 std::cout << " Icon Image Sequence";
98 std::cout << std::endl;
100 std::string strImageOrientationPatient =
101 f->GetEntryString(0x0020,0x0037);
102 if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND )
105 gdcm::OrientationType orient = o.GetOrientationType( f );
106 std::cout << " ---------------------- Orientation " << orient
110 if( f->IsReadable() )
112 std::cout <<filename << " is Readable"
113 << std::endl << std::endl;
117 std::cout << filename << " is NOT Readable"
118 << std::endl << std::endl;