+ std::cout << "dirName [" << dirName << "]" << std::endl;
+ gdcm::DirList dirList(dirName,1); // gets recursively the file list
+ gdcm::DirListType fileList = dirList.GetFilenames();
+ gdcm::File *f;
+ bool res;
+ for( gdcm::DirListType::iterator it = fileList.begin();
+ it != fileList.end();
+ ++it )
+ {
+ std::cout << std::endl<<" Start processing :[" << it->c_str() << "]"
+ << std::endl;
+ f = new gdcm::File();
+ 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;
+ delete f;
+ continue;
+ }
+
+ gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ fh->SetPrintLevel( level );
+
+ fh->Print();
+ gdcm::Orientation o;
+ std::string ori = o.GetOrientation ( f );
+ if (ori != gdcm::GDCM_UNFOUND )
+ std::cout << "- Orientation [" << ori << "]" << std::endl;
+
+ gdcm::OrientationType d = o.GetOrientationType( f );
+
+ std::cout << "TypeOrientation = " << d << " (-> "
+ << o.GetOrientationTypeString(d) << std::endl;
+
+ if (f->IsReadable())
+ std::cout <<std::endl<<it->c_str()<<" is Readable"<<std::endl;
+ else
+ std::cout <<std::endl<<it->c_str()<<" is NOT Readable"<<std::endl;
+ std::cout << "\n\n" << std::endl;
+ delete f;
+ delete fh;
+ }
+ std::cout<<std::flush;