+ // ===========================================================================
+ else // =============================== Deal with a Directory =====================
+ { // ===========================================================================
+ std::cout << "dirName [" << dirName << "]" << std::endl;
+
+ GDCM_NAME_SPACE::DirList dirList(dirName,rec); // gets recursively (or not) the file list
+ GDCM_NAME_SPACE::DirListType fileList = dirList.GetFilenames();
+ GDCM_NAME_SPACE::File *f;
+ bool res;
+
+ if (fileList.size() == 0)
+ {
+ std::cout << "No file found in : [" << dirName << "]" << std::endl;
+ }
+
+ for( GDCM_NAME_SPACE::DirListType::iterator it = fileList.begin();
+ it != fileList.end();
+ ++it )
+ {
+ std::cout << std::endl<<" Start processing :[" << it->c_str() << "]"
+ << std::endl;
+ f = GDCM_NAME_SPACE::File::New();
+ f->SetLoadMode(loadMode);
+ f->SetFileName( it->c_str() );
+
+ for (int ri=0; ri<forceLoadNb; ri++)
+ {
+ printf("%04x,%04x\n",elemsToForceLoad[2*ri],
+ elemsToForceLoad[2*ri+1]);
+ f->AddForceLoadElement((uint32_t)elemsToForceLoad[2*ri],
+ (uint32_t)elemsToForceLoad[2*ri+1]);
+ }
+ res = f->Load();
+
+ if ( !res )
+ {
+ std::cout << "Cannot process file [" << it->c_str() << "]"
+ << std::endl;
+ std::cout << "Either it doesn't exist, or it's read protected "
+ << std::endl;
+ std::cout << "or it's not a Dicom File, or its 'header' is bugged"
+ << std::endl;
+ std::cout << "use 'PrintFile filein=... debug' "
+ << "to try to guess the pb"
+ << std::endl;
+ f->Delete();
+ continue;
+ }
+
+ GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f);
+ fh->SetPrintLevel( level );
+ fh->Print();
+
+//------------------------------
+if (!noex)
+{
+ // Lets's get and print some usefull fields about 'Orientation'
+ // ------------------------------------------------------------
+
+ std::string strPatientPosition =
+ f->GetEntryString(0x0018,0x5100);
+ if ( strPatientPosition != GDCM_NAME_SPACE::GDCM_UNFOUND
+ && strPatientPosition != "" )
+ std::cout << "PatientPosition (0x0010,0x5100)= ["
+ << strPatientPosition << "]" << std::endl;
+
+ std::string strViewPosition =
+ f->GetEntryString(0x0018,0x5101);
+ if ( strViewPosition != GDCM_NAME_SPACE::GDCM_UNFOUND
+ && strViewPosition != "" )
+ std::cout << "strViewPosition (0x0010,0x5101)= ["
+ << strViewPosition << "]" << std::endl;
+
+ std::string strPatientOrientation =
+ f->GetEntryString(0x0020,0x0020);
+ if ( strPatientOrientation != GDCM_NAME_SPACE::GDCM_UNFOUND
+ && strPatientOrientation != "")
+ std::cout << "PatientOrientation (0x0020,0x0020)= ["
+ << strPatientOrientation << "]" << std::endl;
+
+ std::string strImageOrientationPatient =
+ f->GetEntryString(0x0020,0x0037);
+ if ( strImageOrientationPatient != GDCM_NAME_SPACE::GDCM_UNFOUND
+ && strImageOrientationPatient != "" )
+ std::cout << "ImageOrientationPatient (0x0020,0x0037)= ["
+ << strImageOrientationPatient << "]" << std::endl;
+
+ std::string strImageOrientationRET =
+ f->GetEntryString(0x0020,0x0035);
+ if ( strImageOrientationRET != GDCM_NAME_SPACE::GDCM_UNFOUND
+ && strImageOrientationRET != "" )
+ {
+ std::cout << "ImageOrientationRET (0x0020,0x0035)= ["
+ << strImageOrientationRET << "]" << std::endl;
+ }
+
+ // Let's compute 'user friendly' results about 'Orientation'
+ // ---------------------------------------------------------
+
+ GDCM_NAME_SPACE::Orientation *o = GDCM_NAME_SPACE::Orientation::New();
+
+
+ if ( strImageOrientationPatient != GDCM_NAME_SPACE::GDCM_UNFOUND ||
+ strImageOrientationRET != GDCM_NAME_SPACE::GDCM_UNFOUND )
+ {