- delete newDicomDir;
- return 1;
- }
-
- if( !newDicomDir->GetFirstPatient() )
- {
- std::cout<<" Written DicomDir 'NewDICOMDIR'"
- <<" has no patient"<<std::endl
- <<" ...Failed"<<std::endl;
-
- delete newDicomDir;
- return(1);
+ // Read from disc the just written DicomDir
+
+ GDCM_NAME_SPACE::DicomDir *newDicomDir = GDCM_NAME_SPACE::DicomDir::New();
+ newDicomDir->SetFileName( name );
+ newDicomDir->Load();
+ if ( GDCM_NAME_SPACE::Debug::GetDebugFlag() )
+ std::cout << "======================= End Parsing DICOMDIR"
+ << std::endl;
+ if( !newDicomDir->IsReadable() )
+ {
+ std::cout<<" Written DicomDir [" << name << "] "
+ <<" is not readable"<<std::endl
+ <<" ...Failed"<<std::endl;
+
+ newDicomDir->Delete();
+ return 1;
+ }
+
+ if( !newDicomDir->GetFirstPatient() )
+ {
+ std::cout <<" Written DicomDir [" << name << "] "
+ <<" has no patient"<<std::endl
+ <<" ...Failed"<<std::endl;
+
+ newDicomDir->Delete();
+ return(1);
+ }
+ std::cout<<std::flush;
+ newDicomDir->Delete();