]> Creatis software - gdcm.git/blob - Testing/TestLoadAllDocumentsNoPrivNoSeq.cxx
ENH: for now do not support our own bugs
[gdcm.git] / Testing / TestLoadAllDocumentsNoPrivNoSeq.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: TestLoadAllDocumentsNoPrivNoSeq.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/06/21 14:59:06 $
7   Version:   $Revision: 1.5 $
8                                                                                 
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.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18
19 // TODO : check what's *actually* usefull
20
21 #include "gdcmDictEntry.h"
22 #include "gdcmDict.h"
23 #include "gdcmDictSet.h"
24 #include "gdcmFile.h"
25 #include "gdcmUtil.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"
34
35 #include <fstream>
36 #include <iostream>
37 #include <iomanip> // for std::ios::left, ...
38
39 //Generated file:
40 #include "gdcmDataImages.h"
41
42 int TestLoadAllDocumentsNoPrivNoSeq(int, char *[])
43 {
44    //std::ostringstream s;
45    int i = 0;
46    //int swapC;
47    //unsigned int j;
48    std::string pixelType, photomInterp;
49    //int l;
50    //l = strlen("PALETTE COLOR ");
51    while( gdcmDataImages[i] != 0 )
52    {
53       std::string filename = GDCM_DATA_ROOT;
54       filename += "/";  //doh!
55       filename += gdcmDataImages[i];
56
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);
61       f->Load();
62
63 /*
64       f->SetPrintLevel(2);
65       f->Print();
66       // just to be able to grep the display result, for some usefull info
67  
68       //s.setf(std::ios::left);
69       //s << std::setw(60-filename.length()) << " ";
70       //std::cout << s.str() << gdcmDataImages[i];
71
72       std::cout << gdcmDataImages[i];
73
74       unsigned int nbSpaces;
75       if (strlen(gdcmDataImages[i]) <= 60)
76          nbSpaces = 60-strlen(gdcmDataImages[i]);
77       else
78          nbSpaces = 0;
79       for (j=0; j<nbSpaces; j++)
80          std::cout << " ";    
81
82       pixelType = f->GetPixelType();
83       std::cout << " pixelType="            << pixelType;
84       if ( pixelType == "8U" || pixelType == "8S" )
85          std::cout << " ";
86       std::cout << " Smpl.P.Pix.="          << f->GetSamplesPerPixel()
87                 << " Plan.Config.="         << f->GetPlanarConfiguration();
88  
89       photomInterp =  f->GetEntryValue(0x0028,0x0004);               
90       std::cout << " Photom.Interp.="       << photomInterp;
91       for (j=0; j<l-photomInterp.length(); j++)
92          std::cout << " ";
93  
94       std::cout << " TransferSyntaxName= [" << f->GetTransferSyntaxName() << "]" ;
95
96       swapC = f->GetSwapCode();
97       if ( swapC != 1234 )
98           std::cout << " SwapCode = "       << f->GetSwapCode(); 
99       if ( f->CheckIfEntryExist(0x0088,0x0200) )
100           std::cout << " Icon Image Sequence";
101
102       std::cout << std::endl;
103
104       std::string strImageOrientationPatient = 
105                                           f->GetEntryValue(0x0020,0x0037);
106       if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND )
107       {
108          gdcm::Orientation o;
109          double orient = o.TypeOrientation( f );
110          std::cout << " ---------------------- Orientation " << orient
111                    << std::endl;
112       }
113
114       if( f->IsReadable() )
115       {
116          std::cout <<filename << " is Readable" 
117                    << std::endl << std::endl;
118       }
119       else
120       {
121          std::cout << filename << " is NOT Readable" 
122                    << std::endl << std::endl;
123          f->Delete();
124          return 1;
125       }
126  */
127       f->Delete();
128       i++;
129    }
130    return 0;
131 }