1 /*=========================================================================
4 Module: $RCSfile: TestLoadAllDocumentsNoPrivNoSeq.cxx,v $
6 Date: $Date: 2007/06/21 14:59:06 $
7 Version: $Revision: 1.5 $
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"
37 #include <iomanip> // for std::ios::left, ...
40 #include "gdcmDataImages.h"
42 int TestLoadAllDocumentsNoPrivNoSeq(int, char *[])
44 //std::ostringstream s;
48 std::string pixelType, photomInterp;
50 //l = strlen("PALETTE COLOR ");
51 while( gdcmDataImages[i] != 0 )
53 std::string filename = GDCM_DATA_ROOT;
54 filename += "/"; //doh!
55 filename += gdcmDataImages[i];
57 GDCM_NAME_SPACE::File *f= GDCM_NAME_SPACE::File::New( );
58 f->SetFileName( filename );
59 // just to improve coverage
60 f->SetLoadMode (GDCM_NAME_SPACE::LD_NOSEQ|GDCM_NAME_SPACE::LD_NOSHADOW);
66 // just to be able to grep the display result, for some usefull info
68 //s.setf(std::ios::left);
69 //s << std::setw(60-filename.length()) << " ";
70 //std::cout << s.str() << gdcmDataImages[i];
72 std::cout << gdcmDataImages[i];
74 unsigned int nbSpaces;
75 if (strlen(gdcmDataImages[i]) <= 60)
76 nbSpaces = 60-strlen(gdcmDataImages[i]);
79 for (j=0; j<nbSpaces; j++)
82 pixelType = f->GetPixelType();
83 std::cout << " pixelType=" << pixelType;
84 if ( pixelType == "8U" || pixelType == "8S" )
86 std::cout << " Smpl.P.Pix.=" << f->GetSamplesPerPixel()
87 << " Plan.Config.=" << f->GetPlanarConfiguration();
89 photomInterp = f->GetEntryValue(0x0028,0x0004);
90 std::cout << " Photom.Interp.=" << photomInterp;
91 for (j=0; j<l-photomInterp.length(); j++)
94 std::cout << " TransferSyntaxName= [" << f->GetTransferSyntaxName() << "]" ;
96 swapC = f->GetSwapCode();
98 std::cout << " SwapCode = " << f->GetSwapCode();
99 if ( f->CheckIfEntryExist(0x0088,0x0200) )
100 std::cout << " Icon Image Sequence";
102 std::cout << std::endl;
104 std::string strImageOrientationPatient =
105 f->GetEntryValue(0x0020,0x0037);
106 if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND )
109 double orient = o.TypeOrientation( f );
110 std::cout << " ---------------------- Orientation " << orient
114 if( f->IsReadable() )
116 std::cout <<filename << " is Readable"
117 << std::endl << std::endl;
121 std::cout << filename << " is NOT Readable"
122 << std::endl << std::endl;