- * \brief Constructor Parses recursively the directory and creates the DicomDir
- * or uses an already built DICOMDIR, depending on 'parseDir' value.
- * @param FileName name
- * - of the root directory (parseDir = true)
- * - of the DICOMDIR (parseDir = false)
- * @param parseDir boolean
- * - true if user passed an entry point
- * and wants to explore recursively the directories
- * - false if user passed an already built DICOMDIR file
- * and wants to use it
- * @param exception_on_error whether we want to throw an exception or not
- */
-gdcmDicomDir::gdcmDicomDir(const char *FileName, bool parseDir,
- bool exception_on_error):
- gdcmParser(FileName,exception_on_error,true) // true : enable SeQuences
-{
- // que l'on ai passe un root directory ou un DICOMDIR
- // et quelle que soit la valeur de parseDir,
- // on a lance gdcmParser
-
- startMethod= NULL;
- progressMethod= NULL;
- endMethod= NULL;
- startMethodArgDelete= NULL;
- progressMethodArgDelete=NULL;
- endMethodArgDelete= NULL;
- startArg= NULL;
- progressArg= NULL;
- endArg= NULL;
-
- progress=0.0;
- abort=false;
-
- metaElems=NULL;
-
-// gdcmParser already executed
-// if user passed a root directory, sure we didn't get anything
-
- if( GetListEntry().begin()==GetListEntry().end() )
- {
- // if parseDir == false, it should be tagged as an error
- dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : entry list empty");
-
- if(strlen(FileName)==1 && FileName[0]=='.') { // user passed '.' as Name
- // we get current directory name
- char*dummy=(char*) malloc(1000);
- getcwd(dummy,(size_t)1000);
- SetFileName(dummy); // will be converted into a string
- free(dummy); // no longer needed
- }
-
- if(parseDir)
- {
- dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : Parse directory"
- " and create the DicomDir");
- ParseDirectory();
- }
- }
- else {
- CreateDicomDir();
- CheckBoundaries(); // to maintain consistency between
- // home-made gdcmDicomDir
- // and the ones comming from a DICOMDIR file
- }