]> Creatis software - gdcm.git/blob - Example/PrintFile.cxx
725dca83c7a0ba5d1c6b1c98cb4be0b2f815a5ab
[gdcm.git] / Example / PrintFile.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: PrintFile.cxx,v $
5   Language:  C++
6   Date:      $Date: 2006/11/15 15:57:49 $
7   Version:   $Revision: 1.83 $
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 #include "gdcmFile.h"
19 #include "gdcmDocument.h"
20 #include "gdcmSeqEntry.h"
21 #include "gdcmSQItem.h"
22 #include "gdcmDataEntry.h"
23
24 #include "gdcmFileHelper.h"
25 #include "gdcmDebug.h"
26 #include "gdcmDirList.h"
27 #include "gdcmGlobal.h"
28 #include "gdcmDictSet.h"
29 #include "gdcmArgMgr.h"
30 #include "gdcmOrientation.h"
31 #include <iostream>
32
33 // TODO : code factorization, for 'single file' an 'whole directory' processing
34
35 void ShowLutData(gdcm::File *f);
36
37      // Nothing is written yet to get LUT Data user friendly
38      // The following is to be moved into a PixelReadConvert method
39      // Let here, waiting for a clever idea on the way to do it.
40
41 void ShowLutData(gdcm::File *f)
42 {  
43    gdcm::SeqEntry *modLutSeq = f->GetSeqEntry(0x0028,0x3000);
44    if ( modLutSeq !=0 )
45    {
46       gdcm::SQItem *sqi= modLutSeq->GetFirstSQItem();
47       if ( sqi != 0 )
48       {
49          std::string lutDescriptor = sqi->GetEntryString(0x0028,0x3002);
50          if (   /*lutDescriptor   == GDCM_UNFOUND*/ 0 )
51          {
52             std::cout << "LUT Descriptor is missing" << std::endl;
53             return;
54          }
55          int length;   // LUT length in Bytes
56          int deb;      // Subscript of the first Lut Value
57          int nbits;    // Lut item size (in Bits)
58
59          int nbRead;    // nb of items in LUT descriptor (must be = 3)
60
61          nbRead = sscanf( lutDescriptor.c_str(),
62                            "%d\\%d\\%d",
63                               &length, &deb, &nbits );
64          std::cout << "length " << length 
65                   << " deb " << deb 
66                   << " nbits " << nbits
67                   << std::endl;
68          if ( nbRead != 3 )
69          {
70             std::cout << "Wrong LUT descriptor" << std::endl;
71          }
72          //LUT Data (CTX dependent)    
73          gdcm::DataEntry *b = sqi->GetDataEntry(0x0028,0x3006); 
74          if ( b != 0 )
75          { 
76             int BitsAllocated = f->GetBitsAllocated();
77             if ( BitsAllocated <= 8 )
78             { 
79                int mult;
80                if ( ( nbits == 16 ) && ( BitsAllocated == 8 ) )
81                {
82                // when LUT item size is different than pixel size
83                   mult = 2; // high byte must be = low byte
84                }
85                else
86                {
87                // See PS 3.3-2003 C.11.1.1.2 p 619
88                   mult = 1;
89                }
90                uint8_t *lut = b->GetBinArea();
91                for( int i=0; i < length; ++i )
92                {
93                   std::cout << i+deb << " : \t"
94                               << (int) (lut[i*mult + 1]) << std::endl;
95                }
96             }
97             else
98             {
99                uint16_t *lut = (uint16_t *)(b->GetBinArea());  
100                for( int i=0; i < length; ++i )
101                {
102                   std::cout << i+deb << " : \t"
103                               << (int) (((uint16_t *)lut)[i])
104                               << std::endl;
105                }             
106             }
107          }  
108          else
109             std::cout << "No LUT Data DataEntry (0x0028,0x3006) found?!? " 
110                         << std::endl;
111       }
112       else
113          std::cout << "No First SQ Item within (0x0028,0x3000) ?!? " 
114                      << std::endl;      
115    }
116    else
117       std::cout << "No LUT Data SeqEntry (0x0028,0x3000) found " 
118                   << std::endl;
119 }
120
121 int main(int argc, char *argv[])
122 {
123
124    START_USAGE(usage)
125    " \n PrintFile : \n                                                        ",
126    " Display the header of a ACR-NEMA/PAPYRUS/DICOM File                      ",
127    " usage: PrintFile {filein=inputFileName|dirin=inputDirectoryName}[level=n]",
128    "                       [forceload=listOfElementsToForceLoad]              ",
129    "                       [4DLoc= ][dict= privateDirectory]                  ",
130    "                       [ { [noshadowseq] | [noshadow][noseq] } ]          ",
131    "                       [debug] [warning]                                  ",
132    "      level = 0,1,2 : depending on the amount of details user wants to see",
133    "      4DLoc: group-elem(in hexa, no space) of the DataEntry holdind 4thDim",
134    "      listOfElementsToForceLoad : group-elem,g2-e2,... (in hexa, no space)",
135    "                                of Elements to load whatever their length ",
136    "      privateDirectory : source file full path name of Shadow Group elems ",
137    "      noshadowseq: user doesn't want to load Private Sequences            ",
138    "      noshadow   : user doesn't want to load Private groups (odd number)  ",
139    "      noseq      : user doesn't want to load Sequences                    ",
140    "      debug      : user wants to run the program in 'debug mode'          ",
141    "      warning    : user wants to be warned about any oddity in the File   ",
142    "      showlut :user wants to display the Palette Color (as an int array)  ",
143    FINISH_USAGE
144
145    // Initialize Arguments Manager   
146    gdcm::ArgMgr *am= new gdcm::ArgMgr(argc, argv);
147   
148    if (argc == 1 || am->ArgMgrDefined("usage") )
149    {
150       am->ArgMgrUsage(usage); // Display 'usage'
151       delete am;
152       return 1;
153    }
154
155    const char *fileName = am->ArgMgrGetString("filein");
156    const char *dirName  = am->ArgMgrGetString("dirin");
157
158    if ( (fileName == 0 && dirName == 0) ||
159         (fileName != 0 && dirName != 0) )
160    {
161       std::cerr << std::endl
162         << "Either 'filein=' or 'dirin=' must be present;" 
163         << std::endl << "Not both" << std::endl;
164       am->ArgMgrUsage(usage); // Display 'usage'  
165       delete am;
166       return 1;
167    }
168
169    if (am->ArgMgrDefined("debug"))
170       gdcm::Debug::DebugOn();
171
172    if (am->ArgMgrDefined("warning"))
173       gdcm::Debug::WarningOn();
174        
175    int loadMode = gdcm::LD_ALL;
176    if ( am->ArgMgrDefined("noshadowseq") )
177       loadMode |= gdcm::LD_NOSHADOWSEQ;
178    else 
179    {
180       if ( am->ArgMgrDefined("noshadow") )
181          loadMode |= gdcm::LD_NOSHADOW;
182       if ( am->ArgMgrDefined("noseq") )
183          loadMode |= gdcm::LD_NOSEQ;
184    }
185
186    int level = am->ArgMgrGetInt("level", 1);
187
188    int forceLoadNb;
189    uint16_t *elemsToForceLoad 
190                            = am->ArgMgrGetXInt16Enum("forceload", &forceLoadNb);
191    
192    int nbP;
193    uint16_t *FourthDimLoc;
194    if ( am->ArgMgrDefined("4DLoc") )
195    {
196       FourthDimLoc = am->ArgMgrGetXInt16Enum("4DLoc", &nbP);
197    
198       if (nbP != 1) 
199       {   
200          std::cout << "4DLoc must have 2 and only 2 components!" << std::endl;
201          delete am;
202          return 1;      
203       }
204    }
205
206    bool showlut = ( 0 != am->ArgMgrDefined("SHOWLUT") );
207
208    bool ddict = am->ArgMgrDefined("dict") ? true : false;
209    const char *dict = 0;
210
211    if (ddict)
212    {
213      dict = am->ArgMgrGetString("dict",0);
214    }
215
216    /* if unused Param we give up */
217    if ( am->ArgMgrPrintUnusedLabels() )
218    {
219       am->ArgMgrUsage(usage);
220       delete am;
221       return 1;
222    } 
223
224    delete am;  // we don't need Argument Manager any longer
225
226    // ----------- End Arguments Manager ---------
227
228  
229    if (ddict)
230    {
231       gdcm::Global::GetDicts()->GetDefaultPubDict()->AddDict(dict);   
232    }
233
234    if ( fileName != 0 ) // ====== Deal with a single file ======
235    { 
236       gdcm::File *f = gdcm::File::New();
237       f->SetLoadMode(loadMode);
238       f->SetFileName( fileName );
239
240       for (int ri=0; ri<forceLoadNb; ri++)
241       {
242          f->AddForceLoadElement((uint32_t)elemsToForceLoad[2*ri], 
243                                 (uint32_t)elemsToForceLoad[2*ri+1] ); 
244       }
245 // TODO : find why such a polution
246 // To avoid polluting the output with messages 
247 // 'Last system error was : No such file or directory'
248
249 errno = 0; 
250
251
252       bool res = f->Load();
253       // gdcm::File::IsReadable() is no usable here, because we deal with
254       // any kind of gdcm-Parsable *document* 
255       // not only gdcm::File (as opposed to gdcm::DicomDir)
256       if ( !res )
257       {
258          std::cout << "Cannot process file [" << fileName << "]" << std::endl;
259          std::cout << "Either it doesn't exist, or it's read protected " 
260                    << std::endl;
261          std::cout << "or it's not a Dicom File, or its 'header' is bugged" 
262                    << std::endl;
263          std::cout << "use 'PrintFile filein=... debug' to try to guess the pb"
264                    << std::endl;
265          f->Delete();
266          return 0;
267       }
268       if (nbP == 1)
269          f->SetFourthDimensionLocation(FourthDimLoc[0],FourthDimLoc[1]);
270
271       gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
272       fh->SetPrintLevel( level );
273
274       fh->Print();
275
276       std::cout << "\n\n" << std::endl; 
277
278       std::cout <<std::endl;
279       std::cout <<" dataSize    " << fh->GetImageDataSize()    << std::endl;
280       std::cout <<" dataSizeRaw " << fh->GetImageDataRawSize() << std::endl;
281
282       int nX,nY,nZ,nT,sPP,planarConfig;
283       std::string pixelType;
284       nX=f->GetXSize();
285       nY=f->GetYSize();
286       nZ=f->GetZSize();
287       nT=f->GetTSize();
288       std::cout << " DIMX=" << nX << " DIMY=" << nY 
289                 << " DIMZ=" << nZ << " DIMT=" << nT
290                 << std::endl;
291
292       pixelType    = f->GetPixelType();
293       sPP          = f->GetSamplesPerPixel();
294       std::cout << " pixelType= ["            << pixelType 
295                 << "] SamplesPerPixel= ["     << sPP
296                 << "] ";
297
298       if (sPP == 3)
299       {
300          planarConfig = f->GetPlanarConfiguration();
301          std::cout << " PlanarConfiguration= [" << planarConfig 
302                 << "] "<< std::endl;
303       } 
304       std::cout << " PhotometricInterpretation= [" 
305                 << f->GetEntryString(0x0028,0x0004)
306                 << "] "<< std::endl;
307
308       int numberOfScalarComponents=f->GetNumberOfScalarComponents();
309       std::cout << " NumberOfScalarComponents = " << numberOfScalarComponents 
310                 <<std::endl
311                 << " LUT = " << (f->HasLUT() ? "TRUE" : "FALSE")
312                 << std::endl;
313
314       if ( f->GetDataEntry(0x0002,0x0010) )
315          if ( f->GetDataEntry(0x0002,0x0010)->IsNotLoaded() ) 
316          {
317             std::cout << "Transfer Syntax not loaded. " << std::endl
318                      << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE"
319                   << std::endl;
320             f->Delete();
321             return 0;
322          }
323   
324       std::string transferSyntaxName = f->GetTransferSyntaxName();
325       std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" 
326                 << std::endl;
327       std::cout << " SwapCode= " << f->GetSwapCode() << std::endl;
328       std::cout << " ------" << std::endl;
329
330       std::cout << "\n\n" << std::endl; 
331       std::cout << "X spacing " << f->GetXSpacing() << std::endl;
332       std::cout << "Y spacing " << f->GetYSpacing() << std::endl;
333       std::cout << "Z spacing " << f->GetZSpacing() << std::endl;
334     
335 //------------------------------
336
337       // Let's get and print some usefull fields about 'Orientation'
338       // ------------------------------------------------------------
339
340       std::string strPatientPosition = 
341                                       f->GetEntryString(0x0018,0x5100);
342       if ( strPatientPosition != gdcm::GDCM_UNFOUND 
343         && strPatientPosition != "" )  
344             std::cout << "PatientPosition (0x0010,0x5100)= [" 
345                       << strPatientPosition << "]" << std::endl;
346  
347       std::string strViewPosition = 
348                                       f->GetEntryString(0x0018,0x5101);
349       if ( strViewPosition != gdcm::GDCM_UNFOUND 
350         && strViewPosition != "" )  
351             std::cout << "View Position (0x0018,0x5101)= [" 
352                       << strViewPosition << "]" << std::endl;
353       
354      std::string strPatientOrientation = 
355                                       f->GetEntryString(0x0020,0x0020);
356       if ( strPatientOrientation != gdcm::GDCM_UNFOUND
357         && strPatientOrientation != "")  
358          std::cout << "PatientOrientation (0x0020,0x0020)= [" 
359                    << strPatientOrientation << "]" << std::endl;
360
361       std::string strImageOrientationPatient = 
362                                       f->GetEntryString(0x0020,0x0037);  
363       if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND
364         && strImageOrientationPatient != "" )  
365          std::cout << "ImageOrientationPatient (0x0020,0x0037)= [" 
366                    << strImageOrientationPatient << "]" << std::endl;
367
368       std::string strImageOrientationRET = 
369                                       f->GetEntryString(0x0020,0x0035);
370       if ( strImageOrientationRET != gdcm::GDCM_UNFOUND
371         && strImageOrientationRET != "" )  
372          std::cout << "ImageOrientationRET (0x0020,0x0035)= [" 
373                    << strImageOrientationRET << "]" << std::endl;
374
375       std::string strImagePositionPatient = 
376                                       f->GetEntryString(0x0020,0x0032);  
377       if ( strImagePositionPatient != gdcm::GDCM_UNFOUND
378         && strImagePositionPatient != "" )  
379          std::cout << "ImagePositionPatient (0x0020,0x0032)= [" 
380                    << strImagePositionPatient << "]" << std::endl;
381
382       std::string strImagePositionPatientRET = 
383                                       f->GetEntryString(0x0020,0x0030);
384       if ( strImagePositionPatientRET != gdcm::GDCM_UNFOUND
385         && strImagePositionPatientRET != "" )  
386          std::cout << "ImagePositionPatientRET (0x0020,0x0030)= [" 
387                    << strImagePositionPatientRET << "]" << std::endl;
388   
389      float iop[6];
390      /*bool riop = */f->GetImageOrientationPatient(iop);  
391      float ipp[3];
392      /*bool ripp = */f->GetImagePositionPatient(ipp);
393
394      std::cout << "Image Position (0x0020,0x0032|0x0030) : "
395                << ipp[0] << " , " << ipp[1] << " , "<< ipp[2]
396                << std::endl;
397      std::cout << "Image Orientation (0x0020,0x0037|0x0035) : "
398                << iop[0] << " , " << iop[1] << " , "<< iop[2] << " , "
399                << iop[3] << " , " << iop[4] << " , "<< iop[5]
400                << std::endl; 
401
402
403       // Let's compute 'user friendly' results about 'Orientation'
404       // ---------------------------------------------------------
405  
406       gdcm::Orientation *o = gdcm::Orientation::New();
407
408       if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND ||
409            strImageOrientationRET     != gdcm::GDCM_UNFOUND )
410       {
411   
412          gdcm::OrientationType orient = o->GetOrientationType( f );
413  
414          std::cout << "TypeOrientation = " << orient << " (-> " 
415                    << o->GetOrientationTypeString(orient) << " )" << std::endl;
416       }
417
418       std::string ori = o->GetOrientation ( f );
419       if (ori != "\\" )
420          std::cout << "Orientation [" << ori << "]" << std::endl;
421  
422       o->Delete();  
423 //------------------------------
424
425
426       // Display the LUT as an int array (for debugging purpose)
427       if ( f->HasLUT() && showlut )
428       {
429          uint8_t* lutrgba = fh->GetLutRGBA();
430          if ( lutrgba == 0 )
431          {
432             std::cout << "Lut RGBA (Palette Color) not built " << std::endl;
433  
434            // Nothing is written yet to get LUT Data user friendly
435            // The following is to be moved into a PixelRedaConvert method
436   
437             gdcm::SeqEntry *modLutSeq = f->GetSeqEntry(0x0028,0x3000);
438             if ( modLutSeq !=0 )
439             {
440                gdcm::SQItem *sqi= modLutSeq->GetFirstSQItem();
441                if ( !sqi )
442                {
443                   std::string lutDescriptor = sqi->GetEntryString(0x0028,0x3002);
444                   int length;   // LUT length in Bytes
445                   int deb;      // Subscript of the first Lut Value
446                   int nbits;    // Lut item size (in Bits)
447                   int nbRead;   // nb of items in LUT descriptor (must be = 3)
448
449                   nbRead = sscanf( lutDescriptor.c_str(),
450                                     "%d\\%d\\%d",
451                                      &length, &deb, &nbits );
452                   if ( nbRead != 3 )
453                   {
454                       std::cout << "Wrong LUT descriptor" << std::endl;
455                   }                                                  
456                   gdcm::DataEntry *b = sqi->GetDataEntry(0x0028,0x3006);
457                   if ( b != 0 )
458                   {
459                      if ( b->GetLength() != 0 )
460                      {
461                         std::cout << "---------------------------------------"
462                                << " We should never reach this point      "
463                                << std::endl;
464                         //LoadEntryBinArea(b);    //LUT Data (CTX dependent)
465                      }   
466                  }
467               }      
468             }
469             else
470                std::cout << "No LUT Data (0x0028,0x3000) found " << std::endl;
471         }
472          else
473          {
474             if ( fh->GetLutItemSize() == 8 )
475             {
476                for (int i=0;i<fh->GetLutItemNumber();i++)
477                   std::cout << i << " : \t"
478                          << (int)(lutrgba[i*4])   << " "
479                          << (int)(lutrgba[i*4+1]) << " "
480                          << (int)(lutrgba[i*4+2]) << std::endl;
481             }
482             else // LutItemSize assumed to be = 16
483             {
484                uint16_t* lutrgba16 = (uint16_t*)lutrgba;
485                for (int i=0;i<fh->GetLutItemNumber();i++)
486                   std::cout << i << " : \t"
487                          << (int)(lutrgba16[i*4])   << " "
488                          << (int)(lutrgba16[i*4+1]) << " "
489                          << (int)(lutrgba16[i*4+2]) << std::endl;
490             }
491          }
492       }
493       else if (showlut)
494       {
495          std::cout << "Try LUT Data "<< std::endl;
496          ShowLutData(f);
497       }
498
499       // Parsability of the gdcm::Document already checked, after Load() !
500       
501       if ( f->IsReadable() )
502       {
503          std::cout <<std::endl<<fileName<<" is Readable"<<std::endl;
504       }
505       else if ( f->GetSeqEntry(0x0041,0x1010) )
506       {
507          std::cout <<std::endl<<fileName<<" looks like a 'PAPYRUS image' file"
508                    <<std::endl;
509       }
510       else if ( f->GetSeqEntry(0x0004,0x1220) )
511       {
512          std::cout <<std::endl<<fileName<<" looks like a 'DICOMDIR file'"
513                    <<std::endl;
514       }
515       else 
516       {
517          std::cout <<std::endl<<fileName<<" doesn't look like an image file "
518              <<std::endl; 
519       }
520  
521       std::cout<<std::flush;
522       f->Delete();
523       fh->Delete();
524    }
525    else  // ====== Deal with a Directory ======
526    {
527       std::cout << "dirName [" << dirName << "]" << std::endl;
528       gdcm::DirList dirList(dirName,1); // gets recursively the file list
529       gdcm::DirListType fileList = dirList.GetFilenames();
530       gdcm::File *f;
531       bool res;
532
533       for( gdcm::DirListType::iterator it  = fileList.begin();
534                                  it != fileList.end();
535                                  ++it )
536       {
537          std::cout << std::endl<<" Start processing :[" << it->c_str() << "]"
538                    << std::endl;
539          f = gdcm::File::New();
540          f->SetLoadMode(loadMode);
541          f->SetFileName( it->c_str() );
542
543          for (int ri=0; ri<forceLoadNb; ri++)
544          {
545             printf("%04x,%04x\n",elemsToForceLoad[2*ri], 
546                                  elemsToForceLoad[2*ri+1]);
547             f->AddForceLoadElement((uint32_t)elemsToForceLoad[2*ri], 
548                                    (uint32_t)elemsToForceLoad[2*ri+1]); 
549          }
550          res = f->Load();
551
552          if ( !res )
553          {
554             std::cout << "Cannot process file [" << it->c_str() << "]" 
555                       << std::endl;
556             std::cout << "Either it doesn't exist, or it's read protected " 
557                       << std::endl;
558             std::cout << "or it's not a Dicom File, or its 'header' is bugged" 
559                       << std::endl;
560             std::cout << "use 'PrintFile filein=... debug' "
561                       << "to try to guess the pb"
562                       << std::endl;
563             f->Delete();
564             continue;
565          }
566
567          gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
568          fh->SetPrintLevel( level );
569          fh->Print();
570
571 //------------------------------
572
573          // Lets's get and print some usefull fields about 'Orientation'
574          // ------------------------------------------------------------
575
576          std::string strPatientPosition = 
577                                        f->GetEntryString(0x0018,0x5100);
578          if ( strPatientPosition != gdcm::GDCM_UNFOUND 
579          && strPatientPosition != "" )  
580                std::cout << "PatientPosition (0x0010,0x5100)= [" 
581                         << strPatientPosition << "]" << std::endl;
582     
583          std::string strViewPosition = 
584                                        f->GetEntryString(0x0018,0x5101);
585          if ( strViewPosition != gdcm::GDCM_UNFOUND 
586          && strViewPosition != "" )  
587                std::cout << "strViewPosition (0x0010,0x5101)= [" 
588                         << strViewPosition << "]" << std::endl;
589          
590          std::string strPatientOrientation = 
591                                        f->GetEntryString(0x0020,0x0020);
592          if ( strPatientOrientation != gdcm::GDCM_UNFOUND
593          && strPatientOrientation != "")  
594             std::cout << "PatientOrientation (0x0020,0x0020)= [" 
595                       << strPatientOrientation << "]" << std::endl;
596
597          std::string strImageOrientationPatient = 
598                                        f->GetEntryString(0x0020,0x0037);  
599          if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND
600          && strImageOrientationPatient != "" )  
601             std::cout << "ImageOrientationPatient (0x0020,0x0037)= [" 
602                      << strImageOrientationPatient << "]" << std::endl;
603
604          std::string strImageOrientationRET = 
605                                        f->GetEntryString(0x0020,0x0035);
606          if ( strImageOrientationRET != gdcm::GDCM_UNFOUND
607          && strImageOrientationRET != "" )
608          {
609             std::cout << "ImageOrientationRET (0x0020,0x0035)= [" 
610                      << strImageOrientationRET << "]" << std::endl;
611          }
612
613          // Let's compute 'user friendly' results about 'Orientation'
614          // ---------------------------------------------------------
615     
616          gdcm::Orientation *o = gdcm::Orientation::New(); 
617
618
619          if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND ||
620             strImageOrientationRET     != gdcm::GDCM_UNFOUND )
621          {
622      
623             gdcm::OrientationType orient = o->GetOrientationType( f );
624     
625             std::cout << "TypeOrientation = " << orient << " (-> " 
626                      << o->GetOrientationTypeString(orient) << " )" << std::endl;
627          }
628
629          std::string ori = o->GetOrientation ( f );
630          if (ori != "\\" )
631             std::cout << "Orientation [" << ori << "]" << std::endl;
632          o->Delete(); 
633
634 //------------------------------- 
635         
636          if (f->IsReadable())
637             std::cout <<std::endl<<it->c_str()<<" is Readable"<<std::endl;
638          else
639             std::cout <<std::endl<<it->c_str()<<" is NOT Readable"<<std::endl;
640          std::cout << "\n\n" << std::endl;
641          f->Delete();
642          fh->Delete();
643       }
644       std::cout<<std::flush;
645    }
646    return 0;
647 }