+// check *all* the dicom elements (gdcm::DocEntry)
+// of this gdcm::DicomDirObject
+int CompareSQItem(gdcm::SQItem *pa1, gdcm::SQItem *pa2 )
+{
+ gdcm::DocEntry *e1;
+ gdcm::DocEntry *e2;
+
+ e2 = pa2->GetFirstEntry();
+ while (!e2)
+ {
+ // locate the corresponding element in 'source' file
+ e1 = pa1->GetDocEntry( e2->GetGroup(),e2->GetElement() );
+
+ // an element doesn't exist in origin file
+ if (!e1)
+ {
+ std::cout << "DicomDir element " << std::hex
+ << e2->GetGroup() << "," <<e2->GetElement() << std::endl;
+ return 1;
+ }
+ // skip SeqEntries (I don't want to deal with 'recursion pbs' here)
+ if ( !dynamic_cast<gdcm::ValEntry*>(e1) ||
+ !dynamic_cast<gdcm::ValEntry*>(e2) )
+ continue;
+
+ // a value is read as GDCM_UNFOUND
+ if ( ((gdcm::ValEntry*)e1)->GetValue() == gdcm::GDCM_UNFOUND )
+ {
+ std::cout << "for gdcm source DicomDir : element (" << std::hex
+ << e1->GetGroup() << "," <<e1->GetElement()
+ << ") has values [" << gdcm::GDCM_UNFOUND << "]"
+ << std::endl;
+ return 1;
+ }
+
+ // values differ in source file and destination file
+ if ( ((gdcm::ValEntry*)e1)->GetValue() !=
+ ((gdcm::ValEntry*)e2)->GetValue() )
+ {
+
+ // serious trouble : values differ in source and destination file
+ std::cout << "for gdcm DicomDir element (" << std::hex
+ << e2->GetGroup() << "," <<e2->GetElement()
+ << ") values differ ["
+ << ((gdcm::ValEntry*)e1)->GetValue() << "] != ["
+ << ((gdcm::ValEntry*)e2)->GetValue() << "]"
+ << std::endl;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int TestDicomDir(int argc, char *argv[])