1 /*=========================================================================
4 Module: $RCSfile: TestPrintAllDocument.cxx,v $
6 Date: $Date: 2006/04/07 10:58:51 $
7 Version: $Revision: 1.13 $
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 argc, char *argv[])
43 //std::ostringstream s;
47 std::string pixelType, photomInterp;
49 l = strlen("PALETTE COLOR ");
51 //gdcm::Debug::DebugOn();
53 while( gdcmDataImages[i] != 0 )
62 filename = GDCM_DATA_ROOT;
63 filename += "/"; //doh!
64 filename += gdcmDataImages[i];
67 std::cout << " ----------------------------------------------"
68 << "Begin with " << filename << std::endl;
70 gdcm::File *f= gdcm::File::New( );
71 f->SetFileName( filename );
77 //s.setf(std::ios::left);
78 //s << std::setw(60-filename.length()) << " ";
79 //std::cout << s.str() << gdcmDataImages[i];
81 std::cout << gdcmDataImages[i];
83 unsigned int nbSpaces;
84 if (strlen(gdcmDataImages[i]) <= 60)
85 nbSpaces = 60-strlen(gdcmDataImages[i]);
88 for (j=0; j<nbSpaces; j++)
91 pixelType = f->GetPixelType();
92 std::cout << " pixelType=" << pixelType;
93 if ( pixelType == "8U" || pixelType == "8S" )
95 std::cout << " Smpl.P.Pix.=" << f->GetSamplesPerPixel()
96 << " Plan.Config.=" << f->GetPlanarConfiguration();
98 photomInterp = f->GetEntryString(0x0028,0x0004);
99 std::cout << " Photom.Interp.=" << photomInterp;
100 for (j=0; j<l-photomInterp.length(); j++)
103 std::cout << " TransferSyntaxName= [" << f->GetTransferSyntaxName() << "]" ;
105 swapC = f->GetSwapCode();
107 std::cout << " SwapCode = " << f->GetSwapCode();
108 if ( f->CheckIfEntryExist(0x0088,0x0200) )
109 std::cout << " Icon Image Sequence";
111 std::cout << std::endl;
113 std::string strImageOrientationPatient =
114 f->GetEntryString(0x0020,0x0037);
115 if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND )
117 gdcm::Orientation *o = gdcm::Orientation::New();
119 gdcm::OrientationType orient = o->GetOrientationType( f );
120 std::cout << " ---------------------- Orientation " << orient
125 if( f->IsReadable() )
127 std::cout <<filename << " is Readable"
128 << std::endl << std::endl;
132 std::cout << filename << " is NOT Readable"
133 << std::endl << std::endl;
140 break; // user asked to check a single file.